diff --git a/config/neovim/config.lua b/config/neovim/config.lua index d532a43b..7b89c328 100644 --- a/config/neovim/config.lua +++ b/config/neovim/config.lua @@ -94,7 +94,7 @@ require("lazy").setup({ require("nvim-web-devicons").setup(opts) end, ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/nvim-web-devicons", - ["lazy"] = false, + ["lazy"] = true, ["name"] = "web-devicons", }, { @@ -122,16 +122,6 @@ require("lazy").setup({ ["name"] = "better-escape", ["opts"] = { ["mapping"] = { "jk" }, ["timeout"] = 200 }, }, - { - "chadtree", - ["config"] = function(_, opts) - vim.api.nvim_set_var("chadtree_settings", opts) - end, - ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/chadtree", - ["lazy"] = false, - ["name"] = "chadtree", - ["opts"] = { ["theme"] = { ["text_colour_set"] = "nord" }, ["xdg"] = true }, - }, { "clangd-extensions", ["config"] = function(_, opts) @@ -150,45 +140,45 @@ require("lazy").setup({ { "cmp-async-path", ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/cmp-async-path", - ["lazy"] = false, + ["lazy"] = true, ["name"] = "cmp-async-path", }, { "cmp-buffer", ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/cmp-buffer", ["enabled"] = false, - ["lazy"] = false, + ["lazy"] = true, ["name"] = "cmp-buffer", }, { "cmp-cmdline", ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/cmp-cmdline", ["enabled"] = false, - ["lazy"] = false, + ["lazy"] = true, ["name"] = "cmp-cmdline", }, { "cmp-emoji", ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/cmp-emoji", - ["lazy"] = false, + ["lazy"] = true, ["name"] = "cmp-emoji", }, { "cmp-nvim-lsp", ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/cmp-nvim-lsp", - ["lazy"] = false, + ["lazy"] = true, ["name"] = "cmp-nvim-lsp", }, { "cmp-nvim-lsp-signature-help", ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/cmp-nvim-lsp-signature-help", - ["lazy"] = false, + ["lazy"] = true, ["name"] = "cmp-nvim-lsp-signature-help", }, { "cmp-luasnip", ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/cmp_luasnip", - ["lazy"] = false, + ["lazy"] = true, ["name"] = "cmp-luasnip", }, }, @@ -229,16 +219,22 @@ require("lazy").setup({ }, mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), - [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete({}), - + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.abort(), [""] = cmp.mapping.confirm({ select = true }), - + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() @@ -250,16 +246,7 @@ require("lazy").setup({ fallback() end end, { "i", "s" }), - - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), }), } end, @@ -282,12 +269,13 @@ require("lazy").setup({ { "ts-context-commentstring", ["config"] = function(_, opts) - vim.g.skip_ts_context_commentstring_module = true -- Skip compatibility checks + -- Skip compatibility checks + vim.g.skip_ts_context_commentstring_module = true require("ts_context_commentstring").setup(opts) end, ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/nvim-ts-context-commentstring", - ["lazy"] = false, + ["lazy"] = true, ["name"] = "ts-context-commentstring", }, }, @@ -335,7 +323,7 @@ require("lazy").setup({ require("flash").setup(opts) end, ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/flash.nvim", - ["lazy"] = false, + ["lazy"] = true, ["name"] = "flash", }, { @@ -501,7 +489,15 @@ require("lazy").setup({ { "lualine", ["config"] = function(_, opts) - require("lualine").setup(opts) + local lualine = require("lualine") + + lualine.setup(opts) + + -- Disable tabline/winbar sections + lualine.hide({ + place = { "tabline", "winbar" }, + unhide = false, + }) end, ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/lualine.nvim", ["lazy"] = false, @@ -518,12 +514,11 @@ require("lazy").setup({ ["sections"] = { ["lualine_a"] = { "mode" }, ["lualine_b"] = { "branch", "diff", "diagnostics" }, - ["lualine_c"] = { { ["extraConfig"] = { ["path"] = 1 }, ["name"] = "filename" } }, + ["lualine_c"] = { { "filename", path = 1 } }, ["lualine_x"] = { "filetype", "encoding", "fileformat" }, ["lualine_y"] = { "progress", "searchcount", "selectioncount" }, ["lualine_z"] = { "location" }, }, - ["tabline"] = { ["lualine_a"] = { "buffers" }, ["lualine_z"] = { "tabs" } }, }, }, { @@ -556,16 +551,73 @@ require("lazy").setup({ ["name"] = "navic", ["opts"] = { ["click"] = true, ["highlight"] = true, ["lsp"] = { ["auto_attach"] = true } }, }, + { + "neo-tree", + ["cmd"] = "Neotree", + ["config"] = function(_, opts) + require("neo-tree").setup(opts) + end, + ["dependencies"] = { + { + "plenary", + ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/plenary.nvim", + ["lazy"] = true, + ["name"] = "plenary", + }, + { + "web-devicons", + ["config"] = function(_, opts) + require("nvim-web-devicons").setup(opts) + end, + ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/nvim-web-devicons", + ["lazy"] = true, + ["name"] = "web-devicons", + }, + { + "nui", + ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/nui.nvim", + ["lazy"] = true, + ["name"] = "nui", + }, + }, + ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/neo-tree.nvim", + ["lazy"] = true, + ["name"] = "neo-tree", + ["opts"] = { + ["buffers"] = { ["follow_current_file"] = { ["enabled"] = true, ["leave_dirs_open"] = false } }, + ["filesystem"] = { ["follow_current_file"] = { ["enabled"] = true, ["leave_dirs_open"] = false } }, + ["use_default_mappings"] = false, + ["window"] = { + ["mappings"] = { + ["/"] = "fuzzy_finder", + [""] = "toggle_node", + [""] = "cancel", + [""] = "open", + ["?"] = "show_help", + }, + }, + }, + }, { "noice", ["config"] = function(_, opts) require("noice").setup(opts) end, ["dependencies"] = { + { + "notify", + ["config"] = function(_, opts) + vim.notify = require("notify") + require("notify").setup(opts) + end, + ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/nvim-notify", + ["lazy"] = true, + ["name"] = "notify", + }, { "nui", ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/nui.nvim", - ["lazy"] = false, + ["lazy"] = true, ["name"] = "nui", }, }, @@ -605,16 +657,6 @@ require("lazy").setup({ }, }, }, - { - "notify", - ["config"] = function(_, opts) - vim.notify = require("notify") - require("notify").setup(opts) - end, - ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/nvim-notify", - ["lazy"] = false, - ["name"] = "notify", - }, { "rainbow-delimiters", ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim", @@ -641,6 +683,7 @@ require("lazy").setup({ }, { "telescope", + ["cmd"] = "Telescope", ["config"] = function(_, opts) local telescope = require("telescope") telescope.setup(opts) @@ -653,30 +696,30 @@ require("lazy").setup({ { "plenary", ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/plenary.nvim", - ["lazy"] = false, + ["lazy"] = true, ["name"] = "plenary", }, + { + "telescope-fzf-native", + ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/telescope-fzf-native.nvim", + ["lazy"] = true, + ["name"] = "telescope-fzf-native", + }, { "telescope-undo", ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/telescope-undo.nvim", - ["lazy"] = false, + ["lazy"] = true, ["name"] = "telescope-undo", }, { "telescope-ui-select", ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/telescope-ui-select.nvim", - ["lazy"] = false, + ["lazy"] = true, ["name"] = "telescope-ui-select", }, - { - "telescope-fzf-native", - ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/telescope-fzf-native.nvim", - ["lazy"] = false, - ["name"] = "telescope-fzf-native", - }, }, ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/telescope.nvim", - ["lazy"] = false, + ["lazy"] = true, ["name"] = "telescope", ["opts"] = { ["defaults"] = { @@ -692,11 +735,14 @@ require("lazy").setup({ }, { "todo-comments", + ["config"] = function(_, opts) + require("todo-comments").setup(opts) + end, ["dependencies"] = { { "plenary", ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/plenary.nvim", - ["lazy"] = false, + ["lazy"] = true, ["name"] = "plenary", }, }, @@ -784,7 +830,7 @@ require("lazy").setup({ { "promise", ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/promise-async", - ["lazy"] = false, + ["lazy"] = true, ["name"] = "promise", }, }, @@ -804,11 +850,12 @@ require("lazy").setup({ }, { "yanky", + ["cmd"] = { "YankyClearHistory", "YankyRingHistory" }, ["config"] = function(_, opts) require("yanky").setup(opts) end, ["dir"] = "/home/lab/smchurla/Downloads/flake-nixinator/config/neovim/store/lazy-plugins/yanky.nvim", - ["lazy"] = false, + ["lazy"] = true, ["name"] = "yanky", }, }, @@ -817,25 +864,25 @@ require("lazy").setup({ -- Set up keybinds {{{ do local __nixvim_binds = { - { ["action"] = "w", ["key"] = "", ["mode"] = "n", ["options"] = { + { ["action"] = "w", ["key"] = "", ["mode"] = "n", ["options"] = { ["desc"] = "Save current buffer", } }, - { ["action"] = "wa", ["key"] = "", ["mode"] = "n", ["options"] = { + { ["action"] = "wa", ["key"] = "", ["mode"] = "n", ["options"] = { ["desc"] = "Save all buffers", } }, { ["action"] = ""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), - [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete({}), - + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.abort(), [""] = cmp.mapping.confirm({ select = true }), - + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() @@ -250,16 +246,7 @@ require("lazy").setup({ fallback() end end, { "i", "s" }), - - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), }), } end, @@ -269,7 +256,7 @@ require("lazy").setup({ ["config"] = function(_, opts) require("colorizer").setup(opts) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/nvim-colorizer.lua", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/nvim-colorizer.lua", ["lazy"] = false, ["name"] = "colorizer", }, @@ -282,16 +269,17 @@ require("lazy").setup({ { "ts-context-commentstring", ["config"] = function(_, opts) - vim.g.skip_ts_context_commentstring_module = true -- Skip compatibility checks + -- Skip compatibility checks + vim.g.skip_ts_context_commentstring_module = true require("ts_context_commentstring").setup(opts) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/nvim-ts-context-commentstring", - ["lazy"] = false, + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/nvim-ts-context-commentstring", + ["lazy"] = true, ["name"] = "ts-context-commentstring", }, }, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/comment.nvim", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/comment.nvim", ["lazy"] = false, ["name"] = "comment", ["opts"] = { @@ -308,7 +296,7 @@ require("lazy").setup({ ["config"] = function(_, opts) require("conform").setup(opts) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/conform.nvim", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/conform.nvim", ["lazy"] = false, ["name"] = "conform", ["opts"] = { @@ -334,8 +322,8 @@ require("lazy").setup({ ["config"] = function(_, opts) require("flash").setup(opts) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/flash.nvim", - ["lazy"] = false, + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/flash.nvim", + ["lazy"] = true, ["name"] = "flash", }, { @@ -345,7 +333,7 @@ require("lazy").setup({ vim.g[k] = v end end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/git-messenger.vim", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/git-messenger.vim", ["lazy"] = false, ["name"] = "gitmessenger", ["opts"] = { @@ -358,14 +346,14 @@ require("lazy").setup({ ["config"] = function(_, opts) require("gitsigns").setup(opts) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/gitsigns.nvim", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/gitsigns.nvim", ["lazy"] = false, ["name"] = "gitsigns", ["opts"] = { ["current_line_blame"] = false }, }, { "haskell-tools", - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/haskell-tools.nvim", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/haskell-tools.nvim", ["lazy"] = false, ["name"] = "haskell-tools", }, @@ -374,7 +362,7 @@ require("lazy").setup({ ["config"] = function(_, opts) require("illuminate").configure(opts) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/vim-illuminate", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/vim-illuminate", ["lazy"] = false, ["name"] = "illuminate", ["opts"] = { @@ -393,7 +381,7 @@ require("lazy").setup({ }, { "intellitab", - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/intellitab.nvim", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/intellitab.nvim", ["lazy"] = false, ["name"] = "intellitab", }, @@ -402,13 +390,13 @@ require("lazy").setup({ ["config"] = function(_, opts) require("nvim-lastplace").setup(opts) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/nvim-lastplace", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/nvim-lastplace", ["lazy"] = false, ["name"] = "lastplace", }, { "lazygit", - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/lazygit.nvim", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/lazygit.nvim", ["lazy"] = false, ["name"] = "lazygit", }, @@ -421,7 +409,7 @@ require("lazy").setup({ lint[k] = v end end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/nvim-lint", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/nvim-lint", ["lazy"] = false, ["name"] = "lint", ["opts"] = { @@ -489,21 +477,29 @@ require("lazy").setup({ ["config"] = function(_, opts) require("neodev").setup(opts) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/neodev.nvim", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/neodev.nvim", ["lazy"] = false, ["name"] = "neodev", }, }, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/nvim-lspconfig", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/nvim-lspconfig", ["lazy"] = false, ["name"] = "lspconfig", }, { "lualine", ["config"] = function(_, opts) - require("lualine").setup(opts) + local lualine = require("lualine") + + lualine.setup(opts) + + -- Disable tabline/winbar sections + lualine.hide({ + place = { "tabline", "winbar" }, + unhide = false, + }) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/lualine.nvim", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/lualine.nvim", ["lazy"] = false, ["name"] = "lualine", ["opts"] = { @@ -518,12 +514,11 @@ require("lazy").setup({ ["sections"] = { ["lualine_a"] = { "mode" }, ["lualine_b"] = { "branch", "diff", "diagnostics" }, - ["lualine_c"] = { { ["extraConfig"] = { ["path"] = 1 }, ["name"] = "filename" } }, + ["lualine_c"] = { { "filename", path = 1 } }, ["lualine_x"] = { "filetype", "encoding", "fileformat" }, ["lualine_y"] = { "progress", "searchcount", "selectioncount" }, ["lualine_z"] = { "location" }, }, - ["tabline"] = { ["lualine_a"] = { "buffers" }, ["lualine_z"] = { "tabs" } }, }, }, { @@ -531,7 +526,7 @@ require("lazy").setup({ ["config"] = function(_, opts) require("luasnip").config.set_config(opts) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/luasnip", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/luasnip", ["lazy"] = false, ["name"] = "luasnip", }, @@ -541,7 +536,7 @@ require("lazy").setup({ local actions = require("nvim-navbuddy.actions") -- ? require("nvim-navbuddy").setup(opts) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/nvim-navbuddy", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/nvim-navbuddy", ["lazy"] = false, ["name"] = "navbuddy", ["opts"] = { ["lsp"] = { ["auto_attach"] = true }, ["window"] = { ["border"] = "rounded" } }, @@ -551,25 +546,82 @@ require("lazy").setup({ ["config"] = function(_, opts) require("nvim-navic").setup(opts) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/nvim-navic", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/nvim-navic", ["lazy"] = false, ["name"] = "navic", ["opts"] = { ["click"] = true, ["highlight"] = true, ["lsp"] = { ["auto_attach"] = true } }, }, + { + "neo-tree", + ["cmd"] = "Neotree", + ["config"] = function(_, opts) + require("neo-tree").setup(opts) + end, + ["dependencies"] = { + { + "plenary", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/plenary.nvim", + ["lazy"] = true, + ["name"] = "plenary", + }, + { + "web-devicons", + ["config"] = function(_, opts) + require("nvim-web-devicons").setup(opts) + end, + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/nvim-web-devicons", + ["lazy"] = true, + ["name"] = "web-devicons", + }, + { + "nui", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/nui.nvim", + ["lazy"] = true, + ["name"] = "nui", + }, + }, + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/neo-tree.nvim", + ["lazy"] = true, + ["name"] = "neo-tree", + ["opts"] = { + ["buffers"] = { ["follow_current_file"] = { ["enabled"] = true, ["leave_dirs_open"] = false } }, + ["filesystem"] = { ["follow_current_file"] = { ["enabled"] = true, ["leave_dirs_open"] = false } }, + ["use_default_mappings"] = false, + ["window"] = { + ["mappings"] = { + ["/"] = "fuzzy_finder", + [""] = "toggle_node", + [""] = "cancel", + [""] = "open", + ["?"] = "show_help", + }, + }, + }, + }, { "noice", ["config"] = function(_, opts) require("noice").setup(opts) end, ["dependencies"] = { + { + "notify", + ["config"] = function(_, opts) + vim.notify = require("notify") + require("notify").setup(opts) + end, + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/nvim-notify", + ["lazy"] = true, + ["name"] = "notify", + }, { "nui", - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/nui.nvim", - ["lazy"] = false, + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/nui.nvim", + ["lazy"] = true, ["name"] = "nui", }, }, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/noice.nvim", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/noice.nvim", ["lazy"] = false, ["name"] = "noice", ["opts"] = { @@ -605,42 +657,33 @@ require("lazy").setup({ }, }, }, - { - "notify", - ["config"] = function(_, opts) - vim.notify = require("notify") - require("notify").setup(opts) - end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/nvim-notify", - ["lazy"] = false, - ["name"] = "notify", - }, { "rainbow-delimiters", - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/rainbow-delimiters.nvim", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/rainbow-delimiters.nvim", ["lazy"] = false, ["name"] = "rainbow-delimiters", }, { "rustaceanvim", - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/rustaceanvim", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/rustaceanvim", ["lazy"] = false, ["name"] = "rustaceanvim", }, { "sandwich", - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/vim-sandwich", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/vim-sandwich", ["lazy"] = false, ["name"] = "sandwich", }, { "sleuth", - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/vim-sleuth", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/vim-sleuth", ["lazy"] = false, ["name"] = "sleuth", }, { "telescope", + ["cmd"] = "Telescope", ["config"] = function(_, opts) local telescope = require("telescope") telescope.setup(opts) @@ -652,31 +695,31 @@ require("lazy").setup({ ["dependencies"] = { { "plenary", - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/plenary.nvim", - ["lazy"] = false, + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/plenary.nvim", + ["lazy"] = true, ["name"] = "plenary", }, + { + "telescope-fzf-native", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/telescope-fzf-native.nvim", + ["lazy"] = true, + ["name"] = "telescope-fzf-native", + }, { "telescope-undo", - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/telescope-undo.nvim", - ["lazy"] = false, + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/telescope-undo.nvim", + ["lazy"] = true, ["name"] = "telescope-undo", }, { "telescope-ui-select", - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/telescope-ui-select.nvim", - ["lazy"] = false, + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/telescope-ui-select.nvim", + ["lazy"] = true, ["name"] = "telescope-ui-select", }, - { - "telescope-fzf-native", - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/telescope-fzf-native.nvim", - ["lazy"] = false, - ["name"] = "telescope-fzf-native", - }, }, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/telescope.nvim", - ["lazy"] = false, + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/telescope.nvim", + ["lazy"] = true, ["name"] = "telescope", ["opts"] = { ["defaults"] = { @@ -692,15 +735,18 @@ require("lazy").setup({ }, { "todo-comments", + ["config"] = function(_, opts) + require("todo-comments").setup(opts) + end, ["dependencies"] = { { "plenary", - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/plenary.nvim", - ["lazy"] = false, + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/plenary.nvim", + ["lazy"] = true, ["name"] = "plenary", }, }, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/todo-comments.nvim", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/todo-comments.nvim", ["lazy"] = false, ["name"] = "todo-comments", }, @@ -709,7 +755,7 @@ require("lazy").setup({ ["config"] = function(_, opts) require("toggleterm").setup(opts) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/toggleterm.nvim", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/toggleterm.nvim", ["lazy"] = false, ["name"] = "toggleterm", ["opts"] = { @@ -732,13 +778,13 @@ require("lazy").setup({ ["config"] = function(_, opts) -- Fix treesitter grammars/parsers on nix vim.opt.runtimepath:append( - "/nix/store/a05m2wf9i4lx3010pagz1p5s4vl1dva2-vimplugin-nvim-treesitter-2024-05-25" + "/nix/store/dks5shbpaksflcsig4dspi8vs9a06yqw-vimplugin-nvim-treesitter-2024-05-28" ) - vim.opt.runtimepath:append("/nix/store/7lrj56kr2nj7591m4kjiq03hq9kwabm9-treesitter-parsers") + vim.opt.runtimepath:append("/nix/store/774ydms06ccrb8zybw2y045ajgs9l7jk-treesitter-parsers") require("nvim-treesitter.configs").setup(opts) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/nvim-treesitter", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/nvim-treesitter", ["lazy"] = false, ["name"] = "treesitter", ["opts"] = { @@ -754,7 +800,7 @@ require("lazy").setup({ }, }, ["indent"] = { ["enable"] = true }, - ["parser_install_dir"] = "/nix/store/7lrj56kr2nj7591m4kjiq03hq9kwabm9-treesitter-parsers", + ["parser_install_dir"] = "/nix/store/774ydms06ccrb8zybw2y045ajgs9l7jk-treesitter-parsers", }, }, { @@ -762,7 +808,7 @@ require("lazy").setup({ ["config"] = function(_, opts) require("trim").setup(opts) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/trim.nvim", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/trim.nvim", ["lazy"] = false, ["name"] = "trim", }, @@ -771,7 +817,7 @@ require("lazy").setup({ ["config"] = function(_, opts) require("trouble").setup(opts) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/trouble.nvim", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/trouble.nvim", ["lazy"] = false, ["name"] = "trouble", }, @@ -783,12 +829,12 @@ require("lazy").setup({ ["dependencies"] = { { "promise", - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/promise-async", - ["lazy"] = false, + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/promise-async", + ["lazy"] = true, ["name"] = "promise", }, }, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/nvim-ufo", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/nvim-ufo", ["lazy"] = false, ["name"] = "ufo", }, @@ -797,18 +843,19 @@ require("lazy").setup({ ["config"] = function(_, opts) require("which-key").setup(opts) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/which-key.nvim", + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/which-key.nvim", ["lazy"] = false, ["name"] = "which-key", ["priority"] = 500, }, { "yanky", + ["cmd"] = { "YankyClearHistory", "YankyRingHistory" }, ["config"] = function(_, opts) require("yanky").setup(opts) end, - ["dir"] = "/nix/store/8m92rbw7hfvgr0i4jvcmlpn1lb1chjq2-lazy-plugins/yanky.nvim", - ["lazy"] = false, + ["dir"] = "/nix/store/8bx1xnvd173gghqaak7qyfr9ay7vxdw3-lazy-plugins/yanky.nvim", + ["lazy"] = true, ["name"] = "yanky", }, }, @@ -817,25 +864,25 @@ require("lazy").setup({ -- Set up keybinds {{{ do local __nixvim_binds = { - { ["action"] = "w", ["key"] = "", ["mode"] = "n", ["options"] = { + { ["action"] = "w", ["key"] = "", ["mode"] = "n", ["options"] = { ["desc"] = "Save current buffer", } }, - { ["action"] = "wa", ["key"] = "", ["mode"] = "n", ["options"] = { + { ["action"] = "wa", ["key"] = "", ["mode"] = "n", ["options"] = { ["desc"] = "Save all buffers", } }, { ["action"] = "lua hints = { "italic" }, warnings = { "italic" }, information = { "italic" }, + ok = { "italic" }, }, underlines = { errors = { "underline" }, hints = { "underline" }, warnings = { "underline" }, information = { "underline" }, + ok = { "underline" }, }, inlay_hints = { background = true, diff --git a/config/neovim/store/lazy-plugins/catppuccin-nvim/doc/tags b/config/neovim/store/lazy-plugins/catppuccin-nvim/doc/tags new file mode 100644 index 00000000..de38a966 --- /dev/null +++ b/config/neovim/store/lazy-plugins/catppuccin-nvim/doc/tags @@ -0,0 +1,15 @@ +catppuccin-compile catppuccin.txt /*catppuccin-compile* +catppuccin-configuration catppuccin.txt /*catppuccin-configuration* +catppuccin-customize-highlights catppuccin.txt /*catppuccin-customize-highlights* +catppuccin-customize-highlights-get-catppuccin-colors catppuccin.txt /*catppuccin-customize-highlights-get-catppuccin-colors* +catppuccin-customize-highlights-overwriting-colors catppuccin.txt /*catppuccin-customize-highlights-overwriting-colors* +catppuccin-faq catppuccin.txt /*catppuccin-faq* +catppuccin-faq-wrong-treesitter-highlights catppuccin.txt /*catppuccin-faq-wrong-treesitter-highlights* +catppuccin-features catppuccin.txt /*catppuccin-features* +catppuccin-installation catppuccin.txt /*catppuccin-installation* +catppuccin-integrations catppuccin.txt /*catppuccin-integrations* +catppuccin-links catppuccin.txt /*catppuccin-links* +catppuccin-table-of-contents catppuccin.txt /*catppuccin-table-of-contents* +catppuccin-thanks-to catppuccin.txt /*catppuccin-thanks-to* +catppuccin-usage catppuccin.txt /*catppuccin-usage* +catppuccin.txt catppuccin.txt /*catppuccin.txt* diff --git a/config/neovim/store/lazy-plugins/catppuccin-nvim/lua/catppuccin/groups/integrations/native_lsp.lua b/config/neovim/store/lazy-plugins/catppuccin-nvim/lua/catppuccin/groups/integrations/native_lsp.lua index e4ae10a7..49ce8135 100644 --- a/config/neovim/store/lazy-plugins/catppuccin-nvim/lua/catppuccin/groups/integrations/native_lsp.lua +++ b/config/neovim/store/lazy-plugins/catppuccin-nvim/lua/catppuccin/groups/integrations/native_lsp.lua @@ -9,6 +9,7 @@ function M.get() local warning = C.yellow local info = C.sky local hint = C.teal + local ok = C.green local darkening_percentage = 0.095 return { @@ -40,27 +41,35 @@ function M.get() fg = hint, style = virtual_text.hints, }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default + DiagnosticVirtualTextOk = { + bg = O.transparent_background and C.none or U.darken(hint, darkening_percentage, C.base), + fg = ok, + style = virtual_text.ok, + }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default DiagnosticError = { bg = C.none, fg = error, style = virtual_text.errors }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default DiagnosticWarn = { bg = C.none, fg = warning, style = virtual_text.warnings }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default DiagnosticInfo = { bg = C.none, fg = info, style = virtual_text.information }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default DiagnosticHint = { bg = C.none, fg = hint, style = virtual_text.hints }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default + DiagnosticOk = { bg = C.none, fg = ok, style = virtual_text.ok }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default - -- for nvim nightly DiagnosticUnderlineError = { style = underlines.errors, sp = error }, -- Used to underline "Error" diagnostics DiagnosticUnderlineWarn = { style = underlines.warnings, sp = warning }, -- Used to underline "Warn" diagnostics DiagnosticUnderlineInfo = { style = underlines.information, sp = info }, -- Used to underline "Info" diagnostics DiagnosticUnderlineHint = { style = underlines.hints, sp = hint }, -- Used to underline "Hint" diagnostics + DiagnosticUnderlineOk = { style = underlines.ok, sp = ok }, -- Used to underline "Ok" diagnostics DiagnosticFloatingError = { fg = error }, -- Used to color "Error" diagnostic messages in diagnostics float DiagnosticFloatingWarn = { fg = warning }, -- Used to color "Warn" diagnostic messages in diagnostics float DiagnosticFloatingInfo = { fg = info }, -- Used to color "Info" diagnostic messages in diagnostics float DiagnosticFloatingHint = { fg = hint }, -- Used to color "Hint" diagnostic messages in diagnostics float + DiagnosticFloatingOk = { fg = ok }, -- Used to color "Ok" diagnostic messages in diagnostics float DiagnosticSignError = { fg = error }, -- Used for "Error" signs in sign column DiagnosticSignWarn = { fg = warning }, -- Used for "Warn" signs in sign column DiagnosticSignInfo = { fg = info }, -- Used for "Info" signs in sign column DiagnosticSignHint = { fg = hint }, -- Used for "Hint" signs in sign column + DiagnosticSignOk = { fg = ok }, -- Used for "Ok" signs in sign column LspDiagnosticsDefaultError = { fg = error }, -- Used as the mantle highlight group. Other LspDiagnostic highlights link to this by default (except Underline) LspDiagnosticsDefaultWarning = { fg = warning }, -- Used as the mantle highlight group. Other LspDiagnostic highlights link to this by default (except Underline) diff --git a/config/neovim/store/lazy-plugins/catppuccin-nvim/lua/catppuccin/groups/integrations/treesitter_context.lua b/config/neovim/store/lazy-plugins/catppuccin-nvim/lua/catppuccin/groups/integrations/treesitter_context.lua index a21518ec..ff18dcdf 100644 --- a/config/neovim/store/lazy-plugins/catppuccin-nvim/lua/catppuccin/groups/integrations/treesitter_context.lua +++ b/config/neovim/store/lazy-plugins/catppuccin-nvim/lua/catppuccin/groups/integrations/treesitter_context.lua @@ -1,18 +1,21 @@ local M = {} function M.get() - return O.transparent_background and { - TreesitterContextBottom = { sp = C.dim, style = { "underline" } }, - } or { - TreesitterContextBottom = { - sp = C.surface0, - style = { "underline" }, - }, - TreesitterContextLineNumber = { - fg = C.surface1, - bg = C.mantle, - }, - } + return O.transparent_background + and { + TreesitterContextBottom = { sp = C.dim, style = { "underline" } }, + TreesitterContextLineNumber = { fg = C.rosewater }, + } + or { + TreesitterContextBottom = { + sp = C.surface0, + style = { "underline" }, + }, + TreesitterContextLineNumber = { + fg = C.surface1, + bg = C.mantle, + }, + } end return M diff --git a/config/neovim/store/lazy-plugins/catppuccin-nvim/lua/catppuccin/init.lua b/config/neovim/store/lazy-plugins/catppuccin-nvim/lua/catppuccin/init.lua index ad205f95..6df3f131 100644 --- a/config/neovim/store/lazy-plugins/catppuccin-nvim/lua/catppuccin/init.lua +++ b/config/neovim/store/lazy-plugins/catppuccin-nvim/lua/catppuccin/init.lua @@ -78,12 +78,14 @@ local M = { hints = { "italic" }, warnings = { "italic" }, information = { "italic" }, + ok = { "italic" }, }, underlines = { errors = { "underline" }, hints = { "underline" }, warnings = { "underline" }, information = { "underline" }, + ok = { "underline" }, }, inlay_hints = { background = true, diff --git a/config/neovim/store/lazy-plugins/catppuccin-nvim/lua/catppuccin/types.lua b/config/neovim/store/lazy-plugins/catppuccin-nvim/lua/catppuccin/types.lua index 8b98a293..65fdc0e0 100644 --- a/config/neovim/store/lazy-plugins/catppuccin-nvim/lua/catppuccin/types.lua +++ b/config/neovim/store/lazy-plugins/catppuccin-nvim/lua/catppuccin/types.lua @@ -87,14 +87,16 @@ ---@field miscs CtpHighlightArgs[]? ---@class CtpNativeLspStyles --- Change the style of LSP errors. +-- Change the style of LSP error diagnostics. ---@field errors CtpHighlightArgs[]? --- Change the style of LSP hints. +-- Change the style of LSP hint diagnostics. ---@field hints CtpHighlightArgs[]? --- Change the style of LSP warnings. +-- Change the style of LSP warning diagnostics. ---@field warnings CtpHighlightArgs[]? --- Change the style of LSP information. +-- Change the style of LSP information diagnostics. ---@field information CtpHighlightArgs[]? +-- Change the style of LSP ok diagnostics. +---@field ok CtpHighlightArgs[]? ---@class CtpNativeLspInlayHints -- Toggle the background of inlay hints. diff --git a/config/neovim/store/lazy-plugins/chadtree/.dockerignore b/config/neovim/store/lazy-plugins/chadtree/.dockerignore deleted file mode 100644 index 706a2a11..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/.dockerignore +++ /dev/null @@ -1,7 +0,0 @@ -/.git/ -/.venv/ -__pycache__/ -.mypy_cache/ -/.vars/ -/temp/ -/.vscode/ diff --git a/config/neovim/store/lazy-plugins/chadtree/.github/workflows/artifacts.yml b/config/neovim/store/lazy-plugins/chadtree/.github/workflows/artifacts.yml deleted file mode 100644 index 97a657fe..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/.github/workflows/artifacts.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: Artifacts - -on: - push: - branches: - - chad - schedule: - - cron: "0 0 * * *" # daily - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Python - uses: actions/setup-python@v3 - - - env: - CI_TOKEN: ${{ secrets.CI_TOKEN }} - run: |- - make build diff --git a/config/neovim/store/lazy-plugins/chadtree/.github/workflows/ci.yml b/config/neovim/store/lazy-plugins/chadtree/.github/workflows/ci.yml deleted file mode 100644 index 8051a9b2..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/.github/workflows/ci.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -name: CI - -on: - push: - schedule: - - cron: "0 0 * * *" # daily - -jobs: - mypy: - strategy: - matrix: - python_ver: - - "3.8" - - "3.9" - - "3.10" - - "3.11" - - "3.12" - - "3" - - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Python - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python_ver }} - - - run: |- - make lint diff --git a/config/neovim/store/lazy-plugins/chadtree/.github/workflows/codeql-analysis.yml b/config/neovim/store/lazy-plugins/chadtree/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 85042a63..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,57 +0,0 @@ ---- -name: "CodeQL" - -on: - push: - schedule: - - cron: "0 0 * * *" # daily - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'python' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/config/neovim/store/lazy-plugins/chadtree/.gitignore b/config/neovim/store/lazy-plugins/chadtree/.gitignore deleted file mode 100644 index 706a2a11..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -/.git/ -/.venv/ -__pycache__/ -.mypy_cache/ -/.vars/ -/temp/ -/.vscode/ diff --git a/config/neovim/store/lazy-plugins/chadtree/.hadolint.yaml b/config/neovim/store/lazy-plugins/chadtree/.hadolint.yaml deleted file mode 100644 index eb3743d0..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/.hadolint.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -ignored: - # Allow Latest Dockerfile - - DL3007 - # Allow Unpinned Apt Packages - - DL3008 diff --git a/config/neovim/store/lazy-plugins/chadtree/Dockerfile b/config/neovim/store/lazy-plugins/chadtree/Dockerfile deleted file mode 100644 index 5489d0d7..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM ubuntu:focal - -ENV TERM=xterm-256color -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends -- python3-venv neovim git ca-certificates && \ - rm -rf -- /var/lib/apt/lists/* - - -COPY ./docker / -WORKDIR /root/.config/nvim/pack/modules/start/chadtree -COPY . . - -RUN python3 -m chadtree deps --xdg ~/.local/share/nvim diff --git a/config/neovim/store/lazy-plugins/chadtree/Makefile b/config/neovim/store/lazy-plugins/chadtree/Makefile deleted file mode 100644 index be5d2b6d..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -MAKEFLAGS += --check-symlink-times -MAKEFLAGS += --jobs -MAKEFLAGS += --no-builtin-rules -MAKEFLAGS += --no-builtin-variables -MAKEFLAGS += --shuffle -MAKEFLAGS += --warn-undefined-variables -SHELL := bash -.DELETE_ON_ERROR: -.ONESHELL: -.SHELLFLAGS := --norc --noprofile -Eeuo pipefail -O dotglob -O nullglob -O extglob -O failglob -O globstar -c - -.DEFAULT_GOAL := help - -.PHONY: clean clobber build lint fmt - -clean: - rm -v -rf -- .mypy_cache/ .venv/ - -clobber: clean - rm -v -rf -- .vars/ - -.venv/bin/python3: - python3 -m venv -- .venv - -define PYDEPS -from itertools import chain -from os import execl -from sys import executable - -from tomli import load - -toml = load(open("pyproject.toml", "rb")) - -project = toml["project"] -execl( - executable, - executable, - "-m", - "pip", - "install", - "--upgrade", - "--", - *project.get("dependencies", ()), - *chain.from_iterable(project["optional-dependencies"].values()), -) -endef - -.venv/bin/mypy: .venv/bin/python3 - '$<' -m pip install --requirement requirements.txt -- tomli - '$<' <<< '$(PYDEPS)' - -lint: .venv/bin/mypy - '$<' -- . - -build: .venv/bin/mypy - .venv/bin/python3 -- ci/prepare.py - -fmt: .venv/bin/mypy - .venv/bin/isort --profile=black --gitignore -- . - .venv/bin/black -- . diff --git a/config/neovim/store/lazy-plugins/chadtree/README.md b/config/neovim/store/lazy-plugins/chadtree/README.md deleted file mode 100644 index 54338f09..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/README.md +++ /dev/null @@ -1,157 +0,0 @@ -# [CHADTree](https://ms-jpq.github.io/chadtree) - -File Manager for Neovim, Better than NERDTree. - -## Features Illustrated - -**See full list of screen captures [here](https://github.com/ms-jpq/chadtree/tree/chad/docs/FEATURES.md)** - -### I like speed - -- **Parallel** Filesystem Scan - -- **[React Like](https://reactjs.org/docs/reconciliation.html)** Reconciling Difference Minimizing Rendering engine - -- **Never** blocks - -_You can read more about my [performance optimization](https://github.com/ms-jpq/chadtree/tree/chad/docs/ARCHITECTURE.md) here._ - -### I like power - -- Visual mode selections - -- Create, Copy, Paste, Delete, Rename, gotta do them all - -- Quickfix integration - -- [Bookmarks](https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/bookmarks.png) - -![visual_select.gif](https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/visual_select.gif) - -### I like 21st century - -- Filtering by glob - -- Follow mode - -- Session support (save open folders to disk, pick up where you left off) - -- Trash support (requires [`trash`](https://formulae.brew.sh/formula/trash) or [`trash-cli`](https://github.com/andreafrancia/trash-cli)) - -- `ls -l` statistics - -- Correct! handling of symlinks - -![filtering.gif](https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/filtering.gif) - -### I like version control - -- Asynchronous parse git status (untracked, modified, staged) - -- Full support for git submodules - -![git.gif](https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/git_showcase.gif) - -### I like colours - -- Full `$LS_COLOR` support! (shows same colours as unix `ls` & `tree` commands) - -- [Github coloured](https://github.com/github/linguist) icons (over 600 colours!) - -- Three different sets of icons out of the box - -- Four built-in themes - nord, solarized, trapdoor, vim-syntax - -![ls_colours.png](https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/ls_colours.png) - -![github_colours.png](https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/github_colours.png) - -### I like refinement - -- Maintain cursor position on relevant files even when during movements. - -- Maintain selection when copying, moving files - -- Mimetype warning (so you don't accidentally open an image) - -- Validating config parser **(notice, I added an extra `"dog"` param)** - -![mime warn.png](https://github.com/ms-jpq/chadtree/raw/chad/docs/img/mimetype.png) - -![schema error.png](https://github.com/ms-jpq/chadtree/raw/chad/docs/img/schema_error.png) - -### I like documentation - -- Built-in help command in a floating window! - -- Over 1000 lines of meticulous docs covering every option / function! - -**Use `:CHADhelp` to view [documentation](https://github.com/ms-jpq/chadtree/tree/chad/docs)** - -**Use `:CHADhelp --web` to open documentation in your browser!** (If you have one installed) - -## Install - -**Minimum version**: `python`: 3.8.2, `nvim`: `0.4.3`, make sure to have `virtualenv` installed (e.g.: `sudo apt install --yes -- python3-venv`) - -Install the usual way, ie. [VimPlug](https://github.com/junegunn/vim-plug), [Vundle](https://github.com/VundleVim/Vundle.vim), etc - -```vim -Plug 'ms-jpq/chadtree', {'branch': 'chad', 'do': 'python3 -m chadtree deps'} -``` - -You will have to run `:CHADdeps` when installing / updating. This will install CHADTree's dependencies locally inside `chadtree/.vars/runtime`. - -doing `rm -rf chadtree/` will cleanly remove everything CHADTree uses on your computer. - -## Usage - -To toggle CHADTree run command `:CHADopen`. Set it to a hotkey for convenience. - -```vimL -nnoremap v CHADopen -``` - -To see a list of hot keys: - -Either use `:CHADhelp keybind` or open in browser using [`:CHADhelp keybind --web`](https://github.com/ms-jpq/chadtree/tree/chad/docs/KEYBIND.md) - -### FAQ - -Q: Sometimes Windows will get stuck with CHADTree decorations when I do not want them to be, how do I resolve this? - -A: Run `:CHADrestore` - -### Recommendations - -Add a hotkey to clear quickfix list: - -```vimL -nnoremap l call setqflist([]) -``` - -## If you like this... - -Also check out - -- [`sad`](https://github.com/ms-jpq/sad), its a modern `sed` that does previews with syntax highlighting, and lets you pick and choose which chunks to edit. - -- [`coq.nvim`](https://github.com/ms-jpq/coq_nvim), it's a FAST AS FUCK completion client with shit tons of features. - -- [isomorphic-copy](https://github.com/ms-jpq/isomorphic-copy), it's a cross platform clipboard that is daemonless, and does not require third party support. - -## Special Thanks - -CHADTree does not define it's own colours beyond some minimal defaults, all themes are imported from other open source projects. - -> The base icons are imported from the [vim-devicon](https://github.com/ryanoasis/vim-devicons) - -> All emoji icons are imported from the [vim-emoji-icon-theme](https://github.com/adelarsq/vim-emoji-icon-theme) - -> Some themes are imported from [dircolors-solarized](https://github.com/seebi/dircolors-solarized) - -> Some themes are imported from [nord-dircolors](https://github.com/arcticicestudio/nord-dircolors) - -> Some themes are imported from [LS_COLORS](https://github.com/trapd00r/LS_COLORS) - -> Some themes are imported from [vim-nerdtree-syntax-highlight](https://github.com/tiagofumo/vim-nerdtree-syntax-highlight) diff --git a/config/neovim/store/lazy-plugins/chadtree/_config.yml b/config/neovim/store/lazy-plugins/chadtree/_config.yml deleted file mode 100644 index 6a42506f..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/_config.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: CHADTree - -showcase: True - -images: - - https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/visual_select.gif diff --git a/config/neovim/store/lazy-plugins/chadtree/artifacts/README.md b/config/neovim/store/lazy-plugins/chadtree/artifacts/README.md deleted file mode 100644 index 56e33c08..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/artifacts/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# DO NOT EDIT - -These are code generated jsons. diff --git a/config/neovim/store/lazy-plugins/chadtree/artifacts/artifact.json b/config/neovim/store/lazy-plugins/chadtree/artifacts/artifact.json deleted file mode 100644 index 8cf4d557..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/artifacts/artifact.json +++ /dev/null @@ -1,2310 +0,0 @@ -{ - "icon_colours": { - "github": { - ".1": "#ecdebe", - ".1in": "#ecdebe", - ".1m": "#ecdebe", - ".1x": "#ecdebe", - ".2": "#ecdebe", - ".2da": "#38761D", - ".3": "#ecdebe", - ".3in": "#ecdebe", - ".3m": "#ecdebe", - ".3p": "#ecdebe", - ".3pm": "#ecdebe", - ".3qt": "#ecdebe", - ".3x": "#ecdebe", - ".4": "#ecdebe", - ".4DForm": "#292929", - ".4DProject": "#292929", - ".4dm": "#004289", - ".4gl": "#63408e", - ".4th": "#341708", - ".5": "#ecdebe", - ".6": "#ecdebe", - ".6pl": "#0000fb", - ".6pm": "#0000fb", - ".7": "#ecdebe", - ".8": "#ecdebe", - ".8xk": "#A0AA87", - ".8xk.txt": "#A0AA87", - ".8xp": "#A0AA87", - ".8xp.txt": "#A0AA87", - ".9": "#ecdebe", - ".Dsr": "#2c6353", - ".JSON-tmLanguage": "#292929", - ".OutJob": "#A89663", - ".PcbDoc": "#A89663", - ".PrjPCB": "#A89663", - ".SchDoc": "#A89663", - "._coffee": "#244776", - "._js": "#f1e05a", - "._ls": "#499886", - ".a51": "#6E4C13", - ".abap": "#E8274B", - ".ada": "#02f88c", - ".adb": "#02f88c", - ".adml": "#0060ac", - ".admx": "#0060ac", - ".ado": "#1a5f91", - ".adoc": "#73a0c5", - ".adp": "#e4cc98", - ".ads": "#02f88c", - ".afm": "#fa0f00", - ".agc": "#0B3D91", - ".agda": "#315665", - ".ahk": "#6594b9", - ".ahkl": "#6594b9", - ".aidl": "#34EB6B", - ".aj": "#a957b0", - ".al": "#0298c3", - ".als": "#64C800", - ".ampl": "#E6EFBB", - ".angelscript": "#C7D7DC", - ".anim": "#222c37", - ".ant": "#0060ac", - ".antlers.html": "#ff269e", - ".antlers.php": "#ff269e", - ".antlers.xml": "#ff269e", - ".apacheconf": "#d12127", - ".apib": "#2ACCA8", - ".apl": "#5A8164", - ".app": "#B83998", - ".app.src": "#B83998", - ".applescript": "#101F1F", - ".arc": "#aa2afe", - ".arr": "#ee1e10", - ".as": "#C7D7DC", - ".asax": "#9400ff", - ".asc": "#73a0c5", - ".asciidoc": "#73a0c5", - ".ascx": "#9400ff", - ".asd": "#3fb68b", - ".asddls": "#555e25", - ".ash": "#B9D9FF", - ".ashx": "#9400ff", - ".asm": "#005daa", - ".asmx": "#9400ff", - ".asp": "#6a40fd", - ".aspx": "#9400ff", - ".asset": "#222c37", - ".astro": "#ff5a03", - ".asy": "#ff0000", - ".au3": "#1C3552", - ".aug": "#9CC134", - ".auk": "#c30e9b", - ".aux": "#3D6117", - ".avdl": "#0040FF", - ".avsc": "#292929", - ".aw": "#4F5D95", - ".awk": "#c30e9b", - ".axaml": "#0060ac", - ".axd": "#9400ff", - ".axi": "#0aa0ff", - ".axi.erb": "#747faa", - ".axml": "#0060ac", - ".axs": "#0aa0ff", - ".axs.erb": "#747faa", - ".b": "#2F2530", - ".bal": "#FF5000", - ".bas": "#2c6353", - ".bash": "#89e051", - ".bat": "#C1F12E", - ".bats": "#89e051", - ".bb": "#db5855", - ".bbx": "#3D6117", - ".bdy": "#dad8d8", - ".be": "#15A13C", - ".bf": "#2F2530", - ".bi": "#141AC9", - ".bib": "#778899", - ".bibtex": "#778899", - ".bicep": "#519aba", - ".bison": "#6A463F", - ".blade": "#f7523f", - ".blade.php": "#f7523f", - ".bmx": "#cd6400", - ".bones": "#f1e05a", - ".boo": "#d4bec1", - ".boot": "#db5855", - ".bpl": "#c80fa0", - ".brd": "#2f4aab", - ".brs": "#662D91", - ".bs": "#66AABB", - ".bsl": "#814CCC", - ".bsv": "#12223c", - ".builder": "#701516", - ".builds": "#0060ac", - ".bzl": "#76d275", - ".c": "#555555", - ".c++": "#f34b7d", - ".cabal": "#483465", - ".cairo": "#ff4a48", - ".cake": "#244776", - ".capnp": "#c42727", - ".cats": "#555555", - ".cbx": "#3D6117", - ".cc": "#f34b7d", - ".ccproj": "#0060ac", - ".ccxml": "#0060ac", - ".cdc": "#00ef8b", - ".cdf": "#dd1100", - ".cds": "#0092d1", - ".ceylon": "#dfa535", - ".cfc": "#ed2cd6", - ".cfg": "#d1dbe0", - ".cfm": "#ed2cd6", - ".cfml": "#ed2cd6", - ".cgi": "#89e051", - ".cginc": "#aace60", - ".ch": "#403a40", - ".chpl": "#8dc63f", - ".circom": "#707575", - ".cirru": "#ccccff", - ".cjs": "#f1e05a", - ".cjsx": "#244776", - ".ck": "#3f8000", - ".cl": "#ed2e2d", - ".cl2": "#db5855", - ".clar": "#5546ff", - ".click": "#E4E6F3", - ".clixml": "#0060ac", - ".clj": "#db5855", - ".cljc": "#db5855", - ".cljs": "#db5855", - ".cljs.hl": "#db5855", - ".cljscm": "#db5855", - ".cljx": "#db5855", - ".clp": "#00A300", - ".cls": "#2c6353", - ".clw": "#db901e", - ".cmake": "#DA3434", - ".cmake.in": "#DA3434", - ".cmd": "#C1F12E", - ".cmp": "#d20b00", - ".cnc": "#D08CF2", - ".cnf": "#d1dbe0", - ".cocci": "#c94949", - ".code-snippets": "#292929", - ".code-workspace": "#292929", - ".coffee": "#244776", - ".coffee.md": "#244776", - ".command": "#89e051", - ".coq": "#d0b68c", - ".cp": "#B0CE4E", - ".cpp": "#f34b7d", - ".cppm": "#f34b7d", - ".cproject": "#0060ac", - ".cps": "#B0CE4E", - ".cql": "#e38c00", - ".cr": "#000100", - ".cs": "#596706", - ".csc": "#FF6800", - ".cscfg": "#0060ac", - ".csd": "#1a1a1a", - ".csdef": "#0060ac", - ".cshtml": "#512be4", - ".csl": "#0060ac", - ".cson": "#244776", - ".csproj": "#0060ac", - ".css": "#563d7c", - ".csv": "#237346", - ".csx": "#178600", - ".ct": "#0060ac", - ".ctl": "#2c6353", - ".ctp": "#4F5D95", - ".cts": "#3178c6", - ".cu": "#3A4E3A", - ".cue": "#5886E1", - ".cuh": "#3A4E3A", - ".curry": "#531242", - ".cwl": "#B5314C", - ".cxx": "#f34b7d", - ".cyp": "#34c0eb", - ".cypher": "#34c0eb", - ".d": "#427819", - ".d2": "#526ee8", - ".dae": "#F1A42B", - ".darcspatch": "#8eff23", - ".dart": "#00B4AB", - ".dats": "#1ac620", - ".db2": "#e38c00", - ".dcl": "#3F85AF", - ".ddl": "#e38c00", - ".decls": "#00FFAE", - ".depproj": "#0060ac", - ".dfm": "#E3F171", - ".dfy": "#FFEC25", - ".dhall": "#dfafff", - ".di": "#ba595e", - ".dita": "#0060ac", - ".ditamap": "#0060ac", - ".ditaval": "#0060ac", - ".djs": "#cca760", - ".dll.config": "#0060ac", - ".dlm": "#a3522f", - ".dm": "#447265", - ".do": "#1a5f91", - ".dockerfile": "#384d54", - ".dof": "#d1dbe0", - ".doh": "#1a5f91", - ".dot": "#2596be", - ".dotsettings": "#0060ac", - ".dpatch": "#8eff23", - ".dpr": "#E3F171", - ".druby": "#c7a938", - ".dsc": "#FBEE96", - ".dsp": "#c37240", - ".dtx": "#3D6117", - ".duby": "#c7a938", - ".dwl": "#003a52", - ".dyalog": "#5A8164", - ".dyl": "#6c616e", - ".dylan": "#6c616e", - ".e": "#FF790B", - ".eb": "#069406", - ".ebuild": "#9400ff", - ".ec": "#913960", - ".ecl": "#001d9d", - ".eclass": "#9400ff", - ".eclxml": "#8a1267", - ".ecr": "#2e1052", - ".ect": "#a91e50", - ".edgeql": "#31A7FF", - ".editorconfig": "#fff1f2", - ".eex": "#6e4a7e", - ".eh": "#913960", - ".ejs": "#a91e50", - ".ejs.t": "#a91e50", - ".el": "#c065db", - ".eliom": "#ef7a08", - ".eliomi": "#ef7a08", - ".elm": "#60B5CC", - ".elv": "#55BB55", - ".em": "#FFF4F3", - ".emacs": "#c065db", - ".emacs.desktop": "#c065db", - ".emberscript": "#FFF4F3", - ".env": "#e5d559", - ".epj": "#913960", - ".eps": "#da291c", - ".epsi": "#da291c", - ".eq": "#a78649", - ".erb": "#701516", - ".erb.deface": "#701516", - ".erl": "#B83998", - ".es": "#f1e05a", - ".es6": "#f1e05a", - ".escript": "#B83998", - ".esdl": "#31A7FF", - ".ex": "#FF790B", - ".exs": "#6e4a7e", - ".eye": "#701516", - ".f": "#4d41b1", - ".f03": "#4d41b1", - ".f08": "#4d41b1", - ".f77": "#4d41b1", - ".f90": "#4d41b1", - ".f95": "#4d41b1", - ".factor": "#636746", - ".fan": "#14253c", - ".fancypack": "#7b9db4", - ".fcgi": "#89e051", - ".feature": "#5B2063", - ".filters": "#0060ac", - ".fish": "#4aae47", - ".flex": "#DBCA00", - ".flf": "#FFDDBB", - ".flux": "#88ccff", - ".fnc": "#dad8d8", - ".fnl": "#fff3d7", - ".for": "#4d41b1", - ".forth": "#341708", - ".fp": "#5686a5", - ".fpp": "#4d41b1", - ".fr": "#00cafe", - ".frag": "#f1e05a", - ".frg": "#5686a5", - ".frm": "#2c6353", - ".frt": "#341708", - ".fs": "#5686a5", - ".fsh": "#5686a5", - ".fshader": "#5686a5", - ".fsi": "#b845fc", - ".fsproj": "#0060ac", - ".fst": "#572e30", - ".fsti": "#572e30", - ".fsx": "#b845fc", - ".fth": "#341708", - ".ftl": "#0050b2", - ".fun": "#dc566d", - ".fut": "#5f021f", - ".fx": "#aace60", - ".fxh": "#aace60", - ".fxml": "#0060ac", - ".fy": "#7b9db4", - ".g": "#0000cc", - ".g4": "#9DC3FF", - ".gaml": "#FFC766", - ".gap": "#0000cc", - ".gawk": "#c30e9b", - ".gbl": "#d20b00", - ".gbo": "#d20b00", - ".gbp": "#d20b00", - ".gbr": "#d20b00", - ".gbs": "#d20b00", - ".gco": "#D08CF2", - ".gcode": "#D08CF2", - ".gd": "#355570", - ".gdnlib": "#355570", - ".gdns": "#355570", - ".ged": "#003058", - ".gemspec": "#701516", - ".geo": "#5686a5", - ".geojson": "#292929", - ".geom": "#5686a5", - ".gf": "#ff0000", - ".gi": "#0000cc", - ".gitconfig": "#F44D27", - ".gitignore": "#000000", - ".gjs": "#F5835F", - ".gko": "#d20b00", - ".glade": "#0060ac", - ".gleam": "#ffaff3", - ".glf": "#c1ac7f", - ".glsl": "#5686a5", - ".glslf": "#5686a5", - ".glslv": "#5686a5", - ".gltf": "#292929", - ".gmi": "#ff6900", - ".gml": "#0060ac", - ".gms": "#f49a22", - ".gmx": "#0060ac", - ".gnu": "#f0a9f0", - ".gnuplot": "#f0a9f0", - ".go": "#00ADD8", - ".god": "#701516", - ".golo": "#88562A", - ".gp": "#f0a9f0", - ".gpb": "#d20b00", - ".gpt": "#d20b00", - ".gql": "#e10098", - ".grace": "#615f8b", - ".gradle": "#02303a", - ".gradle.kts": "#02303a", - ".graphql": "#e10098", - ".graphqls": "#e10098", - ".groovy": "#4298b8", - ".grt": "#4298b8", - ".grxml": "#0060ac", - ".gs": "#f1e05a", - ".gsc": "#FF6800", - ".gsh": "#FF6800", - ".gshader": "#5686a5", - ".gsp": "#4298b8", - ".gst": "#0060ac", - ".gsx": "#82937f", - ".gtl": "#d20b00", - ".gto": "#d20b00", - ".gtp": "#d20b00", - ".gtpl": "#4298b8", - ".gts": "#d20b00", - ".gv": "#2596be", - ".gvy": "#4298b8", - ".gyp": "#3572A5", - ".gypi": "#3572A5", - ".h": "#438eff", - ".h++": "#f34b7d", - ".hack": "#878787", - ".haml": "#ece2a9", - ".haml.deface": "#ece2a9", - ".handlebars": "#f7931e", - ".har": "#292929", - ".hats": "#1ac620", - ".hb": "#0e60e3", - ".hbs": "#f7931e", - ".hc": "#ffefaf", - ".hcl": "#844FBA", - ".hh": "#878787", - ".hhi": "#878787", - ".hic": "#db5855", - ".hlsl": "#aace60", - ".hlsli": "#aace60", - ".hocon": "#9ff8ee", - ".hoon": "#00b171", - ".hpp": "#f34b7d", - ".hqf": "#3F3F3F", - ".hql": "#dce200", - ".hrl": "#B83998", - ".hs": "#5e5086", - ".hs-boot": "#5e5086", - ".hsc": "#5e5086", - ".hta": "#e34c26", - ".htm": "#e34c26", - ".html": "#e34c26", - ".html.heex": "#6e4a7e", - ".html.hl": "#e34c26", - ".html.leex": "#6e4a7e", - ".http": "#005C9C", - ".hx": "#df7900", - ".hxml": "#f68712", - ".hxsl": "#df7900", - ".hxx": "#f34b7d", - ".hy": "#7790B2", - ".hzp": "#0060ac", - ".i": "#005daa", - ".i3": "#223388", - ".ice": "#003fa2", - ".iced": "#244776", - ".icl": "#3F85AF", - ".idc": "#555555", - ".idr": "#b30000", - ".ig": "#223388", - ".ihlp": "#1a5f91", - ".ijm": "#99AAFF", - ".ijs": "#9EEDFF", - ".ik": "#078193", - ".ily": "#9ccc7c", - ".imba": "#16cec6", - ".iml": "#0060ac", - ".inc": "#f69e1d", - ".ini": "#d1dbe0", - ".inl": "#f34b7d", - ".ino": "#f34b7d", - ".ins": "#3D6117", - ".intr": "#6c616e", - ".io": "#a9188d", - ".iol": "#843179", - ".ipf": "#0000cc", - ".ipp": "#f34b7d", - ".ipynb": "#DA5B0B", - ".isl": "#264b99", - ".iss": "#264b99", - ".iuml": "#fbbd16", - ".ivy": "#0060ac", - ".ixx": "#f34b7d", - ".j": "#ff0c5a", - ".j2": "#a52a22", - ".jade": "#a86454", - ".jake": "#f1e05a", - ".janet": "#0886a5", - ".jav": "#b07219", - ".java": "#b07219", - ".javascript": "#f1e05a", - ".jbuilder": "#701516", - ".jcl": "#d90e09", - ".jelly": "#0060ac", - ".jflex": "#DBCA00", - ".jinja": "#a52a22", - ".jinja2": "#a52a22", - ".jison": "#56b3cb", - ".jisonlex": "#56b3cb", - ".jl": "#a270ba", - ".jq": "#c7254e", - ".js": "#f1e05a", - ".js.erb": "#f1e05a", - ".jsb": "#f1e05a", - ".jscad": "#f1e05a", - ".jsfl": "#f1e05a", - ".jsh": "#b07219", - ".jslib": "#f1e05a", - ".jsm": "#f1e05a", - ".json": "#85ea2d", - ".json5": "#267CB9", - ".jsonc": "#292929", - ".jsonl": "#292929", - ".jsonld": "#0c479c", - ".jsonnet": "#0064bd", - ".jsp": "#2A6277", - ".jspre": "#f1e05a", - ".jsproj": "#0060ac", - ".jss": "#f1e05a", - ".jst": "#a91e50", - ".jsx": "#f1e05a", - ".kak": "#6f8042", - ".kicad_mod": "#2f4aab", - ".kicad_pcb": "#2f4aab", - ".kicad_sch": "#2f4aab", - ".kicad_wks": "#2f4aab", - ".kid": "#951531", - ".kml": "#0060ac", - ".kojo": "#c22d40", - ".krl": "#28430A", - ".ks": "#41adf0", - ".ksh": "#89e051", - ".ksy": "#773b37", - ".kt": "#A97BFF", - ".ktm": "#A97BFF", - ".kts": "#A97BFF", - ".kv": "#1da6e0", - ".l": "#ecdebe", - ".lagda": "#315665", - ".lark": "#2980B9", - ".las": "#999999", - ".lasso": "#999999", - ".lasso8": "#999999", - ".lasso9": "#999999", - ".latte": "#f2a542", - ".launch": "#0060ac", - ".lbx": "#3D6117", - ".lektorproject": "#d1dbe0", - ".less": "#1d365d", - ".lex": "#DBCA00", - ".lfe": "#4C3023", - ".lgt": "#295b9a", - ".lhs": "#5e5086", - ".libsonnet": "#0064bd", - ".lid": "#6c616e", - ".lidr": "#b30000", - ".ligo": "#0e74ff", - ".linq": "#178600", - ".liquid": "#67b8de", - ".lisp": "#87AED7", - ".litcoffee": "#244776", - ".livemd": "#083fa1", - ".lkml": "#652B81", - ".ll": "#185619", - ".lmi": "#3572A5", - ".logtalk": "#295b9a", - ".lol": "#cc9900", - ".lookml": "#652B81", - ".lpr": "#E3F171", - ".ls": "#499886", - ".lsl": "#3d9970", - ".lslp": "#3d9970", - ".lsp": "#87AED7", - ".ltx": "#3D6117", - ".lua": "#000080", - ".lvclass": "#fede06", - ".lvlib": "#fede06", - ".lvproj": "#fede06", - ".ly": "#9ccc7c", - ".m": "#438eff", - ".m2": "#d8ffff", - ".m3": "#223388", - ".ma": "#dd1100", - ".mak": "#427819", - ".make": "#427819", - ".makefile": "#427819", - ".mako": "#7e858d", - ".man": "#ecdebe", - ".mao": "#7e858d", - ".markdown": "#083fa1", - ".marko": "#42bff2", - ".mask": "#222c37", - ".mat": "#222c37", - ".mata": "#1a5f91", - ".matah": "#1a5f91", - ".mathematica": "#dd1100", - ".matlab": "#e16737", - ".mawk": "#c30e9b", - ".maxhelp": "#c4a79c", - ".maxpat": "#c4a79c", - ".maxproj": "#c4a79c", - ".mc": "#8D6747", - ".mcfunction": "#E22837", - ".mcmeta": "#292929", - ".mcr": "#00a6a6", - ".md": "#083fa1", - ".mdoc": "#ecdebe", - ".mdown": "#083fa1", - ".mdpolicy": "#0060ac", - ".mdwn": "#083fa1", - ".mdx": "#fcb32c", - ".me": "#ecdebe", - ".mediawiki": "#fc5757", - ".mermaid": "#ff3670", - ".meta": "#222c37", - ".metal": "#8f14e9", - ".mg": "#223388", - ".mint": "#02b046", - ".mir": "#cb171e", - ".mirah": "#c7a938", - ".mjml": "#0060ac", - ".mjs": "#f1e05a", - ".mk": "#427819", - ".mkd": "#083fa1", - ".mkdn": "#083fa1", - ".mkdown": "#083fa1", - ".mkfile": "#427819", - ".mkii": "#3D6117", - ".mkiv": "#3D6117", - ".mkvi": "#3D6117", - ".ml": "#dc566d", - ".ml4": "#ef7a08", - ".mli": "#ef7a08", - ".mligo": "#3be133", - ".mlir": "#5EC8DB", - ".mll": "#ef7a08", - ".mly": "#ef7a08", - ".mm": "#0060ac", - ".mmd": "#ff3670", - ".mo": "#fbb03b", - ".mod": "#0060ac", - ".moo": "#ff2b2b", - ".moon": "#ff4585", - ".move": "#4a137a", - ".mpl": "#21D789", - ".mps": "#21D789", - ".mq4": "#62A8D6", - ".mq5": "#4A76B8", - ".mqh": "#4A76B8", - ".mrc": "#3d57c3", - ".ms": "#ecdebe", - ".msd": "#21D789", - ".mspec": "#701516", - ".mt": "#dd1100", - ".mtml": "#b7e1f4", - ".mts": "#3178c6", - ".mu": "#244963", - ".mud": "#dc75e5", - ".mustache": "#724b3b", - ".mxml": "#0060ac", - ".mxt": "#c4a79c", - ".mysql": "#e38c00", - ".n": "#ecdebe", - ".nanorc": "#2d004d", - ".nas": "#1d2c4e", - ".nasm": "#6E4C13", - ".natvis": "#0060ac", - ".nawk": "#c30e9b", - ".nb": "#dd1100", - ".nbp": "#dd1100", - ".nc": "#94B0C7", - ".ncl": "#0060ac", - ".ndproj": "#0060ac", - ".ne": "#990000", - ".nearley": "#990000", - ".nf": "#3ac486", - ".nginx": "#009639", - ".nginxconf": "#009639", - ".nim": "#ffc200", - ".nim.cfg": "#ffc200", - ".nimble": "#ffc200", - ".nimrod": "#ffc200", - ".nims": "#ffc200", - ".nit": "#009917", - ".nix": "#7e7eff", - ".njk": "#3d8137", - ".njs": "#f1e05a", - ".nl": "#87AED7", - ".nlogo": "#ff6375", - ".nomad": "#844FBA", - ".nproj": "#0060ac", - ".nqp": "#0000fb", - ".nr": "#ecdebe", - ".nse": "#000080", - ".nss": "#111522", - ".nu": "#4E9906", - ".numpy": "#9C8AF9", - ".numpyw": "#9C8AF9", - ".numsc": "#9C8AF9", - ".nuspec": "#0060ac", - ".nut": "#800000", - ".ny": "#3fb68b", - ".odd": "#0060ac", - ".odin": "#60AFFE", - ".ol": "#843179", - ".omgrofl": "#cabbff", - ".ooc": "#b0b77e", - ".opal": "#f7ede0", - ".opencl": "#ed2e2d", - ".orc": "#1a1a1a", - ".org": "#77aa99", - ".os": "#814CCC", - ".osm": "#0060ac", - ".owl": "#5b70bd", - ".oxygene": "#cdd0e3", - ".oz": "#fab738", - ".p": "#5ce600", - ".p4": "#7055b5", - ".p6": "#0000fb", - ".p6l": "#0000fb", - ".p6m": "#0000fb", - ".p8": "#000080", - ".pac": "#f1e05a", - ".pact": "#F7A8B8", - ".pan": "#cc0000", - ".parrot": "#f3ca0a", - ".pas": "#E3F171", - ".pascal": "#E3F171", - ".pat": "#c4a79c", - ".pb": "#5a6986", - ".pbi": "#5a6986", - ".pbt": "#8f0f8d", - ".pck": "#dad8d8", - ".pcss": "#dc3a0c", - ".pd_lua": "#000080", - ".pddl": "#0d00ff", - ".pde": "#0096D8", - ".pegjs": "#234d6b", - ".pep": "#C76F5B", - ".per": "#d8df39", - ".perl": "#0298c3", - ".pfa": "#da291c", - ".pgsql": "#336790", - ".ph": "#0298c3", - ".php": "#4F5D95", - ".php3": "#4F5D95", - ".php4": "#4F5D95", - ".php5": "#4F5D95", - ".phps": "#4F5D95", - ".phpt": "#4F5D95", - ".phtml": "#4f5d95", - ".pig": "#fcd7de", - ".pike": "#005390", - ".pkb": "#dad8d8", - ".pkgproj": "#0060ac", - ".pks": "#dad8d8", - ".pl": "#0000fb", - ".pl6": "#0000fb", - ".plantuml": "#fbbd16", - ".plb": "#dad8d8", - ".plist": "#0060ac", - ".plot": "#f0a9f0", - ".pls": "#dad8d8", - ".plsql": "#dad8d8", - ".plt": "#74283c", - ".pluginspec": "#0060ac", - ".plx": "#0298c3", - ".pm": "#0000fb", - ".pm6": "#0000fb", - ".pml": "#de0000", - ".pmod": "#005390", - ".podsl": "#3fb68b", - ".podspec": "#701516", - ".pogo": "#d80074", - ".polar": "#ae81ff", - ".por": "#f8bd00", - ".postcss": "#dc3a0c", - ".pov": "#6bac65", - ".pp": "#302B6D", - ".pprx": "#d90e09", - ".praat": "#c8506d", - ".prawn": "#701516", - ".prc": "#e38c00", - ".prefab": "#222c37", - ".prefs": "#d1dbe0", - ".prg": "#403a40", - ".prisma": "#0c344b", - ".pro": "#74283c", - ".proj": "#0060ac", - ".prolog": "#74283c", - ".properties": "#2A6277", - ".props": "#0060ac", - ".prw": "#403a40", - ".ps": "#da291c", - ".ps1": "#012456", - ".ps1xml": "#0060ac", - ".psc": "#6600cc", - ".psc1": "#0060ac", - ".psd1": "#012456", - ".psgi": "#0298c3", - ".psm1": "#012456", - ".pt": "#0060ac", - ".pug": "#a86454", - ".puml": "#fbbd16", - ".purs": "#1D222D", - ".pwn": "#dbb284", - ".pxd": "#fedf5b", - ".pxi": "#fedf5b", - ".py": "#3572A5", - ".py3": "#3572A5", - ".pyde": "#3572A5", - ".pyi": "#3572A5", - ".pyp": "#3572A5", - ".pyt": "#3572A5", - ".pytb": "#3572A5", - ".pyw": "#3572A5", - ".pyx": "#fedf5b", - ".q": "#0040cd", - ".qasm": "#AA70FF", - ".qbs": "#44a51c", - ".qhelp": "#0060ac", - ".ql": "#140f46", - ".qll": "#140f46", - ".qmd": "#198ce7", - ".qml": "#44a51c", - ".qs": "#00b841", - ".r": "#FFDAB3", - ".r2": "#358a5b", - ".r3": "#358a5b", - ".rabl": "#701516", - ".rake": "#701516", - ".raku": "#0000fb", - ".rakumod": "#0000fb", - ".raml": "#77d9fb", - ".razor": "#512be4", - ".rb": "#701516", - ".rbi": "#701516", - ".rbs": "#701516", - ".rbuild": "#701516", - ".rbw": "#701516", - ".rbx": "#701516", - ".rbxs": "#000080", - ".rchit": "#5686a5", - ".rd": "#198CE7", - ".rdf": "#0060ac", - ".rdoc": "#701516", - ".re": "#ff5847", - ".reb": "#358a5b", - ".rebol": "#358a5b", - ".red": "#f50000", - ".reds": "#f50000", - ".reek": "#cb171e", - ".reg": "#52d5ff", - ".regex": "#009a00", - ".regexp": "#009a00", - ".rego": "#7d9199", - ".rei": "#ff5847", - ".religo": "#ff5847", - ".res": "#0060ac", - ".rest": "#141414", - ".rest.txt": "#141414", - ".resx": "#0060ac", - ".rex": "#d90e09", - ".rexx": "#d90e09", - ".rg": "#cc0088", - ".rhtml": "#701516", - ".ring": "#2D54CB", - ".riot": "#A71E49", - ".rkt": "#3c5caa", - ".rktd": "#3c5caa", - ".rktl": "#3c5caa", - ".rl": "#9d5200", - ".rmd": "#198ce7", - ".rmiss": "#5686a5", - ".rnh": "#665a4e", - ".rno": "#ecdebe", - ".rnw": "#198ce7", - ".robot": "#00c0b5", - ".rockspec": "#000080", - ".roff": "#ecdebe", - ".ronn": "#083fa1", - ".rpgle": "#2BDE21", - ".rpy": "#ff7f7f", - ".rq": "#0C4597", - ".rs": "#0060ac", - ".rs.in": "#dea584", - ".rsc": "#DE3941", - ".rss": "#0060ac", - ".rst": "#141414", - ".rst.txt": "#141414", - ".rsx": "#198CE7", - ".ru": "#701516", - ".ruby": "#701516", - ".rviz": "#cb171e", - ".s": "#005daa", - ".sas": "#B34936", - ".sass": "#a53b70", - ".sats": "#1ac620", - ".sbt": "#c22d40", - ".sc": "#46390b", - ".scad": "#e5cd45", - ".scala": "#c22d40", - ".scaml": "#bd181a", - ".scd": "#46390b", - ".sce": "#ca0f21", - ".scenic": "#fdc700", - ".sch": "#0060ac", - ".sci": "#ca0f21", - ".scm": "#1e4aec", - ".sco": "#1a1a1a", - ".scpt": "#101F1F", - ".scrbl": "#3c5caa", - ".scss": "#c6538c", - ".scxml": "#0060ac", - ".sdc": "#e4cc98", - ".sed": "#64b970", - ".self": "#0579aa", - ".sexp": "#3fb68b", - ".sfproj": "#0060ac", - ".sfv": "#C9BFED", - ".sh": "#89e051", - ".sh.in": "#89e051", - ".shader": "#222c37", - ".shen": "#120F14", - ".shproj": "#0060ac", - ".sig": "#dc566d", - ".sj": "#ff0c5a", - ".sjs": "#f1e05a", - ".sl": "#007eff", - ".sld": "#1e4aec", - ".slim": "#2b2b2b", - ".sls": "#1e4aec", - ".sma": "#dbb284", - ".smithy": "#c44536", - ".smk": "#419179", - ".sml": "#dc566d", - ".snakefile": "#419179", - ".snap": "#15c213", - ".snip": "#199f4b", - ".snippet": "#199f4b", - ".snippets": "#199f4b", - ".sol": "#AA6746", - ".soy": "#0d948f", - ".sp": "#f69e1d", - ".sparql": "#0C4597", - ".spc": "#dad8d8", - ".spec": "#701516", - ".spin": "#7fa2a7", - ".sps": "#1e4aec", - ".sqf": "#3F3F3F", - ".sql": "#e38c00", - ".sqlrpgle": "#2BDE21", - ".sra": "#8f0f8d", - ".srdf": "#0060ac", - ".srt": "#9e0101", - ".sru": "#8f0f8d", - ".srw": "#8f0f8d", - ".ss": "#1e4aec", - ".ssjs": "#f1e05a", - ".sss": "#2fcc9f", - ".st": "#3fb34f", - ".stTheme": "#0060ac", - ".stan": "#b2011d", - ".star": "#76d275", - ".sthlp": "#1a5f91", - ".stl": "#373b5e", - ".story": "#5B2063", - ".storyboard": "#0060ac", - ".sty": "#3D6117", - ".styl": "#ff6347", - ".sublime-build": "#292929", - ".sublime-commands": "#292929", - ".sublime-completions": "#292929", - ".sublime-keymap": "#292929", - ".sublime-macro": "#292929", - ".sublime-menu": "#292929", - ".sublime-mousemap": "#292929", - ".sublime-project": "#292929", - ".sublime-settings": "#292929", - ".sublime-snippet": "#0060ac", - ".sublime-syntax": "#cb171e", - ".sublime-theme": "#292929", - ".sublime-workspace": "#292929", - ".sublime_metrics": "#292929", - ".sublime_session": "#292929", - ".sv": "#DAE1C2", - ".svelte": "#ff3e00", - ".svg": "#ff9900", - ".svh": "#DAE1C2", - ".sw": "#0060ac", - ".swift": "#F05138", - ".syntax": "#cb171e", - ".t": "#cf142b", - ".tab": "#e38c00", - ".tac": "#3572A5", - ".tag": "#2A6277", - ".talon": "#333333", - ".targets": "#0060ac", - ".tcc": "#f34b7d", - ".tcl": "#e4cc98", - ".tcl.in": "#e4cc98", - ".tesc": "#5686a5", - ".tese": "#5686a5", - ".tex": "#3D6117", - ".textile": "#ffe7ac", - ".tf": "#844FBA", - ".tfstate": "#292929", - ".tfstate.backup": "#292929", - ".tftpl": "#7b42bb", - ".tfvars": "#844FBA", - ".thor": "#701516", - ".thrift": "#D12127", - ".thy": "#FEFE00", - ".tla": "#4b0079", - ".tlv": "#C40023", - ".tm": "#e4cc98", - ".tmCommand": "#0060ac", - ".tmLanguage": "#0060ac", - ".tmPreferences": "#0060ac", - ".tmSnippet": "#0060ac", - ".tmTheme": "#0060ac", - ".tmac": "#ecdebe", - ".tml": "#0060ac", - ".tmux": "#89e051", - ".toc": "#f7e43f", - ".toit": "#c2c9fb", - ".toml": "#9c4221", - ".tool": "#89e051", - ".topojson": "#292929", - ".tpb": "#dad8d8", - ".tpl": "#f0c040", - ".tpp": "#f34b7d", - ".tps": "#dad8d8", - ".tres": "#355570", - ".trg": "#dad8d8", - ".trigger": "#89e051", - ".ts": "#0060ac", - ".tscn": "#355570", - ".tst": "#ca0f21", - ".tsv": "#237346", - ".tsx": "#0060ac", - ".tu": "#cf142b", - ".twig": "#c1d026", - ".txl": "#0178b8", - ".txt": "#199f4b", - ".txx": "#f34b7d", - ".typ": "#0060ac", - ".uc": "#a54c4d", - ".udf": "#e38c00", - ".udo": "#1a1a1a", - ".ui": "#0060ac", - ".unity": "#222c37", - ".uno": "#9933cc", - ".upc": "#4e3617", - ".ur": "#ccccee", - ".urdf": "#0060ac", - ".url": "#d1dbe0", - ".urs": "#ccccee", - ".ux": "#0060ac", - ".v": "#b2b7f8", - ".vala": "#a56de2", - ".vapi": "#a56de2", - ".vark": "#82937f", - ".vb": "#945db7", - ".vba": "#199f4b", - ".vbhtml": "#945db7", - ".vbproj": "#0060ac", - ".vbs": "#15dcdc", - ".vcl": "#148AA8", - ".vcxproj": "#0060ac", - ".vdf": "#f26025", - ".veo": "#b2b7f8", - ".vert": "#5686a5", - ".vh": "#DAE1C2", - ".vhd": "#adb2cb", - ".vhdl": "#adb2cb", - ".vhf": "#adb2cb", - ".vhi": "#adb2cb", - ".vho": "#adb2cb", - ".vhost": "#009639", - ".vhs": "#adb2cb", - ".vht": "#adb2cb", - ".vhw": "#adb2cb", - ".vim": "#199f4b", - ".vimrc": "#199f4b", - ".viw": "#e38c00", - ".vmb": "#199f4b", - ".volt": "#1F1F1F", - ".vrx": "#5686a5", - ".vs": "#5686a5", - ".vsh": "#5686a5", - ".vshader": "#5686a5", - ".vsixmanifest": "#0060ac", - ".vssettings": "#0060ac", - ".vstemplate": "#0060ac", - ".vtl": "#507cff", - ".vue": "#41b883", - ".vw": "#dad8d8", - ".vxml": "#0060ac", - ".vy": "#2980b9", - ".w": "#5ce600", - ".wast": "#04133b", - ".wat": "#04133b", - ".watchr": "#701516", - ".wdl": "#42f1f4", - ".webapp": "#292929", - ".webmanifest": "#292929", - ".wgsl": "#1a5e9a", - ".whiley": "#d5c397", - ".wiki": "#fc5757", - ".wikitext": "#fc5757", - ".wisp": "#7582D1", - ".wit": "#6250e7", - ".wixproj": "#0060ac", - ".wl": "#dd1100", - ".wlk": "#a23738", - ".wlt": "#dd1100", - ".wlua": "#000080", - ".workbook": "#083fa1", - ".workflow": "#0060ac", - ".wren": "#383838", - ".ws": "#ff0000", - ".wsdl": "#0060ac", - ".wsf": "#0060ac", - ".wsgi": "#3572A5", - ".wxi": "#0060ac", - ".wxl": "#0060ac", - ".wxs": "#0060ac", - ".x": "#aace60", - ".x10": "#4B6BEF", - ".x3d": "#0060ac", - ".x68": "#005daa", - ".xacro": "#0060ac", - ".xaml": "#0060ac", - ".xc": "#99DA07", - ".xdc": "#e4cc98", - ".xht": "#e34c26", - ".xhtml": "#e34c26", - ".xib": "#0060ac", - ".xlf": "#0060ac", - ".xliff": "#0060ac", - ".xmi": "#0060ac", - ".xml": "#0060ac", - ".xml.dist": "#0060ac", - ".xmp": "#0060ac", - ".xojo_code": "#81bd41", - ".xojo_menu": "#81bd41", - ".xojo_report": "#81bd41", - ".xojo_script": "#81bd41", - ".xojo_toolbar": "#81bd41", - ".xojo_window": "#81bd41", - ".xproj": "#0060ac", - ".xpy": "#3572A5", - ".xq": "#5232e7", - ".xql": "#5232e7", - ".xqm": "#5232e7", - ".xquery": "#5232e7", - ".xqy": "#5232e7", - ".xrl": "#B83998", - ".xsd": "#0060ac", - ".xsh": "#285EEF", - ".xsjs": "#f1e05a", - ".xsjslib": "#f1e05a", - ".xsl": "#EB8CEB", - ".xslt": "#EB8CEB", - ".xspec": "#0060ac", - ".xtend": "#24255d", - ".xul": "#0060ac", - ".xzap": "#0d665e", - ".y": "#4B6C4B", - ".yacc": "#4B6C4B", - ".yaml": "#cb171e", - ".yaml-tmlanguage": "#cb171e", - ".yaml.sed": "#cb171e", - ".yap": "#74283c", - ".yar": "#220000", - ".yara": "#220000", - ".yasnippet": "#32AB90", - ".yml": "#cb171e", - ".yml.mysql": "#cb171e", - ".yrl": "#B83998", - ".yul": "#794932", - ".yy": "#4B6C4B", - ".yyp": "#292929", - ".zap": "#0d665e", - ".zcml": "#0060ac", - ".zep": "#118f9e", - ".zig": "#ec915c", - ".zil": "#dc75e5", - ".zimpl": "#d67711", - ".zmpl": "#d67711", - ".zpl": "#d67711", - ".zs": "#00BCD1", - ".zsh": "#89e051", - ".zsh-theme": "#89e051" - } - }, - "icons": { - "ascii": { - "default_icon": "●", - "ext_exact": {}, - "folder": { - "closed": "▶", - "open": "▼" - }, - "link": { - "broken": "-/->", - "normal": "->" - }, - "name_exact": {}, - "name_glob": {}, - "status": { - "active": ">", - "inactive": " ", - "not_selected": " ", - "selected": "*" - } - }, - "ascii_hollow": { - "default_icon": "○", - "ext_exact": {}, - "folder": { - "closed": "▷", - "open": "▽" - }, - "link": { - "broken": "-/->", - "normal": "->" - }, - "name_exact": {}, - "name_glob": {}, - "status": { - "active": ">", - "inactive": " ", - "not_selected": " ", - "selected": "*" - } - }, - "devicons": { - "default_icon": "", - "ext_exact": { - ".ai": "", - ".awk": "", - ".bash": "", - ".bat": "", - ".bmp": "", - ".c": "", - ".c++": "", - ".cc": "", - ".clj": "", - ".cljc": "", - ".cljs": "", - ".coffee": "", - ".conf": "", - ".cp": "", - ".cpp": "", - ".cs": "", - ".csh": "", - ".css": "", - ".cxx": "", - ".d": "", - ".dart": "", - ".db": "", - ".diff": "", - ".dump": "", - ".edn": "", - ".eex": "", - ".ejs": "", - ".elm": "", - ".erl": "", - ".ex": "", - ".exs": "", - ".f#": "", - ".fish": "", - ".fs": "", - ".fsi": "", - ".fsscript": "", - ".fsx": "", - ".gemspec": "", - ".gif": "", - ".go": "", - ".h": "", - ".haml": "", - ".hbs": "", - ".heex": "", - ".hh": "", - ".hpp": "", - ".hrl": "", - ".hs": "", - ".htm": "", - ".html": "", - ".hxx": "", - ".ico": "", - ".ini": "", - ".java": "", - ".jl": "", - ".jpeg": "", - ".jpg": "", - ".js": "", - ".json": "", - ".jsx": "", - ".ksh": "", - ".leex": "", - ".less": "", - ".lhs": "", - ".lua": "", - ".markdown": "", - ".md": "", - ".mdx": "", - ".mjs": "", - ".mk": "", - ".ml": "λ", - ".mli": "λ", - ".mustache": "", - ".nix": "", - ".pem": "", - ".php": "", - ".pl": "", - ".pm": "", - ".png": "", - ".pp": "", - ".ps1": "", - ".psb": "", - ".psd": "", - ".py": "", - ".pyc": "", - ".pyd": "", - ".pyo": "", - ".r": "ﳒ", - ".rake": "", - ".rb": "", - ".rlib": "", - ".rmd": "", - ".rproj": "鉶", - ".rs": "", - ".rss": "", - ".sass": "", - ".scala": "", - ".scss": "", - ".sh": "", - ".slim": "", - ".sln": "", - ".sol": "ﲹ", - ".sql": "", - ".styl": "", - ".suo": "", - ".swift": "", - ".t": "", - ".tex": "ﭨ", - ".toml": "", - ".ts": "", - ".tsx": "", - ".twig": "", - ".vim": "", - ".vue": "﵂", - ".webmanifest": "", - ".webp": "", - ".xcplayground": "", - ".xul": "", - ".yaml": "", - ".yml": "", - ".zsh": "" - }, - "folder": { - "closed": "", - "open": "" - }, - "link": { - "broken": "󰌸", - "normal": "󰲔" - }, - "name_exact": { - ".bashprofile": "", - ".bashrc": "", - ".ds_store": "", - ".gitattributes": "", - ".gitconfig": "", - ".gitignore": "", - ".gitlab-ci.yml": "", - ".gvimrc": "", - ".vimrc": "", - ".zprofile": "", - ".zshenv": "", - ".zshrc": "", - "_gvimrc": "", - "_vimrc": "", - "cmakelists.txt": "", - "config.ru": "", - "docker-compose.yml": "", - "dockerfile": "", - "dropbox": "", - "exact-match-case-sensitive-1.txt": "1", - "exact-match-case-sensitive-2": "2", - "favicon.ico": "", - "gemfile": "", - "gruntfile.coffee": "", - "gruntfile.js": "", - "gruntfile.ls": "", - "gulpfile.coffee": "", - "gulpfile.js": "", - "gulpfile.ls": "", - "license": "", - "makefile": "", - "mix.lock": "", - "node_modules": "", - "procfile": "", - "rakefile": "", - "react.jsx": "", - "robots.txt": "ﮧ" - }, - "name_glob": { - ".*angular.*.js": "", - ".*backbone.*.js": "", - ".*jquery.*.js": "", - ".*materialize.*.css": "", - ".*materialize.*.js": "", - ".*mootools.*.js": "", - ".*require.*.js": "", - ".*vimrc.*": "", - "Vagrantfile": "" - }, - "status": { - "active": "▶", - "inactive": " ", - "not_selected": " ", - "selected": "✸" - } - }, - "emoji": { - "default_icon": "📄", - "ext_exact": { - ".3ds": "🦖", - ".5vw": "🔬", - ".60": "🦋", - ".7z": "📦", - ".a80": "🧩", - ".aar": "📦", - ".acp": "🔬", - ".ahk": "🔨", - ".ai": "🎨", - ".alda": "🎶", - ".ani": "🦖", - ".apc": "🔬", - ".apk": "📦", - ".arb": "🔶", - ".as": "👼🏻", - ".asm": "🧩", - ".asta": "🔀", - ".astro": "🔶", - ".atc": "🔬", - ".atom": "💢", - ".avi": "🎞 ", - ".axml": "💢", - ".bat": "🦇", - ".bb": "🐚", - ".beam": "🔟", - ".bf": "🥩", - ".bfr": "🔬", - ".bib": "📜", - ".bin": "🔟", - ".blend": "🦖", - ".blob": "🔟", - ".bmp": "🎨", - ".bpg": "🎨", - ".bsdl": "🅱️ ", - ".bsl": "🐲", - ".c": "🐮", - ".cap": "🔬", - ".carbon": "🐮", - ".carp": "🎏", - ".cbl": "⚙️ ", - ".cer": "🔑", - ".cff": "📜", - ".cfg": "🔨", - ".chs": "🦥", - ".cjs": "🔶", - ".class": "🔟", - ".clj": "🦚", - ".cmd": "🦇", - ".cmi": "🔟", - ".coffee": "☕️", - ".conf": "🔨", - ".config": "🔨", - ".cpp": "🐮", - ".cql": "🎲", - ".cr": "💎", - ".crt": "🔑", - ".cs": "☪️ ", - ".cshtml": "☪️ ", - ".csproj": "🔨", - ".css": "🌸", - ".csv": "📊", - ".csx": "☪️ ", - ".cu": "🦖", - ".cuh": "🦖", - ".d": "🆔", - ".dae": "🦖", - ".dart": "🎯", - ".dat": "🔟", - ".data": "🔟", - ".db": "🎲", - ".dds": "🎨", - ".deb": "📦", - ".dib": "📝", - ".diff": "💊", - ".dll": "🔟", - ".dmg": "📦", - ".doc": "📘", - ".docx": "📘", - ".dpk": "🥏", - ".dproj": "🥏", - ".drc": "🎞 ", - ".drcs": "🎞 ", - ".dtd": "💢", - ".duel": "⚔️ ", - ".dump": "💣", - ".dxf": "🦖", - ".dylib": "🔟", - ".ear": "📦", - ".ebnf": "🐲", - ".eex": "💧", - ".elm": "🔰", - ".elmi": "🔟", - ".elmo": "🔟", - ".enc": "🔬", - ".eot": "🀄️", - ".epp": "👻", - ".epub": "📙", - ".erb": "🔻", - ".erf": "🔬", - ".erl": "📡", - ".erm": "💢", - ".erwin": "🎲", - ".etlua": "🌏", - ".ex": "💧", - ".exe": "🚀", - ".exs": "💧", - ".ez": "📦", - ".fbx": "🦖", - ".fdc": "🔬", - ".fish": "🐚", - ".flr": "🎆", - ".fnl": "🌱", - ".frxml": "💢", - ".fs": "🔷", - ".fsi": "🔷", - ".fsl": "🔷", - ".fsproj": "🔨", - ".fsx": "🔷", - ".fsy": "🔷", - ".functions": "🐚", - ".fxml": "💢", - ".gdb": "🐞", - ".gif": "🎨", - ".gift": "📝", - ".git": "🐙", - ".glb": "🦖", - ".gleam": "✨", - ".glsl": "🦖", - ".gltf": "🦖", - ".go": "🌰", - ".gql": "🏀", - ".gr": "🌾", - ".gradle": "🐘", - ".graphql": "🏀", - ".graphqls": "🏀", - ".gravity": "🔵", - ".groovy": "🌟", - ".gvdesign": "🔀", - ".gz": "📦", - ".gzip": "📦", - ".h": "🧩", - ".hbs": "🈴", - ".hdr": "🎨", - ".heex": "🌏", - ".hive": "🔟", - ".hs": "🦥", - ".hs-boot": "🦥", - ".hsc": "🦥", - ".hsig": "🦥", - ".hss": "🌸", - ".htm": "🌏", - ".html": "🌏", - ".http": "🌐", - ".hvm": "🦥", - ".hx": "🏀", - ".icns": "🎨", - ".ico": "🎨", - ".ics": "⏳", - ".idl": "🧩", - ".imba": "🔶", - ".iml": "🔨", - ".inc": "🧩", - ".info": "📜", - ".ini": "🔨", - ".ino": "📟", - ".ipa": "📦", - ".ipfix": "🔬", - ".ipynb": "📝", - ".iso": "💿", - ".jade": "🈴", - ".jar": "📦", - ".jasper": "💹", - ".java": "☕️", - ".jenkinsfile": "🎩", - ".jks": "🔑", - ".jl": "🍡", - ".jmx": "💢", - ".jnlp": "💢", - ".jpeg": "🎨", - ".jpg": "🎨", - ".jrxml": "💢", - ".js": "🔶", - ".json": "🔶", - ".jsx": "🐟", - ".jws": "🔨", - ".jxl": "🎨", - ".key": "🔑", - ".kind": "🔶", - ".kind2": "🔶", - ".kt": "🗼", - ".kts": "🗼", - ".latex": "📜", - ".lc": "🦥", - ".lcap": "🔬", - ".leex": "💧", - ".less": "🌸", - ".lhs": "🦥", - ".lis": "🧩", - ".list": "🧩", - ".lock": "🔐", - ".log": "🦎", - ".lua": "🌕", - ".lz4": "📦", - ".m": "🐄", - ".mak": "🐃", - ".map": "🌐", - ".markdown": "⬇️ ", - ".marko": "⬇️ ", - ".md": "⬇️ ", - ".mdj": "🔀", - ".mdl": "🦖", - ".mint": "🍃", - ".mjs": "🔶", - ".mk": "🐃", - ".mkd": "⬇️ ", - ".mkv": "🎞 ", - ".ml": "🐫", - ".mli": "🧩", - ".mlt": "🎞 ", - ".mm": "🐄", - ".mo": "🗽", - ".mod": "🔨", - ".moon": "🌕", - ".mov": "🎞 ", - ".mp3": "🎶", - ".mp4": "🎞 ", - ".mpeg": "🎞 ", - ".mpg": "🎞 ", - ".mplog": "🔬", - ".mq4": "💰", - ".mq5": "💰", - ".mqlh": "🧩", - ".nelua": "🌕", - ".nib": "🧩", - ".nim": "👑", - ".norg": "🦄", - ".nupkg": "📦", - ".nuspec": "💢", - ".obj": "🦖", - ".odin": "🔵", - ".odp": "🎭", - ".ods": "📊", - ".odt": "📘", - ".ogg": "🎶", - ".org": "🦄", - ".os": "🐲", - ".out": "🔬", - ".ovpn": "🔑", - ".pages": "📘", - ".parquet": "🟫", - ".pas": "🌡 ", - ".pcap": "🔬", - ".pcapng": "🔬", - ".pdb": "🔟", - ".pde": "📟", - ".pdf": "🅿️ ", - ".pem": "🔑", - ".pepk": "🔑", - ".pfx": "🔑", - ".pgsql": "🎲", - ".php": "🐘", - ".pid": "🔟", - ".pkg": "📦", - ".pkl": "🔨", - ".pklg": "🔬", - ".pkt": "🔬", - ".pl": "🍐", - ".plist": "💢", - ".png": "🎨", - ".po": "🗽", - ".pony": "🐴", - ".pot": "🗽", - ".pp": "👻", - ".ppk": "🔑", - ".ppt": "🎭", - ".pptx": "🎭", - ".prefs": "🔨", - ".prisma": "🔷", - ".pro": "🔨", - ".profile": "👤", - ".properties": "🔨", - ".props": "💢", - ".proto": "⚛️ ", - ".ps1": "🐚", - ".psb": "🎨", - ".psd": "🎨", - ".psl": "🖌 ", - ".pug": "🐶", - ".puml": "🔀", - ".py": "🐍", - ".pyc": "🐍", - ".pyd": "🐍", - ".pyo": "🐍", - ".python": "🐍", - ".r": "🧮", - ".rar": "📦", - ".razor": "🟣", - ".rb": "🔻", - ".rc": "🥏", - ".re": "🐫", - ".reality": "🦖", - ".reg": "🔐", - ".rei": "🧩", - ".res": "🐫", - ".resi": "🧩", - ".rest": "🌐", - ".resx": "💢", - ".rf5": "🔬", - ".rh": "🐚", - ".rlib": "🔟", - ".rmd": "🎭", - ".rock": "🌕", - ".rockspec": "🌕", - ".rpm": "📦", - ".rproj": "🔨", - ".rs": "🦀", - ".rss": "💢", - ".rst": "🍇", - ".ru": "🔻", - ".s": "🧩", - ".sar": "📦", - ".sass": "👓", - ".sbt": "🔨", - ".sc": "💈", - ".scala": "💈", - ".scd": "🎶", - ".scm": "🌻", - ".scss": "🌸", - ".sfb": "🦖", - ".sfz": "🎶", - ".sh": "🐚", - ".slime": "🍨", - ".sln": "🔨", - ".snap": "📦", - ".snoop": "🔬", - ".so": "🔟", - ".socket": "🌐", - ".sol": "🐲", - ".spi": "🌀", - ".spiproj": "🌀", - ".spir": "🌀", - ".sql": "🎲", - ".sqlite": "🎲", - ".storyboard": "💢", - ".strings": "💢", - ".styl": "🌸", - ".suo": "☪️ ", - ".svelte": "💃🏻", - ".svg": "🎨", - ".swift": "🐦", - ".swo": "⏳", - ".swp": "⏳", - ".syc": "🔬", - ".t": "🌷", - ".tar": "📦", - ".tera": "🌏", - ".tflite": "🤖", - ".tga": "🎨", - ".tgz": "📦", - ".tif": "🎨", - ".tiff": "🀄️", - ".tlb": "🧩", - ".toml": "🔨", - ".tpc": "🔬", - ".tpl": "🈴", - ".tr1": "🔬", - ".trace": "🔬", - ".trc": "🔬", - ".ts": "🔷", - ".tsx": "🔷", - ".ttf": "🀄️", - ".tup": "🐃", - ".txt": "📝", - ".uml": "🔀", - ".usd": "🦖", - ".usda": "🦖", - ".usdc": "🦖", - ".usdz": "🦖", - ".userprefs": "🔨", - ".v": "✅", - ".val": "✔️", - ".vbs": "🌀", - ".vcxproj": "💢", - ".vdf": "🔨", - ".vgb": "🔨", - ".vh": "🧩", - ".vim": "🍃", - ".vimrc": "🍃", - ".vimspec": "🍃", - ".vmb": "📦", - ".vpp": "🔀", - ".vrx": "🦖", - ".vsh": "✅", - ".vue": "🌲", - ".vv": "✅", - ".vwr": "🔬", - ".wad": "🔟", - ".war": "📦", - ".wasm": "🔟", - ".wast": "🔟", - ".wat": "🔟", - ".wav": "🎶", - ".wbmp": "🎨", - ".webp": "🎨", - ".woff": "🀄️", - ".wpc": "🔬", - ".wpz": "🔬", - ".wscene": "🎞 ", - ".wsdl": "💢", - ".xaml": "💢", - ".xcf": "🎨", - ".xdata": "💢", - ".xhtml": "🌏", - ".xib": "💢", - ".xjb": "💢", - ".xlf": "💢", - ".xls": "📊", - ".xlsx": "📊", - ".xml": "💢", - ".xsd": "💢", - ".xsl": "💢", - ".xz": "📦", - ".yaml": "🎴", - ".yml": "🎴", - ".z80": "🧩", - ".zig": "⚡️", - ".zip": "📦", - ".zsh": "🐚", - ".zst": "📦" - }, - "folder": { - "closed": "📁", - "open": "📂" - }, - "link": { - "broken": "󰌸", - "normal": "󰲔" - }, - "name_exact": { - ".bashprofile": "🐚", - ".bashrc": "🐚", - ".cabal": "🔨", - ".dart_tool": "🔨", - ".dockerignore": "🐳", - ".ds_store": "📌", - ".editorconfig": "🐭", - ".env": "🏕 ", - ".envrc": "🔨", - ".git": "🐙", - ".gitattributes": "🐙", - ".gitconfig": "🐙", - ".gitignore": "🐙", - ".gitlab-ci.yml": "🎴", - ".gqlconfig": "🔨", - ".hackernews": "📰", - ".idea": "🔨", - ".merlin": "🧙", - ".svn": "🐢", - ".tool-versions": "🔨", - ".vimspector.json": "🐞", - ".vscode": "🆚", - ".zprofile": "🔨", - ".zshenv": "🔨", - ".zshrc": "🐚", - "MANIFEST.MF": "🔨", - "android": "🤖", - "cabal.config": "🔨", - "cabal.project": "🔨", - "changelog.md": "🍁", - "config": "🔨", - "deps": "🚼", - "docker-compose-single-broker.yml": "🐳", - "docker-compose-swarm.yml": "🐳", - "docker-compose.yml": "🐳", - "dockerfile": "🐳", - "dropbox": "📪", - "elm-package.json": "🔰", - "elm.json": "🔰", - "favicon.ico": "🎨", - "gemfile": "🔨", - "gemfile.lock": "🔐", - "gradlew": "🐚", - "gruntfile.coffee": "🔨", - "gruntfile.js": "🔶", - "gruntfile.ls": "🔶", - "guardfile": "💂", - "gulpfile.coffee": "🔨", - "gulpfile.js": "🔶", - "gulpfile.ls": "🔶", - "ios": "📱", - "jenkinsfile": "🎩", - "justfile": "🔨", - "lib": "📚", - "license": "📜", - "license.txt": "📜", - "makefile": "🐃", - "mix.lock": "🔐", - "node_modules": "🔶", - "paket.dependencies": "🔨", - "paket.references": "🔨", - "podfile": "🔨", - "pom.xml": "🔨", - "procfile": "🔨", - "rakefile": "🔨", - "react.jsx": "💢", - "routes": "🔨", - "spec.ts": "🔷", - "tags": "📌", - "test": "🧪", - "tests": "🧪", - "todo": "🚧", - "todo.md": "🚧", - "yarn.lock": "🐈" - }, - "name_glob": { - ".*.UnitDoc": "🥏", - ".*.config.js": "🔨", - ".*.config.ts": "🔨", - ".*.csproj.user": "💢", - ".*.css.map": "🌸", - ".*.db-journal": "🎲", - ".*.dockerfile": "🐳", - ".*.gr.wasm": "🌾", - ".*.js.map": "🔶", - ".*.mobileprovision": "📱", - ".*.podspec": "🔨", - ".*.xaml": "🔨", - ".*.xaml.cs": "🔨", - ".*LICENSE.*": "📜", - ".*angular.*.js": "🔶", - ".*backbone.*.js": "🔶", - ".*jquery.*.js": "🔶", - ".*materialize.*.css": "🔶", - ".*materialize.*.js": "🔶", - ".*mootools.*.js": "🔶", - ".*require.*.js": "🔶", - ".*vcxproj.filters": "💢", - ".*vimrc.*": "🍃", - ".dropbox": "📪", - ".gitconfig": "🐙", - ".npmrc": "🔨", - "commit_editmsg": "🐙", - "dockerfile..*": "🐳" - }, - "status": { - "active": "▶", - "inactive": " ", - "not_selected": " ", - "selected": "✸" - } - } - }, - "ls_colours": { - "nord": "no=00:rs=0:fi=00:di=01;34:ln=36:mh=04;36:pi=04;01;36:so=04;33:do=04;01;36:bd=01;33:cd=33:or=31:mi=01;37;41:ex=01;36:su=01;04;37:sg=01;04;37:ca=01;37:tw=01;37;44:ow=01;04;34:st=04;37;44:*.7z=01;32:*.ace=01;32:*.alz=01;32:*.arc=01;32:*.arj=01;32:*.bz=01;32:*.bz2=01;32:*.cab=01;32:*.cpio=01;32:*.deb=01;32:*.dz=01;32:*.ear=01;32:*.gz=01;32:*.jar=01;32:*.lha=01;32:*.lrz=01;32:*.lz=01;32:*.lz4=01;32:*.lzh=01;32:*.lzma=01;32:*.lzo=01;32:*.rar=01;32:*.rpm=01;32:*.rz=01;32:*.sar=01;32:*.t7z=01;32:*.tar=01;32:*.taz=01;32:*.tbz=01;32:*.tbz2=01;32:*.tgz=01;32:*.tlz=01;32:*.txz=01;32:*.tz=01;32:*.tzo=01;32:*.tzst=01;32:*.war=01;32:*.xz=01;32:*.z=01;32:*.Z=01;32:*.zip=01;32:*.zoo=01;32:*.zst=01;32:*.aac=32:*.au=32:*.flac=32:*.m4a=32:*.mid=32:*.midi=32:*.mka=32:*.mp3=32:*.mpa=32:*.mpeg=32:*.mpg=32:*.ogg=32:*.opus=32:*.ra=32:*.wav=32:*.3des=01;35:*.aes=01;35:*.gpg=01;35:*.pgp=01;35:*.doc=32:*.docx=32:*.dot=32:*.odg=32:*.odp=32:*.ods=32:*.odt=32:*.otg=32:*.otp=32:*.ots=32:*.ott=32:*.pdf=32:*.ppt=32:*.pptx=32:*.xls=32:*.xlsx=32:*.app=01;36:*.bat=01;36:*.btm=01;36:*.cmd=01;36:*.com=01;36:*.exe=01;36:*.reg=01;36:*~=02;37:*.bak=02;37:*.BAK=02;37:*.log=02;37:*.log=02;37:*.old=02;37:*.OLD=02;37:*.orig=02;37:*.ORIG=02;37:*.swo=02;37:*.swp=02;37:*.bmp=32:*.cgm=32:*.dl=32:*.dvi=32:*.emf=32:*.eps=32:*.gif=32:*.jpeg=32:*.jpg=32:*.JPG=32:*.mng=32:*.pbm=32:*.pcx=32:*.pgm=32:*.png=32:*.PNG=32:*.ppm=32:*.pps=32:*.ppsx=32:*.ps=32:*.svg=32:*.svgz=32:*.tga=32:*.tif=32:*.tiff=32:*.xbm=32:*.xcf=32:*.xpm=32:*.xwd=32:*.xwd=32:*.yuv=32:*.anx=32:*.asf=32:*.avi=32:*.axv=32:*.flc=32:*.fli=32:*.flv=32:*.gl=32:*.m2v=32:*.m4v=32:*.mkv=32:*.mov=32:*.MOV=32:*.mp4=32:*.mpeg=32:*.mpg=32:*.nuv=32:*.ogm=32:*.ogv=32:*.ogx=32:*.qt=32:*.rm=32:*.rmvb=32:*.swf=32:*.vob=32:*.webm=32:*.wmv=32:", - "solarized_dark": "no=00:fi=00:di=34:ow=34;40:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.h=32:*.hpp=32:*.c=32:*.C=32:*.cc=32:*.cpp=32:*.cxx=32:*.objc=32:*.cl=32:*.sh=32:*.bash=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.erb=32:*.haml=32:*.xml=32:*.rdf=32:*.css=32:*.sass=32:*.scss=32:*.less=32:*.js=32:*.coffee=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.go=32:*.sql=32:*.csv=32:*.sv=32:*.svh=32:*.v=32:*.vh=32:*.vhd=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pgm=33:*.png=33:*.PNG=33:*.ppm=33:*.pps=33:*.ppsx=33:*.ps=33:*.svg=33:*.svgz=33:*.tga=33:*.tif=33:*.tiff=33:*.xbm=33:*.xcf=33:*.xpm=33:*.xwd=33:*.xwd=33:*.yuv=33:*.nef=33:*.NEF=33:*.webp=33:*.heic=33:*.HEIC=33:*.avif=33:*.aac=33:*.au=33:*.flac=33:*.m4a=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.opus=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.MOV=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.webm=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.odt=31:*.dot=31:*.dotx=31:*.ott=31:*.xls=31:*.xlsx=31:*.ods=31:*.ots=31:*.ppt=31:*.pptx=31:*.odp=31:*.otp=31:*.fla=31:*.psd=31:*.pdf=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.zst=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;32:*~=01;32:*#=01;32:*.bak=01;33:*.BAK=01;33:*.old=01;33:*.OLD=01;33:*.org_archive=01;33:*.off=01;33:*.OFF=01;33:*.dist=01;33:*.DIST=01;33:*.orig=01;33:*.ORIG=01;33:*.swp=01;33:*.swo=01;33:*.v=01;33:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:*.sqlite=34:", - "solarized_dark_256": "no=00;38;5;244:rs=0:di=00;38;5;33:ln=01;38;5;37:mh=00:pi=48;5;230;38;5;136;01:so=48;5;230;38;5;136;01:do=48;5;230;38;5;136;01:bd=48;5;230;38;5;244;01:cd=48;5;230;38;5;244;01:or=48;5;235;38;5;160:su=48;5;160;38;5;230:sg=48;5;136;38;5;230:ca=30;41:tw=48;5;64;38;5;230:ow=48;5;235;38;5;33:st=48;5;33;38;5;230:ex=01;38;5;64:*.tar=00;38;5;61:*.tgz=01;38;5;61:*.arj=01;38;5;61:*.taz=01;38;5;61:*.lzh=01;38;5;61:*.lzma=01;38;5;61:*.tlz=01;38;5;61:*.txz=01;38;5;61:*.zip=01;38;5;61:*.zst=01;38;5;61:*.z=01;38;5;61:*.Z=01;38;5;61:*.dz=01;38;5;61:*.gz=01;38;5;61:*.lz=01;38;5;61:*.xz=01;38;5;61:*.bz2=01;38;5;61:*.bz=01;38;5;61:*.tbz=01;38;5;61:*.tbz2=01;38;5;61:*.tz=01;38;5;61:*.deb=01;38;5;61:*.rpm=01;38;5;61:*.jar=01;38;5;61:*.rar=01;38;5;61:*.ace=01;38;5;61:*.zoo=01;38;5;61:*.cpio=01;38;5;61:*.7z=01;38;5;61:*.rz=01;38;5;61:*.apk=01;38;5;61:*.gem=01;38;5;61:*.jpg=00;38;5;136:*.JPG=00;38;5;136:*.jpeg=00;38;5;136:*.gif=00;38;5;136:*.bmp=00;38;5;136:*.pbm=00;38;5;136:*.pgm=00;38;5;136:*.ppm=00;38;5;136:*.tga=00;38;5;136:*.xbm=00;38;5;136:*.xpm=00;38;5;136:*.tif=00;38;5;136:*.tiff=00;38;5;136:*.png=00;38;5;136:*.PNG=00;38;5;136:*.svg=00;38;5;136:*.svgz=00;38;5;136:*.mng=00;38;5;136:*.pcx=00;38;5;136:*.dl=00;38;5;136:*.xcf=00;38;5;136:*.xwd=00;38;5;136:*.yuv=00;38;5;136:*.cgm=00;38;5;136:*.emf=00;38;5;136:*.eps=00;38;5;136:*.CR2=00;38;5;136:*.ico=00;38;5;136:*.nef=00;38;5;136:*.NEF=00;38;5;136:*.webp=00;38;5;136:*.heic=00;38;5;136:*.HEIC=00;38;5;136:*.avif=00;38;5;136:*.tex=01;38;5;245:*.rdf=01;38;5;245:*.owl=01;38;5;245:*.n3=01;38;5;245:*.ttl=01;38;5;245:*.nt=01;38;5;245:*.torrent=01;38;5;245:*.xml=01;38;5;245:*Makefile=01;38;5;245:*Rakefile=01;38;5;245:*Dockerfile=01;38;5;245:*build.xml=01;38;5;245:*rc=01;38;5;245:*1=01;38;5;245:*.nfo=01;38;5;245:*README=01;38;5;245:*README.txt=01;38;5;245:*readme.txt=01;38;5;245:*.md=01;38;5;245:*README.markdown=01;38;5;245:*.ini=01;38;5;245:*.yml=01;38;5;245:*.cfg=01;38;5;245:*.conf=01;38;5;245:*.h=01;38;5;245:*.hpp=01;38;5;245:*.c=01;38;5;245:*.cpp=01;38;5;245:*.cxx=01;38;5;245:*.cc=01;38;5;245:*.objc=01;38;5;245:*.sqlite=01;38;5;245:*.go=01;38;5;245:*.sql=01;38;5;245:*.csv=01;38;5;245:*.log=00;38;5;240:*.bak=00;38;5;240:*.aux=00;38;5;240:*.lof=00;38;5;240:*.lol=00;38;5;240:*.lot=00;38;5;240:*.out=00;38;5;240:*.toc=00;38;5;240:*.bbl=00;38;5;240:*.blg=00;38;5;240:*~=00;38;5;240:*#=00;38;5;240:*.part=00;38;5;240:*.incomplete=00;38;5;240:*.swp=00;38;5;240:*.tmp=00;38;5;240:*.temp=00;38;5;240:*.o=00;38;5;240:*.pyc=00;38;5;240:*.class=00;38;5;240:*.cache=00;38;5;240:*.aac=00;38;5;166:*.au=00;38;5;166:*.flac=00;38;5;166:*.mid=00;38;5;166:*.midi=00;38;5;166:*.mka=00;38;5;166:*.mp3=00;38;5;166:*.mpc=00;38;5;166:*.ogg=00;38;5;166:*.opus=00;38;5;166:*.ra=00;38;5;166:*.wav=00;38;5;166:*.m4a=00;38;5;166:*.axa=00;38;5;166:*.oga=00;38;5;166:*.spx=00;38;5;166:*.xspf=00;38;5;166:*.mov=01;38;5;166:*.MOV=01;38;5;166:*.mpg=01;38;5;166:*.mpeg=01;38;5;166:*.m2v=01;38;5;166:*.mkv=01;38;5;166:*.ogm=01;38;5;166:*.mp4=01;38;5;166:*.m4v=01;38;5;166:*.mp4v=01;38;5;166:*.vob=01;38;5;166:*.qt=01;38;5;166:*.nuv=01;38;5;166:*.wmv=01;38;5;166:*.asf=01;38;5;166:*.rm=01;38;5;166:*.rmvb=01;38;5;166:*.flc=01;38;5;166:*.avi=01;38;5;166:*.fli=01;38;5;166:*.flv=01;38;5;166:*.gl=01;38;5;166:*.m2ts=01;38;5;166:*.divx=01;38;5;166:*.webm=01;38;5;166:*.axv=01;38;5;166:*.anx=01;38;5;166:*.ogv=01;38;5;166:*.ogx=01;38;5;166:", - "solarized_light": "no=00:fi=00:di=36:ow=34;47:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.h=32:*.hpp=32:*.c=32:*.C=32:*.cc=32:*.cpp=32:*.cxx=32:*.objc=32:*.cl=32:*.sh=32:*.bash=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.erb=32:*.haml=32:*.xml=32:*.rdf=32:*.css=32:*.sass=32:*.scss=32:*.less=32:*.js=32:*.coffee=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.go=32:*.sql=32:*.csv=32:*.sv=32:*.svh=32:*.v=32:*.vh=32:*.vhd=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pgm=33:*.png=33:*.PNG=33:*.ppm=33:*.pps=33:*.ppsx=33:*.ps=33:*.svg=33:*.svgz=33:*.tga=33:*.tif=33:*.tiff=33:*.xbm=33:*.xcf=33:*.xpm=33:*.xwd=33:*.xwd=33:*.yuv=33:*.nef=33:*.NEF=33:*.webp=33:*.heic=33:*.HEIC=33:*.avif=33:*.aac=33:*.au=33:*.flac=33:*.m4a=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.opus=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.MOV=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.webm=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.odt=31:*.dot=31:*.dotx=31:*.ott=31:*.xls=31:*.xlsx=31:*.ods=31:*.ots=31:*.ppt=31:*.pptx=31:*.odp=31:*.otp=31:*.fla=31:*.psd=31:*.pdf=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.zst=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;34:*~=01;34:*#=01;34:*.bak=01;36:*.BAK=01;36:*.old=01;36:*.OLD=01;36:*.org_archive=01;36:*.off=01;36:*.OFF=01;36:*.dist=01;36:*.DIST=01;36:*.orig=01;36:*.ORIG=01;36:*.swp=01;36:*.swo=01;36:*.v=01;36:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:*.sqlite=34:", - "solarized_universal": "no=00:fi=00:di=36:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.bib=32:*.h=32:*.hpp=32:*.c=32:*.C=32:*.cc=32:*.cpp=32:*.cxx=32:*.objc=32:*.cl=32:*.sh=32:*.bash=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.erb=32:*.haml=32:*.xml=32:*.rdf=32:*.css=32:*.sass=32:*.scss=32:*.less=32:*.js=32:*.coffee=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.go=32:*.sql=32:*.csv=32:*.sv=32:*.svh=32:*.v=32:*.vh=32:*.vhd=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pgm=33:*.png=33:*.PNG=33:*.ppm=33:*.pps=33:*.ppsx=33:*.ps=33:*.svg=33:*.svgz=33:*.tga=33:*.tif=33:*.tiff=33:*.xbm=33:*.xcf=33:*.xpm=33:*.xwd=33:*.xwd=33:*.yuv=33:*.NEF=33:*.nef=33:*.webp=33:*.heic=33:*.HEIC=33:*.avif=33:*.aac=33:*.au=33:*.flac=33:*.m4a=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.opus=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.MOV=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.webm=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.odt=31:*.dot=31:*.dotx=31:*.ott=31:*.xls=31:*.xlsx=31:*.ods=31:*.ots=31:*.ppt=31:*.pptx=31:*.odp=31:*.otp=31:*.fla=31:*.psd=31:*.pdf=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.zst=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;32:*~=01;32:*#=01;32:*.bak=01;36:*.BAK=01;36:*.old=01;36:*.OLD=01;36:*.org_archive=01;36:*.off=01;36:*.OFF=01;36:*.dist=01;36:*.DIST=01;36:*.orig=01;36:*.ORIG=01;36:*.swp=01;36:*.swo=01;36:*.v=01;36:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:*.sqlite=34:*.db=34:", - "trapdoor": "bd=38;5;68:ca=38;5;17:cd=38;5;113;1:di=38;5;30:do=38;5;127:ex=38;5;208;1:pi=38;5;126:fi=0:ln=target:mh=38;5;222;1:no=0:or=48;5;196;38;5;232;1:ow=38;5;220;1:sg=48;5;3;38;5;0:su=38;5;220;1;3;100;1:so=38;5;197:st=38;5;86;48;5;234:tw=48;5;235;38;5;139;3:*LS_COLORS=48;5;89;38;5;197;1;3;4;7:*.txt=38;5;253:*README=38;5;220;1:*README.rst=38;5;220;1:*README.md=38;5;220;1:*LICENSE=38;5;220;1:*LICENSE.md=38;5;220;1:*COPYING=38;5;220;1:*INSTALL=38;5;220;1:*COPYRIGHT=38;5;220;1:*AUTHORS=38;5;220;1:*HISTORY=38;5;220;1:*CONTRIBUTORS=38;5;220;1:*CONTRIBUTING=38;5;220;1:*CONTRIBUTING.md=38;5;220;1:*CHANGELOG=38;5;220;1:*CHANGELOG.md=38;5;220;1:*CODEOWNERS=38;5;220;1:*PATENTS=38;5;220;1:*VERSION=38;5;220;1:*NOTICE=38;5;220;1:*CHANGES=38;5;220;1:*.log=38;5;190:*.adoc=38;5;184:*.asciidoc=38;5;184:*.etx=38;5;184:*.info=38;5;184:*.markdown=38;5;184:*.md=38;5;184:*.mkd=38;5;184:*.mdx=38;5;184:*.nfo=38;5;184:*.org=38;5;184:*.norg=38;5;184:*.pod=38;5;184:*.rst=38;5;184:*.tex=38;5;184:*.textile=38;5;184:*.bib=38;5;178:*.json=38;5;178:*.jsonc=38;5;178:*.json5=38;5;178:*.hjson=38;5;178:*.jsonl=38;5;178:*.jsonnet=38;5;178:*.libsonnet=38;5;142:*.ndjson=38;5;178:*.msg=38;5;178:*.pgn=38;5;178:*.rss=38;5;178:*.xml=38;5;178:*.fxml=38;5;178:*.toml=38;5;178:*.yaml=38;5;178:*.yml=38;5;178:*.RData=38;5;178:*.rdata=38;5;178:*.xsd=38;5;178:*.dtd=38;5;178:*.sgml=38;5;178:*.rng=38;5;178:*.rnc=38;5;178:*.accdb=38;5;60:*.accde=38;5;60:*.accdr=38;5;60:*.accdt=38;5;60:*.db=38;5;60:*.fmp12=38;5;60:*.fp7=38;5;60:*.localstorage=38;5;60:*.mdb=38;5;60:*.mde=38;5;60:*.sqlite=38;5;60:*.typelib=38;5;60:*.nc=38;5;60:*.cbr=38;5;141:*.cbz=38;5;141:*.chm=38;5;141:*.djvu=38;5;141:*.pdf=38;5;141:*.PDF=38;5;141:*.mobi=38;5;141:*.epub=38;5;141:*.docm=38;5;111;4:*.doc=38;5;111:*.docx=38;5;111:*.odb=38;5;111:*.odt=38;5;111:*.rtf=38;5;111:*.pages=38;5;111:*.odp=38;5;166:*.pps=38;5;166:*.ppt=38;5;166:*.pptx=38;5;166:*.ppts=38;5;166:*.pptxm=38;5;166;4:*.pptsm=38;5;166;4:*.prisma=38;5;222:*.csv=38;5;78:*.tsv=38;5;78:*.numbers=38;5;112:*.ods=38;5;112:*.xla=38;5;76:*.xls=38;5;112:*.xlsx=38;5;112:*.xlsxm=38;5;112;4:*.xltm=38;5;73;4:*.xltx=38;5;73:*.key=38;5;166:*config=1:*cfg=1:*conf=1:*rc=1:*authorized_keys=1:*known_hosts=1:*.ini=1:*.plist=1:*.profile=1:*.bash_profile=1:*.bash_login=1:*.bash_logout=1:*.zshenv=1:*.zprofile=1:*.zlogin=1:*.zlogout=1:*.viminfo=1:*.pcf=1:*.psf=1:*.hidden-color-scheme=1:*.hidden-tmTheme=1:*.last-run=1:*.merged-ca-bundle=1:*.sublime-build=1:*.sublime-commands=1:*.sublime-keymap=1:*.sublime-settings=1:*.sublime-snippet=1:*.sublime-project=1:*.sublime-workspace=1:*.tmTheme=1:*.user-ca-bundle=1:*.rstheme=1:*.epf=1:*.git=38;5;197:*.github=38;5;197:*.gitignore=38;5;240:*.gitattributes=38;5;240:*.gitmodules=38;5;240:*.awk=38;5;172:*.bash=38;5;172:*.bat=38;5;172:*.BAT=38;5;172:*.sed=38;5;172:*.sh=38;5;172:*.zsh=38;5;172:*.fish=38;5;172:*.vim=38;5;172:*.kak=38;5;172:*.ahk=38;5;41:*.py=38;5;41:*.ipynb=38;5;41:*.xsh=38;5;41:*.rb=38;5;41:*.gemspec=38;5;41:*.pl=38;5;208:*.PL=38;5;160:*.pm=38;5;203:*.t=38;5;114:*.msql=38;5;222:*.mysql=38;5;222:*.prql=38;5;222:*.pgsql=38;5;222:*.sql=38;5;222:*.tcl=38;5;64;1:*.r=38;5;49:*.R=38;5;49:*.gs=38;5;81:*.clj=38;5;41:*.cljs=38;5;41:*.cljc=38;5;41:*.cljw=38;5;41:*.scala=38;5;41:*.sc=38;5;41:*.dart=38;5;51:*.asm=38;5;81:*.cl=38;5;81:*.ml=38;5;81:*.lisp=38;5;81:*.rkt=38;5;81:*.el=38;5;81:*.elc=38;5;241:*.eln=38;5;241:*.lua=38;5;81:*.moon=38;5;81:*.c=38;5;81:*.C=38;5;81:*.h=38;5;110:*.H=38;5;110:*.tcc=38;5;110:*.c++=38;5;81:*.h++=38;5;110:*.hpp=38;5;110:*.hxx=38;5;110:*.ii=38;5;110:*.M=38;5;110:*.m=38;5;110:*.cc=38;5;81:*.cs=38;5;81:*.cp=38;5;81:*.cpp=38;5;81:*.cxx=38;5;81:*.cr=38;5;81:*.go=38;5;81:*.f=38;5;81:*.F=38;5;81:*.for=38;5;81:*.ftn=38;5;81:*.f90=38;5;81:*.F90=38;5;81:*.f95=38;5;81:*.F95=38;5;81:*.f03=38;5;81:*.F03=38;5;81:*.f08=38;5;81:*.F08=38;5;81:*.nim=38;5;81:*.nimble=38;5;81:*.s=38;5;110:*.S=38;5;110:*.rs=38;5;81:*.scpt=38;5;219:*.swift=38;5;219:*.sx=38;5;81:*.vala=38;5;81:*.vapi=38;5;81:*.hi=38;5;110:*.hs=38;5;81:*.lhs=38;5;81:*.agda=38;5;81:*.lagda=38;5;81:*.lagda.tex=38;5;81:*.lagda.rst=38;5;81:*.lagda.md=38;5;81:*.agdai=38;5;110:*.zig=38;5;81:*.v=38;5;81:*.pyc=38;5;240:*.tf=38;5;168:*.tfstate=38;5;168:*.tfvars=38;5;168:*.http=38;5;90;1:*.eml=38;5;90;1:*.css=38;5;105;1:*.less=38;5;105;1:*.sass=38;5;105;1:*.scss=38;5;105;1:*.htm=38;5;125;1:*.html=38;5;125;1:*.jhtm=38;5;125;1:*.mht=38;5;125;1:*.mustache=38;5;135;1:*.ejs=38;5;135;1:*.pug=38;5;135;1:*.svelte=38;5;135;1:*.vue=38;5;135;1:*.astro=38;5;135;1:*.js=38;5;074;1:*.jsx=38;5;074;1:*.ts=38;5;074;1:*.tsx=38;5;074;1:*.mjs=38;5;074;1:*.cjs=38;5;074;1:*.coffee=38;5;079;1:*.java=38;5;079;1:*.jsm=38;5;079;1:*.jsp=38;5;079;1:*.php=38;5;81:*.ctp=38;5;81:*.twig=38;5;81:*.vb=38;5;81:*.vba=38;5;81:*.vbs=38;5;81:*Containerfile=38;5;155:*.containerignore=38;5;240:*Dockerfile=38;5;155:*.dockerignore=38;5;240:*Makefile=38;5;155:*MANIFEST=38;5;243:*pm_to_blib=38;5;240:*.nix=38;5;155:*.dhall=38;5;178:*.rake=38;5;155:*.am=38;5;242:*.in=38;5;242:*.hin=38;5;242:*.scan=38;5;242:*.m4=38;5;242:*.old=38;5;242:*.out=38;5;242:*.SKIP=38;5;244:*.diff=48;5;197;38;5;232:*.patch=48;5;197;38;5;232;1:*.bmp=38;5;97:*.dicom=38;5;97:*.tiff=38;5;97:*.tif=38;5;97:*.TIFF=38;5;97:*.cdr=38;5;97:*.flif=38;5;97:*.gif=38;5;97:*.icns=38;5;97:*.ico=38;5;97:*.jpeg=38;5;97:*.JPG=38;5;97:*.jpg=38;5;97:*.jxl=38;5;97:*.nth=38;5;97:*.png=38;5;97:*.psd=38;5;97:*.pxd=38;5;97:*.pxm=38;5;97:*.xpm=38;5;97:*.webp=38;5;97:*.ai=38;5;99:*.eps=38;5;99:*.epsf=38;5;99:*.drw=38;5;99:*.ps=38;5;99:*.svg=38;5;99:*.avi=38;5;114:*.divx=38;5;114:*.IFO=38;5;114:*.m2v=38;5;114:*.m4v=38;5;114:*.mkv=38;5;114:*.MOV=38;5;114:*.mov=38;5;114:*.mp4=38;5;114:*.mpeg=38;5;114:*.mpg=38;5;114:*.ogm=38;5;114:*.rmvb=38;5;114:*.sample=38;5;114:*.wmv=38;5;114:*.3g2=38;5;115:*.3gp=38;5;115:*.gp3=38;5;115:*.webm=38;5;115:*.gp4=38;5;115:*.asf=38;5;115:*.flv=38;5;115:*.ogv=38;5;115:*.f4v=38;5;115:*.VOB=38;5;115;1:*.vob=38;5;115;1:*.ass=38;5;117:*.srt=38;5;117:*.ssa=38;5;117:*.sub=38;5;117:*.sup=38;5;117:*.vtt=38;5;117:*.3ga=38;5;137;1:*.S3M=38;5;137;1:*.aac=38;5;137;1:*.amr=38;5;137;1:*.au=38;5;137;1:*.caf=38;5;137;1:*.dat=38;5;137;1:*.dts=38;5;137;1:*.fcm=38;5;137;1:*.m4a=38;5;137;1:*.mod=38;5;137;1:*.mp3=38;5;137;1:*.mp4a=38;5;137;1:*.oga=38;5;137;1:*.ogg=38;5;137;1:*.opus=38;5;137;1:*.s3m=38;5;137;1:*.sid=38;5;137;1:*.wma=38;5;137;1:*.ape=38;5;136;1:*.aiff=38;5;136;1:*.cda=38;5;136;1:*.flac=38;5;136;1:*.alac=38;5;136;1:*.mid=38;5;136;1:*.midi=38;5;136;1:*.pcm=38;5;136;1:*.wav=38;5;136;1:*.wv=38;5;136;1:*.wvc=38;5;136;1:*.afm=38;5;66:*.fon=38;5;66:*.fnt=38;5;66:*.pfb=38;5;66:*.pfm=38;5;66:*.ttf=38;5;66:*.otf=38;5;66:*.woff=38;5;66:*.woff2=38;5;66:*.PFA=38;5;66:*.pfa=38;5;66:*.7z=38;5;40:*.a=38;5;40:*.arj=38;5;40:*.br=38;5;40:*.bz2=38;5;40:*.cpio=38;5;40:*.gz=38;5;40:*.lrz=38;5;40:*.lz=38;5;40:*.lzma=38;5;40:*.lzo=38;5;40:*.rar=38;5;40:*.s7z=38;5;40:*.sz=38;5;40:*.tar=38;5;40:*.tbz=38;5;40:*.tgz=38;5;40:*.warc=38;5;40:*.WARC=38;5;40:*.xz=38;5;40:*.z=38;5;40:*.zip=38;5;40:*.zipx=38;5;40:*.zoo=38;5;40:*.zpaq=38;5;40:*.zst=38;5;40:*.zstd=38;5;40:*.zz=38;5;40:*.apk=38;5;215:*.ipa=38;5;215:*.deb=38;5;215:*.rpm=38;5;215:*.jad=38;5;215:*.jar=38;5;215:*.ear=38;5;215:*.war=38;5;215:*.cab=38;5;215:*.pak=38;5;215:*.pk3=38;5;215:*.vdf=38;5;215:*.vpk=38;5;215:*.bsp=38;5;215:*.dmg=38;5;215:*.crx=38;5;215:*.xpi=38;5;215:*.iso=38;5;124:*.img=38;5;124:*.bin=38;5;124:*.nrg=38;5;124:*.qcow=38;5;124:*.fvd=38;5;124:*.sparseimage=38;5;124:*.toast=38;5;124:*.vcd=38;5;124:*.vdi=38;5;124:*.vhd=38;5;124:*.vhdx=38;5;124:*.vfd=38;5;124:*.vmdk=38;5;124:*.swp=38;5;244:*.swo=38;5;244:*.tmp=38;5;244:*.sassc=38;5;244:*.pacnew=38;5;33:*.un~=38;5;241:*.orig=38;5;241:*.BUP=38;5;241:*.bak=38;5;241:*.o=38;5;241:*core=38;5;241:*.mdump=38;5;241:*.rlib=38;5;241:*.dll=38;5;241:*.aria2=38;5;241:*.dump=38;5;241:*.stackdump=38;5;241:*.zcompdump=38;5;241:*.zwc=38;5;241:*.part=38;5;239:*.r[0-9]{0,2}=38;5;239:*.zx[0-9]{0,2}=38;5;239:*.z[0-9]{0,2}=38;5;239:*.pid=38;5;248:*.state=38;5;248:*lockfile=38;5;248:*lock=38;5;248:*.err=38;5;160;1:*.error=38;5;160;1:*.stderr=38;5;160;1:*.pcap=38;5;29:*.cap=38;5;29:*.dmp=38;5;29:*.allow=38;5;112:*.deny=38;5;196:*.service=38;5;45:*@.service=38;5;45:*.socket=38;5;45:*.swap=38;5;45:*.device=38;5;45:*.mount=38;5;45:*.automount=38;5;45:*.target=38;5;45:*.path=38;5;45:*.timer=38;5;45:*.snapshot=38;5;45:*.lnk=38;5;39:*.application=38;5;116:*.cue=38;5;116:*.description=38;5;116:*.directory=38;5;116:*.m3u=38;5;116:*.m3u8=38;5;116:*.md5=38;5;116:*.properties=38;5;116:*.sfv=38;5;116:*.theme=38;5;116:*.torrent=38;5;116:*.urlview=38;5;116:*.webloc=38;5;116:*.asc=38;5;192;3:*.bfe=38;5;192;3:*.enc=38;5;192;3:*.gpg=38;5;192;3:*.signature=38;5;192;3:*.sig=38;5;192;3:*.p12=38;5;192;3:*.pem=38;5;192;3:*.pgp=38;5;192;3:*.p7s=38;5;192;3:*id_dsa=38;5;192;3:*id_rsa=38;5;192;3:*id_ecdsa=38;5;192;3:*id_ed25519=38;5;192;3:*.32x=38;5;213:*.cdi=38;5;213:*.fm2=38;5;213:*.rom=38;5;213:*.sav=38;5;213:*.st=38;5;213:*.a00=38;5;213:*.a52=38;5;213:*.A64=38;5;213:*.a64=38;5;213:*.a78=38;5;213:*.adf=38;5;213:*.atr=38;5;213:*.gb=38;5;213:*.gba=38;5;213:*.gbc=38;5;213:*.gel=38;5;213:*.gg=38;5;213:*.ggl=38;5;213:*.ipk=38;5;213:*.j64=38;5;213:*.nds=38;5;213:*.nes=38;5;213:*.sms=38;5;213:*.8xp=38;5;121:*.8eu=38;5;121:*.82p=38;5;121:*.83p=38;5;121:*.8xe=38;5;121:*.stl=38;5;216:*.dwg=38;5;216:*.ply=38;5;216:*.wrl=38;5;216:*.vert=38;5;136:*.comp=38;5;136:*.frag=38;5;136:*.spv=38;5;217:*.wgsl=38;5;97:*.xib=38;5;208:*.iml=38;5;166:*.DS_Store=38;5;239:*.localized=38;5;239:*.CFUserTextEncoding=38;5;239:*CodeResources=38;5;239:*PkgInfo=38;5;239:*.nib=38;5;57:*.car=38;5;57:*.dylib=38;5;241:*.entitlements=1:*.pbxproj=1:*.strings=1:*.storyboard=38;5;196:*.xcconfig=1:*.xcsettings=1:*.xcuserstate=1:*.xcworkspacedata=1:*.pot=38;5;7:*.pcb=38;5;7:*.mm=38;5;7:*.gbr=38;5;7:*.scm=38;5;7:*.xcf=38;5;7:*.spl=38;5;7:*.Rproj=38;5;11:*.sis=38;5;7:*.1p=38;5;7:*.3p=38;5;7:*.cnc=38;5;7:*.def=38;5;7:*.ex=38;5;7:*.example=38;5;7:*.feature=38;5;7:*.ger=38;5;7:*.ics=38;5;7:*.map=38;5;7:*.mf=38;5;7:*.mfasl=38;5;7:*.mi=38;5;7:*.mtx=38;5;7:*.pc=38;5;7:*.pi=38;5;7:*.plt=38;5;7:*.rdf=38;5;7:*.ru=38;5;7:*.sch=38;5;7:*.sty=38;5;7:*.sug=38;5;7:*.tdy=38;5;7:*.tfm=38;5;7:*.tfnt=38;5;7:*.tg=38;5;7:*.vcard=38;5;7:*.vcf=38;5;7:*.xln=38;5;7:" - }, - "text_colours": { - "nerdtree_syntax_dark": { - "ext_exact": { - ".ai": "#F16529", - ".awk": "#FFFFFF", - ".bash": "#834F79", - ".bat": "#FFFFFF", - ".bmp": "#3AFFDB", - ".c": "#689FB6", - ".c++": "#689FB6", - ".cc": "#689FB6", - ".clj": "#8FAA54", - ".cljc": "#8FAA54", - ".cljs": "#8FAA54", - ".coffee": "#905532", - ".conf": "#FFFFFF", - ".cp": "#689FB6", - ".cpp": "#689FB6", - ".cs": "#689FB6", - ".csh": "#FFFFFF", - ".css": "#689FB6", - ".cxx": "#689FB6", - ".d": "#AE403F", - ".dart": "#689FB6", - ".db": "#689FB6", - ".diff": "#FFFFFF", - ".dump": "#689FB6", - ".edn": "#8FAA54", - ".eex": "#834F79", - ".ejs": "#F09F17", - ".elm": "#FFFFFF", - ".erb": "#AE403F", - ".erl": "#834F79", - ".ex": "#834F79", - ".exs": "#834F79", - ".f#": "#44788E", - ".fish": "#8FAA54", - ".fs": "#689FB6", - ".fsi": "#689FB6", - ".fsscript": "#689FB6", - ".fsx": "#689FB6", - ".gif": "#3AFFDB", - ".go": "#F5C06F", - ".h": "#689FB6", - ".hbs": "#D4843E", - ".hh": "#689FB6", - ".hpp": "#689FB6", - ".hrl": "#CB6F6F", - ".hs": "#F5C06F", - ".htm": "#F16529", - ".html": "#F16529", - ".hxx": "#689FB6", - ".ico": "#3AFFDB", - ".ini": "#FFFFFF", - ".java": "#834F79", - ".jl": "#9558B2", - ".jpeg": "#3AFFDB", - ".jpg": "#3AFFDB", - ".js": "#F5C06F", - ".json": "#F5C06F", - ".jsx": "#689FB6", - ".ksh": "#FFFFFF", - ".leex": "#FFFFFF", - ".less": "#44788E", - ".lhs": "#F5C06F", - ".lua": "#834F79", - ".markdown": "#F09F17", - ".md": "#F09F17", - ".mdx": "#F09F17", - ".mjs": "#F5C06F", - ".ml": "#F09F17", - ".mli": "#F09F17", - ".mustache": "#D4843E", - ".php": "#834F79", - ".pl": "#689FB6", - ".pm": "#689FB6", - ".png": "#3AFFDB", - ".pp": "#FFFFFF", - ".ps1": "#689FB6", - ".psb": "#44788E", - ".psd": "#44788E", - ".py": "#F09F17", - ".pyc": "#F09F17", - ".pyd": "#F09F17", - ".pyo": "#F09F17", - ".rb": "#AE403F", - ".rlib": "#F16529", - ".rmd": "#F09F17", - ".rs": "#F16529", - ".rss": "#F16529", - ".sass": "#CB6F6F", - ".scala": "#AE403F", - ".scss": "#CB6F6F", - ".sh": "#834F79", - ".slim": "#D4843E", - ".sln": "#834F79", - ".sql": "#44788E", - ".styl": "#8FAA54", - ".suo": "#834F79", - ".swift": "#D4843E", - ".t": "#689FB6", - ".toml": "#FFFFFF", - ".ts": "#689FB6", - ".tsx": "#689FB6", - ".twig": "#8FAA54", - ".vim": "#8FAA54", - ".vue": "#42B883", - ".webp": "#3AFFDB", - ".xcplayground": "#D4843E", - ".xul": "#F16529", - ".yaml": "#FFFFFF", - ".yml": "#FFFFFF", - ".zsh": "#FFFFFF" - }, - "name_exact": { - ".bashprofile": "#FFFFFF", - ".bashrc": "#FFFFFF", - ".ds_store": "#FFFFFF", - ".gitconfig": "#FFFFFF", - ".gitignore": "#FFFFFF", - ".gitlab-ci.yml": "#D4843E", - ".gvimrc": "#8FAA54", - ".vimrc": "#8FAA54", - ".zshrc": "#FFFFFF", - "_gvimrc": "#8FAA54", - "_vimrc": "#8FAA54", - "cmakelists.txt": "#FFFFFF", - "docker-compose.yml": "#689FB6", - "dockerfile": "#689FB6", - "dropbox": "#689FB6", - "favicon.ico": "#F09F17", - "gruntfile.coffee": "#F09F17", - "gruntfile.js": "#F09F17", - "gruntfile.ls": "#F09F17", - "gulpfile.coffee": "#CB6F6F", - "gulpfile.js": "#CB6F6F", - "gulpfile.ls": "#CB6F6F", - "license": "#FFFFFF", - "makefile": "#FFFFFF", - "mix.lock": "#FFFFFF", - "node_modules": "#8FAA54", - "procfile": "#834F79", - "react.jsx": "#689FB6", - "typescript.jsx": "#689FB6", - "typescript.tsx": "#689FB6" - }, - "name_glob": { - ".*angular.*.js": "#AE403F", - ".*backbone.*.js": "#44788E", - ".*jquery.*.js": "#689FB6", - ".*materialize.*.css": "#EE6E73", - ".*materialize.*.js": "#EE6E73", - ".*mootools.*.js": "#FFFFFF", - ".*require.*.js": "#689FB6", - ".*vimrc.*": "#8FAA54", - "Vagrantfile": "#689FB6" - } - }, - "nerdtree_syntax_light": { - "ext_exact": { - ".ai": "#0e9ad6", - ".awk": "#000000", - ".bash": "#7cb086", - ".bat": "#000000", - ".bmp": "#c50024", - ".c": "#976049", - ".c++": "#976049", - ".cc": "#976049", - ".clj": "#7055ab", - ".cljc": "#7055ab", - ".cljs": "#7055ab", - ".coffee": "#6faacd", - ".conf": "#000000", - ".cp": "#976049", - ".cpp": "#976049", - ".cs": "#976049", - ".csh": "#000000", - ".css": "#976049", - ".cxx": "#976049", - ".d": "#51bfc0", - ".dart": "#976049", - ".db": "#976049", - ".diff": "#000000", - ".dump": "#976049", - ".edn": "#7055ab", - ".eex": "#7cb086", - ".ejs": "#0f60e8", - ".elm": "#000000", - ".erb": "#51bfc0", - ".erl": "#7cb086", - ".ex": "#7cb086", - ".exs": "#7cb086", - ".f#": "#bb8771", - ".fish": "#7055ab", - ".fs": "#976049", - ".fsi": "#976049", - ".fsscript": "#976049", - ".fsx": "#976049", - ".gif": "#c50024", - ".go": "#0a3f90", - ".h": "#976049", - ".hbs": "#2b7bc1", - ".hh": "#976049", - ".hpp": "#976049", - ".hrl": "#349090", - ".hs": "#0a3f90", - ".htm": "#0e9ad6", - ".html": "#0e9ad6", - ".hxx": "#976049", - ".ico": "#c50024", - ".ini": "#000000", - ".java": "#7cb086", - ".jl": "#6aa74d", - ".jpeg": "#c50024", - ".jpg": "#c50024", - ".js": "#0a3f90", - ".json": "#0a3f90", - ".jsx": "#976049", - ".ksh": "#000000", - ".leex": "#000000", - ".less": "#bb8771", - ".lhs": "#0a3f90", - ".lua": "#7cb086", - ".markdown": "#0f60e8", - ".md": "#0f60e8", - ".mdx": "#0f60e8", - ".mjs": "#0a3f90", - ".ml": "#0f60e8", - ".mli": "#0f60e8", - ".mustache": "#2b7bc1", - ".php": "#7cb086", - ".pl": "#976049", - ".pm": "#976049", - ".png": "#c50024", - ".pp": "#000000", - ".ps1": "#976049", - ".psb": "#bb8771", - ".psd": "#bb8771", - ".py": "#0f60e8", - ".pyc": "#0f60e8", - ".pyd": "#0f60e8", - ".pyo": "#0f60e8", - ".rb": "#51bfc0", - ".rlib": "#0e9ad6", - ".rmd": "#0f60e8", - ".rs": "#0e9ad6", - ".rss": "#0e9ad6", - ".sass": "#349090", - ".scala": "#51bfc0", - ".scss": "#349090", - ".sh": "#7cb086", - ".slim": "#2b7bc1", - ".sln": "#7cb086", - ".sql": "#bb8771", - ".styl": "#7055ab", - ".suo": "#7cb086", - ".swift": "#2b7bc1", - ".t": "#976049", - ".toml": "#000000", - ".ts": "#976049", - ".tsx": "#976049", - ".twig": "#7055ab", - ".vim": "#7055ab", - ".vue": "#bd477c", - ".webp": "#c50024", - ".xcplayground": "#2b7bc1", - ".xul": "#0e9ad6", - ".yaml": "#000000", - ".yml": "#000000", - ".zsh": "#000000" - }, - "name_exact": { - ".bashprofile": "#000000", - ".bashrc": "#000000", - ".ds_store": "#000000", - ".gitconfig": "#000000", - ".gitignore": "#000000", - ".gitlab-ci.yml": "#2b7bc1", - ".gvimrc": "#7055ab", - ".vimrc": "#7055ab", - ".zshrc": "#000000", - "_gvimrc": "#7055ab", - "_vimrc": "#7055ab", - "cmakelists.txt": "#000000", - "docker-compose.yml": "#976049", - "dockerfile": "#976049", - "dropbox": "#976049", - "favicon.ico": "#0f60e8", - "gruntfile.coffee": "#0f60e8", - "gruntfile.js": "#0f60e8", - "gruntfile.ls": "#0f60e8", - "gulpfile.coffee": "#349090", - "gulpfile.js": "#349090", - "gulpfile.ls": "#349090", - "license": "#000000", - "makefile": "#000000", - "mix.lock": "#000000", - "node_modules": "#7055ab", - "procfile": "#7cb086", - "react.jsx": "#976049", - "typescript.jsx": "#976049", - "typescript.tsx": "#976049" - }, - "name_glob": { - ".*angular.*.js": "#51bfc0", - ".*backbone.*.js": "#bb8771", - ".*jquery.*.js": "#976049", - ".*materialize.*.css": "#11918c", - ".*materialize.*.js": "#11918c", - ".*mootools.*.js": "#000000", - ".*require.*.js": "#976049", - ".*vimrc.*": "#7055ab", - "Vagrantfile": "#976049" - } - } - } -} \ No newline at end of file diff --git a/config/neovim/store/lazy-plugins/chadtree/assets/README.md b/config/neovim/store/lazy-plugins/chadtree/assets/README.md deleted file mode 100644 index 044d273c..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/assets/README.md +++ /dev/null @@ -1 +0,0 @@ -# Used to Generate Artifacts \ No newline at end of file diff --git a/config/neovim/store/lazy-plugins/chadtree/assets/aliases.yml b/config/neovim/store/lazy-plugins/chadtree/assets/aliases.yml deleted file mode 100644 index c6105699..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/assets/aliases.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -icon_colours: {} -text_colours: - ext_exact: {} - name_exact: {} - name_glob: {} diff --git a/config/neovim/store/lazy-plugins/chadtree/assets/icon_base.yml b/config/neovim/store/lazy-plugins/chadtree/assets/icon_base.yml deleted file mode 100644 index e90c764f..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/assets/icon_base.yml +++ /dev/null @@ -1,36 +0,0 @@ ---- -ascii: &ascii - default_icon: ● - ext_exact: {} - folder: - closed: ▶ - open: ▼ - link: - broken: -/-> - normal: -> - name_exact: {} - name_glob: {} - status: - active: ">" - inactive: " " - not_selected: " " - selected: "*" - -ascii_hollow: - <<: *ascii - default_icon: ○ - folder: - closed: ▷ - open: ▽ - -devicons: &devicons - link: - broken: 󰌸 - normal: 󰲔 - status: - active: ▶ - inactive: " " - not_selected: " " - selected: ✸ - -emoji: *devicons diff --git a/config/neovim/store/lazy-plugins/chadtree/chad_types.py b/config/neovim/store/lazy-plugins/chadtree/chad_types.py deleted file mode 100644 index 9113fb20..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chad_types.py +++ /dev/null @@ -1,146 +0,0 @@ -from dataclasses import dataclass -from enum import Enum, auto -from pathlib import Path -from typing import Mapping - -TOP_LEVEL = Path(__file__).resolve(strict=True).parent -ASSETS = TOP_LEVEL / "assets" -ARTIFACT = TOP_LEVEL / "artifacts" / "artifact.json" - - -""" -Icons -""" - - -Icon = str - - -@dataclass(frozen=True) -class _FolderIcons: - open: Icon - closed: Icon - - -@dataclass(frozen=True) -class _LinkIcons: - normal: Icon - broken: Icon - - -@dataclass(frozen=True) -class _StatusIcons: - active: Icon - inactive: Icon - selected: Icon - not_selected: Icon - - -@dataclass(frozen=True) -class IconGlyphs: - default_icon: Icon - folder: _FolderIcons - link: _LinkIcons - status: _StatusIcons - - ext_exact: Mapping[str, Icon] - name_exact: Mapping[str, Icon] - name_glob: Mapping[str, Icon] - - -@dataclass(frozen=True) -class IconGlyphSet: - ascii_hollow: IconGlyphs - ascii: IconGlyphs - devicons: IconGlyphs - emoji: IconGlyphs - - -class IconGlyphSetEnum(Enum): - ascii_hollow = auto() - ascii = auto() - devicons = auto() - emoji = auto() - - -""" -Icon Colours -""" - - -Hex = str -IconColours = Mapping[str, Hex] - - -@dataclass(frozen=True) -class IconColourSet: - github: IconColours - - -class IconColourSetEnum(Enum): - github = auto() - none = auto() - - -""" -LS Colours -""" - - -LS_COLOR = str - - -@dataclass(frozen=True) -class LSColourSet: - solarized_dark_256: LS_COLOR - solarized_dark: LS_COLOR - solarized_light: LS_COLOR - solarized_universal: LS_COLOR - nord: LS_COLOR - trapdoor: LS_COLOR - - -class LSColoursEnum(Enum): - env = auto() - solarized_dark_256 = auto() - solarized_dark = auto() - solarized_light = auto() - solarized_universal = auto() - nord = auto() - trapdoor = auto() - - -""" -Text Colours -""" - - -@dataclass(frozen=True) -class TextColours: - ext_exact: Mapping[str, Hex] - name_exact: Mapping[str, Hex] - name_glob: Mapping[str, Hex] - - -@dataclass(frozen=True) -class TextColourSet: - nerdtree_syntax_light: TextColours - nerdtree_syntax_dark: TextColours - - -class TextColourSetEnum(Enum): - nerdtree_syntax_light = auto() - nerdtree_syntax_dark = auto() - - -""" -Artifact -""" - - -@dataclass(frozen=True) -class Artifact: - icons: IconGlyphSet - ls_colours: LSColourSet - icon_colours: IconColourSet - text_colours: TextColourSet diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/__main__.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/__main__.py deleted file mode 100644 index 5c2399b1..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/__main__.py +++ /dev/null @@ -1,158 +0,0 @@ -from argparse import ArgumentParser, Namespace -from asyncio import run as arun -from concurrent.futures import ThreadPoolExecutor -from contextlib import nullcontext, redirect_stderr, redirect_stdout -from io import StringIO -from pathlib import Path, PurePath -from subprocess import DEVNULL, STDOUT, CalledProcessError, run -from sys import ( - executable, - exit, - getswitchinterval, - setswitchinterval, - stderr, - version_info, -) -from textwrap import dedent -from typing import Any, Union -from webbrowser import open as open_w - -from .consts import GIL_SWITCH, IS_WIN, MIGRATION_URI, REQUIREMENTS, RT_DIR, RT_PY - -setswitchinterval(min(getswitchinterval(), GIL_SWITCH)) - -try: - from typing import Literal - - if version_info < (3, 8, 2): - raise ImportError() -except ImportError: - msg = "For python < 3.8.2 please install using the branch -- legacy" - print(msg, file=stderr) - open_w(MIGRATION_URI) - exit(1) - - -def _socket(arg: str) -> Any: - if arg.startswith("localhost:"): - host, _, port = arg.rpartition(":") - return host, int(port) - else: - return PurePath(arg) - - -def parse_args() -> Namespace: - parser = ArgumentParser() - - sub_parsers = parser.add_subparsers(dest="command", required=True) - - with nullcontext(sub_parsers.add_parser("run")) as p: - p.add_argument("--ppid", type=int) - p.add_argument("--socket", required=True, type=_socket) - p.add_argument("--xdg") - - with nullcontext(sub_parsers.add_parser("deps")) as p: - p.add_argument("--nvim", action="store_true") - p.add_argument("--xdg", nargs="?") - - return parser.parse_args() - - -args = parse_args() -command: Union[Literal["deps"], Literal["run"]] = args.command - -_XDG = Path(args.xdg) if args.xdg is not None else None - -_RT_DIR = _XDG / "chadrt" if _XDG else RT_DIR -_RT_PY = ( - (_RT_DIR / "Scripts" / "python.exe" if IS_WIN else _RT_DIR / "bin" / "python3") - if _XDG - else RT_PY -) -_LOCK_FILE = _RT_DIR / "requirements.lock" -_EXEC_PATH = Path(executable) -_EXEC_PATH = _EXEC_PATH.parent.resolve(strict=True) / _EXEC_PATH.name -_REQ = REQUIREMENTS.read_text() - -_IN_VENV = True - - -if command == "deps": - assert not _IN_VENV - - io_out = StringIO() - try: - from venv import EnvBuilder - - print("...", flush=True) - with redirect_stdout(io_out), redirect_stderr(io_out): - EnvBuilder( - system_site_packages=False, - with_pip=True, - upgrade=True, - symlinks=not IS_WIN, - clear=True, - ).create(_RT_DIR) - except (ImportError, CalledProcessError): - msg = "Please install python3-venv separately. (apt, yum, apk, etc)" - print(msg, io_out.getvalue(), file=stderr) - exit(1) - else: - proc = run( - ( - _RT_PY, - "-m", - "pip", - "install", - "--upgrade", - "--requirement", - REQUIREMENTS, - ), - stdin=DEVNULL, - stderr=STDOUT, - ) - if proc.returncode: - print("Installation failed, check :message", file=stderr) - exit(proc.returncode) - else: - _LOCK_FILE.write_text(_REQ) - msg = """ - --- - You can now use :CHADopen - """ - print(dedent(msg), file=stderr) - -elif command == "run": - try: - lock = _LOCK_FILE.read_text() - except Exception: - lock = "" - try: - if not _IN_VENV: - raise ImportError() - elif False: - raise ImportError() - else: - import pynvim_pp - import yaml - - from .client import init - except ImportError as e: - print(e) - msg = """ - Please update dependencies using :CHADdeps - - - - - Dependencies will be installed privately inside `chadtree/.vars` - `rm -rf chadtree/` will cleanly remove everything - """ - msg = dedent(msg) - print(msg, end="", file=stderr) - exit(1) - else: - with ThreadPoolExecutor() as th: - arun(init(args.socket, ppid=args.ppid, th=th)) - - -else: - assert False diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/__main__.py.orig b/config/neovim/store/lazy-plugins/chadtree/chadtree/__main__.py.orig deleted file mode 100644 index aede27b6..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/__main__.py.orig +++ /dev/null @@ -1,158 +0,0 @@ -from argparse import ArgumentParser, Namespace -from asyncio import run as arun -from concurrent.futures import ThreadPoolExecutor -from contextlib import nullcontext, redirect_stderr, redirect_stdout -from io import StringIO -from pathlib import Path, PurePath -from subprocess import DEVNULL, STDOUT, CalledProcessError, run -from sys import ( - executable, - exit, - getswitchinterval, - setswitchinterval, - stderr, - version_info, -) -from textwrap import dedent -from typing import Any, Union -from webbrowser import open as open_w - -from .consts import GIL_SWITCH, IS_WIN, MIGRATION_URI, REQUIREMENTS, RT_DIR, RT_PY - -setswitchinterval(min(getswitchinterval(), GIL_SWITCH)) - -try: - from typing import Literal - - if version_info < (3, 8, 2): - raise ImportError() -except ImportError: - msg = "For python < 3.8.2 please install using the branch -- legacy" - print(msg, file=stderr) - open_w(MIGRATION_URI) - exit(1) - - -def _socket(arg: str) -> Any: - if arg.startswith("localhost:"): - host, _, port = arg.rpartition(":") - return host, int(port) - else: - return PurePath(arg) - - -def parse_args() -> Namespace: - parser = ArgumentParser() - - sub_parsers = parser.add_subparsers(dest="command", required=True) - - with nullcontext(sub_parsers.add_parser("run")) as p: - p.add_argument("--ppid", type=int) - p.add_argument("--socket", required=True, type=_socket) - p.add_argument("--xdg") - - with nullcontext(sub_parsers.add_parser("deps")) as p: - p.add_argument("--nvim", action="store_true") - p.add_argument("--xdg", nargs="?") - - return parser.parse_args() - - -args = parse_args() -command: Union[Literal["deps"], Literal["run"]] = args.command - -_XDG = Path(args.xdg) if args.xdg is not None else None - -_RT_DIR = _XDG / "chadrt" if _XDG else RT_DIR -_RT_PY = ( - (_RT_DIR / "Scripts" / "python.exe" if IS_WIN else _RT_DIR / "bin" / "python3") - if _XDG - else RT_PY -) -_LOCK_FILE = _RT_DIR / "requirements.lock" -_EXEC_PATH = Path(executable) -_EXEC_PATH = _EXEC_PATH.parent.resolve(strict=True) / _EXEC_PATH.name -_REQ = REQUIREMENTS.read_text() - -_IN_VENV = _RT_PY == _EXEC_PATH - - -if command == "deps": - assert not _IN_VENV - - io_out = StringIO() - try: - from venv import EnvBuilder - - print("...", flush=True) - with redirect_stdout(io_out), redirect_stderr(io_out): - EnvBuilder( - system_site_packages=False, - with_pip=True, - upgrade=True, - symlinks=not IS_WIN, - clear=True, - ).create(_RT_DIR) - except (ImportError, CalledProcessError): - msg = "Please install python3-venv separately. (apt, yum, apk, etc)" - print(msg, io_out.getvalue(), file=stderr) - exit(1) - else: - proc = run( - ( - _RT_PY, - "-m", - "pip", - "install", - "--upgrade", - "--requirement", - REQUIREMENTS, - ), - stdin=DEVNULL, - stderr=STDOUT, - ) - if proc.returncode: - print("Installation failed, check :message", file=stderr) - exit(proc.returncode) - else: - _LOCK_FILE.write_text(_REQ) - msg = """ - --- - You can now use :CHADopen - """ - print(dedent(msg), file=stderr) - -elif command == "run": - try: - lock = _LOCK_FILE.read_text() - except Exception: - lock = "" - try: - if not _IN_VENV: - raise ImportError() - elif lock != _REQ: - raise ImportError() - else: - import pynvim_pp - import yaml - - from .client import init - except ImportError as e: - print(e) - msg = """ - Please update dependencies using :CHADdeps - - - - - Dependencies will be installed privately inside `chadtree/.vars` - `rm -rf chadtree/` will cleanly remove everything - """ - msg = dedent(msg) - print(msg, end="", file=stderr) - exit(1) - else: - with ThreadPoolExecutor() as th: - arun(init(args.socket, ppid=args.ppid, th=th)) - - -else: - assert False diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/_registry.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/_registry.py deleted file mode 100644 index 2d1f4873..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/_registry.py +++ /dev/null @@ -1,54 +0,0 @@ -from .transitions import ( - autocmds, - click, - collapse, - copy_name, - cut_copy, - delete, - filter, - focus, - help, - link, - marks, - new, - noop, - open_system, - quit, - refresh, - rename, - resize, - schedule_update, - selection, - stat, - toggle_exec, - toggle_open, - toggles, -) - -assert autocmds -assert click -assert collapse -assert copy_name -assert cut_copy -assert delete -assert filter -assert focus -assert help -assert link -assert marks -assert new -assert noop -assert open_system -assert quit -assert refresh -assert refresh -assert rename -assert resize -assert schedule_update -assert selection -assert stat -assert toggle_exec -assert toggle_open -assert toggles - -____ = None diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/client.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/client.py deleted file mode 100644 index b5086908..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/client.py +++ /dev/null @@ -1,217 +0,0 @@ -from asyncio import ( - FIRST_COMPLETED, - AbstractEventLoop, - Event, - Lock, - Task, - create_task, - gather, - get_running_loop, - wait, - wrap_future, -) -from concurrent.futures import Future, ThreadPoolExecutor -from contextlib import AbstractAsyncContextManager, suppress -from functools import wraps -from logging import DEBUG as DEBUG_LVL -from logging import INFO -from multiprocessing import cpu_count -from pathlib import Path -from platform import uname -from string import Template -from sys import executable, exit -from textwrap import dedent -from time import monotonic -from typing import Any, Optional, Sequence, cast - -from pynvim_pp.highlight import highlight -from pynvim_pp.logging import log, suppress_and_log -from pynvim_pp.nvim import Nvim, conn -from pynvim_pp.rpc_types import ( - Method, - MsgType, - NvimError, - RPCallable, - RPClient, - ServerAddr, -) -from pynvim_pp.types import NoneType -from std2.asyncio import cancel -from std2.cell import RefCell -from std2.contextlib import nullacontext -from std2.pickle.types import DecodeError -from std2.platform import OS, os -from std2.sched import aticker -from std2.sys import autodie - -from ._registry import ____ -from .consts import DEBUG, RENDER_RETRIES -from .registry import autocmd, dequeue_event, enqueue_event, rpc -from .settings.load import initial as initial_settings -from .settings.localization import init as init_locale -from .state.load import initial as initial_state -from .state.types import State -from .timeit import timeit -from .transitions.autocmds import setup -from .transitions.redraw import redraw -from .transitions.schedule_update import scheduled_update -from .transitions.types import Stage - -assert ____ or True - -_CB = RPCallable[Optional[Stage]] - - -def _autodie(ppid: int) -> AbstractAsyncContextManager: - if os is OS.windows: - return nullacontext(None) - else: - return autodie(ppid) - - -async def _profile(t1: float) -> None: - t2 = monotonic() - info = uname() - msg = f""" - First msg {int((t2 - t1) * 1000)}ms - Arch {info.machine} - Processor {info.processor} - Cores {cpu_count()} - System {info.system} - Version {info.version} - Python {Path(executable).resolve(strict=True)} - """ - await Nvim.write(dedent(msg)) - - -async def _sched(ref: RefCell[State]) -> None: - await enqueue_event(False, method=scheduled_update.method, params=(True,)) - - async for _ in aticker(ref.val.settings.polling_rate, immediately=False): - if ref.val.vim_focus: - await enqueue_event(False, method=scheduled_update.method) - - -def _trans(handler: _CB) -> _CB: - @wraps(handler) - async def f(*params: Any) -> None: - await enqueue_event(True, method=handler.method, params=params) - - return cast(_CB, f) - - -async def _default(_: MsgType, method: Method, params: Sequence[Any]) -> None: - await enqueue_event(True, method=method, params=params) - - -async def _go(loop: AbstractEventLoop, client: RPClient) -> None: - th = ThreadPoolExecutor() - atomic, handlers = rpc.drain() - try: - settings = await initial_settings(handlers.values()) - except DecodeError as e: - tpl = """ - Some options may have changed. - See help doc on Github under [docs/CONFIGURATION.md] - - - ${e} - """ - ms = Template(dedent(tpl)).substitute(e=e) - await Nvim.write(ms, error=True) - exit(1) - else: - hl = highlight(*settings.view.hl_context.groups) - await (atomic + autocmd.drain() + hl).commit(NoneType) - state = RefCell(await initial_state(settings, th=th)) - - init_locale(settings.lang) - with suppress_and_log(): - await setup(settings) - - for f in handlers.values(): - ff = _trans(f) - client.register(ff) - - staged = RefCell[Optional[Stage]](None) - event = Event() - lock = Lock() - - async def step(method: Method, params: Sequence[Any]) -> None: - if handler := cast(Optional[_CB], handlers.get(method)): - with suppress_and_log(): - async with lock: - if stage := await handler(state.val, *params): - state.val = stage.state - staged.val = stage - event.set() - else: - assert False, (method, params) - - async def c1() -> None: - transcient: Optional[Task] = None - get: Optional[Task] = None - try: - while True: - with suppress_and_log(): - get = create_task(dequeue_event()) - if transcient: - await wait((transcient, get), return_when=FIRST_COMPLETED) - if not transcient.done(): - with timeit("transcient"): - await cancel(transcient) - transcient = None - - sync, method, params = await get - task = step(method, params=params) - if sync: - with timeit(method): - await task - else: - transcient = create_task(task) - finally: - await cancel( - *(get or loop.create_future(), transcient or loop.create_future()) - ) - - async def c2() -> None: - t1, has_drawn = monotonic(), False - - while True: - await event.wait() - with suppress_and_log(): - try: - if stage := staged.val: - state = stage.state - - for _ in range(RENDER_RETRIES - 1): - with suppress(NvimError): - await redraw(state, focus=stage.focus) - break - else: - try: - await redraw(state, focus=stage.focus) - except NvimError as e: - log.warn("%s", e) - - if settings.profiling and not has_drawn: - has_drawn = True - await _profile(t1=t1) - finally: - event.clear() - - await gather(c1(), c2(), _sched(state)) - - -async def init(socket: ServerAddr, ppid: int, th: ThreadPoolExecutor) -> None: - loop = get_running_loop() - loop.set_default_executor(th) - log.setLevel(DEBUG_LVL if DEBUG else INFO) - - die: Future = Future() - - async def cont() -> None: - async with conn(die, socket=socket, default=_default) as client: - await _go(loop, client=client) - - await gather(wrap_future(die), cont()) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/consts.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/consts.py deleted file mode 100644 index 1fff3629..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/consts.py +++ /dev/null @@ -1,65 +0,0 @@ -from os import environ, name -from pathlib import Path - -from chad_types import TOP_LEVEL - -GIL_SWITCH = 1 / 1000 -IS_WIN = name == "nt" -REQUIREMENTS = TOP_LEVEL / "requirements.txt" - -DEBUG = "CHADTREE_DEBUG" in environ - -BATCH_FACTOR = 88 -RENDER_RETRIES = 3 - -FM_FILETYPE = "CHADTree" -FM_HL_PREFIX = "chadtree" -URI_SCHEME = FM_FILETYPE.casefold() - -DEFAULT_LANG = "en" -LANG_ROOT = TOP_LEVEL / "locale" -CONFIG_YML = TOP_LEVEL / "config" / "defaults.yml" -SETTINGS_VAR = "chadtree_settings" - -""" -STORAGE -""" - -_VARS = Path.home() / ".cache/chadtree/vars" -RT_DIR = _VARS / "runtime" -RT_PY = RT_DIR / "Scripts" / "python.exe" if IS_WIN else RT_DIR / "bin" / "python3" -SESSION_DIR = _VARS / "sessions" - - -""" -Docs -""" - - -_DOCS_URI_BASE = "https://github.com/ms-jpq/chadtree/blob/chad/docs" -_DOCS_DIR = TOP_LEVEL / "docs" - - -_README_md = "README.md" -README_MD = _DOCS_DIR / _README_md -README_URI = f"{_DOCS_URI_BASE}" - -_FEATURES_md = "FEATURES.md" -FEATURES_MD = _DOCS_DIR / _FEATURES_md -FEATURES_URI = f"{_DOCS_URI_BASE}/{_FEATURES_md}" - -_KEYBIND_md = "KEYBIND.md" -KEYBIND_MD = _DOCS_DIR / _KEYBIND_md -KEYBIND_URI = f"{_DOCS_URI_BASE}/{_KEYBIND_md}" - -_CONFIGURATION_md = "CONFIGURATION.md" -CONFIGURATION_MD = _DOCS_DIR / _CONFIGURATION_md -CONFIGURATION_URI = f"{_DOCS_URI_BASE}/{_CONFIGURATION_md}" - -_THEME_md = "THEME.md" -THEME_MD = _DOCS_DIR / _THEME_md -THEME_URI = f"{_DOCS_URI_BASE}/{_THEME_md}" - -_MIGRATION_md = "MIGRATION.md" -MIGRATION_MD = _DOCS_DIR / _MIGRATION_md -MIGRATION_URI = f"{_DOCS_URI_BASE}/{_MIGRATION_md}" diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/fs/cartographer.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/fs/cartographer.py deleted file mode 100644 index 06734879..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/fs/cartographer.py +++ /dev/null @@ -1,230 +0,0 @@ -from asyncio import sleep -from concurrent.futures import ThreadPoolExecutor -from contextlib import suppress -from fnmatch import fnmatch -from os import DirEntry, scandir, stat, stat_result -from os.path import normcase -from pathlib import Path, PurePath -from stat import ( - S_IFDOOR, - S_ISBLK, - S_ISCHR, - S_ISDIR, - S_ISFIFO, - S_ISGID, - S_ISLNK, - S_ISREG, - S_ISSOCK, - S_ISUID, - S_ISVTX, - S_IWOTH, - S_IXUSR, -) -from typing import ( - AbstractSet, - Iterator, - Mapping, - MutableMapping, - Optional, - Tuple, - Union, - cast, -) - -from std2.itertools import batched -from std2.pathlib import is_relative_to - -from ..consts import BATCH_FACTOR -from ..state.executor import AsyncExecutor -from ..state.types import Index -from ..timeit import timeit -from .nt import is_junction -from .types import Ignored, Mode, Node - -_FILE_MODES: Mapping[int, Mode] = { - S_IXUSR: Mode.executable, - S_IFDOOR: Mode.door, - S_ISGID: Mode.set_gid, - S_ISUID: Mode.set_uid, - S_ISVTX: Mode.sticky, - S_IWOTH: Mode.other_writable, - S_IWOTH | S_ISVTX: Mode.sticky_other_writable, -} - - -def _iter( - dirent: Union[PurePath, DirEntry[str]], follow: bool, index: Index, lv: int = 0 -) -> Iterator[PurePath]: - if not lv: - yield PurePath(dirent) - with suppress(NotADirectoryError, FileNotFoundError, PermissionError): - with scandir(dirent) as dirents: - for child in dirents: - yield (path := PurePath(child)) - if child.is_dir(follow_symlinks=follow) and path in index: - yield from _iter(child, follow=follow, index=index, lv=lv + 1) - - -def _fs_modes(stat: stat_result) -> Iterator[Mode]: - st_mode = stat.st_mode - if S_ISDIR(st_mode): - yield Mode.folder - if S_ISREG(st_mode): - yield Mode.file - if S_ISFIFO(st_mode): - yield Mode.pipe - if S_ISSOCK(st_mode): - yield Mode.socket - if S_ISCHR(st_mode): - yield Mode.char_device - if S_ISBLK(st_mode): - yield Mode.block_device - if stat.st_nlink > 1: - yield Mode.multi_hardlink - for bit, mode in _FILE_MODES.items(): - if bit and st_mode & bit == bit: - yield mode - - -def _fs_stat(path: PurePath) -> Tuple[AbstractSet[Mode], Optional[PurePath]]: - try: - info = stat(path, follow_symlinks=False) - except (FileNotFoundError, PermissionError): - return {Mode.orphan_link}, None - else: - if S_ISLNK(info.st_mode) or is_junction(info): - try: - pointed = Path(path).resolve(strict=True) - link_info = stat(pointed, follow_symlinks=False) - except (FileNotFoundError, NotADirectoryError, RuntimeError): - return {Mode.orphan_link}, None - else: - mode = {*_fs_modes(link_info)} - return mode | {Mode.link}, pointed - else: - mode = {*_fs_modes(info)} - return mode, None - - -def _fs_node(path: PurePath) -> Node: - mode, pointed = _fs_stat(path) - node = Node( - path=path, - mode=mode, - pointed=pointed, - children={}, - ) - return node - - -def _iter_single_nodes( - th: ThreadPoolExecutor, root: PurePath, follow: bool, index: Index -) -> Iterator[Node]: - with timeit("fs->_iter"): - dir_stream = batched(_iter(root, index=index, follow=follow), n=BATCH_FACTOR) - for seq in th.map(lambda x: tuple(map(_fs_node, x)), dir_stream): - yield from seq - - -async def _new( - th: ThreadPoolExecutor, root: PurePath, follow_links: bool, index: Index -) -> Node: - nodes: MutableMapping[PurePath, Node] = {} - - for idx, node in enumerate( - _iter_single_nodes(th, root=root, follow=follow_links, index=index), start=1 - ): - if idx % BATCH_FACTOR == 0: - await sleep(0) - nodes[node.path] = node - if parent := nodes.get(node.path.parent): - if parent == node: - continue - cast(MutableMapping[PurePath, Node], parent.children)[node.path] = node - - return nodes[root] - - -def _cross_over(root: PurePath, invalid: PurePath) -> bool: - return is_relative_to(root, invalid) or is_relative_to(invalid, root) - - -async def _update( - th: ThreadPoolExecutor, - root: Node, - follow_links: bool, - index: Index, - invalidate_dirs: AbstractSet[PurePath], -) -> Node: - if any((_cross_over(root.path, invalid=invalid) for invalid in invalidate_dirs)): - return await _new(th, root=root.path, follow_links=follow_links, index=index) - else: - children: MutableMapping[PurePath, Node] = {} - for path, node in root.children.items(): - new_node = await _update( - th, - root=node, - follow_links=follow_links, - index=index, - invalidate_dirs=invalidate_dirs, - ) - children[path] = new_node - return Node( - path=root.path, - mode=root.mode, - pointed=root.pointed, - children=children, - ) - - -async def new( - exec: AsyncExecutor, root: PurePath, follow_links: bool, index: Index -) -> Node: - with timeit("fs->new"): - return await exec.submit( - _new(exec.threadpool, root=root, follow_links=follow_links, index=index) - ) - - -async def update( - exec: AsyncExecutor, - root: Node, - *, - follow_links: bool, - index: Index, - invalidate_dirs: AbstractSet[PurePath], -) -> Node: - with timeit("fs->_update"): - try: - return await exec.submit( - _update( - exec.threadpool, - root=root, - follow_links=follow_links, - index=index, - invalidate_dirs=invalidate_dirs, - ) - ) - except FileNotFoundError: - return await new( - exec, follow_links=follow_links, root=root.path, index=index - ) - - -def user_ignored(node: Node, ignores: Ignored) -> bool: - return ( - node.path.name in ignores.name_exact - or any(fnmatch(node.path.name, pattern) for pattern in ignores.name_glob) - or any(fnmatch(normcase(node.path), pattern) for pattern in ignores.path_glob) - ) - - -def is_dir(node: Node) -> bool: - return Mode.folder in node.mode - - -def act_like_dir(node: Node, follow_links: bool) -> bool: - if node.pointed and not follow_links: - return False - else: - return is_dir(node) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/fs/nt.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/fs/nt.py deleted file mode 100644 index a5d687c6..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/fs/nt.py +++ /dev/null @@ -1,13 +0,0 @@ -import sys -from os import stat_result -from stat import S_ISDIR - -if sys.platform == "win32": - - def is_junction(st: stat_result) -> bool: - return bool(S_ISDIR(st.st_mode) and st.st_reparse_tag) - -else: - - def is_junction(st: stat_result) -> bool: - return False diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/fs/ops.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/fs/ops.py deleted file mode 100644 index 551b41d2..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/fs/ops.py +++ /dev/null @@ -1,242 +0,0 @@ -from asyncio import Lock, gather -from dataclasses import dataclass -from datetime import datetime -from functools import lru_cache -from itertools import chain -from os import makedirs, readlink -from os import remove as rm -from os import stat, symlink -from os.path import isdir, isfile, normpath -from pathlib import Path, PurePath -from shutil import copy2, copytree -from shutil import move as mv -from shutil import rmtree -from shutil import which as _which -from stat import S_ISDIR, S_ISLNK, filemode -from typing import AbstractSet, Iterable, Mapping, Optional - -from std2.asyncio import to_thread -from std2.stat import RW_R__R__, RWXR_XR_X - -from .nt import is_junction - -_FOLDER_MODE = RWXR_XR_X -_FILE_MODE = RW_R__R__ - - -def ancestors(*paths: PurePath) -> AbstractSet[PurePath]: - return {*chain.from_iterable(path.parents for path in paths)} - - -def unify_ancestors(paths: AbstractSet[PurePath]) -> AbstractSet[PurePath]: - return {p for p in paths if ancestors(p).isdisjoint(paths)} - - -@dataclass(frozen=True) -class FSstat: - permissions: str - user: str - group: str - date_mod: datetime - size: int - link: Optional[PurePath] - - -@lru_cache(maxsize=None) -def lock() -> Lock: - return Lock() - - -try: - from grp import getgrgid - from pwd import getpwuid - - def _get_username(uid: int) -> str: - try: - return getpwuid(uid).pw_name - except KeyError: - return str(uid) - - def _get_groupname(gid: int) -> str: - try: - return getgrgid(gid).gr_name - except KeyError: - return str(gid) - -except ImportError: - - def _get_username(uid: int) -> str: - return str(uid) - - def _get_groupname(gid: int) -> str: - return str(gid) - - -@lru_cache(maxsize=None) -def which(path: PurePath) -> Optional[PurePath]: - if bin := _which(path): - return PurePath(bin) - else: - return None - - -async def fs_stat(path: PurePath) -> FSstat: - def cont() -> FSstat: - stats = stat(path, follow_symlinks=False) - permissions = filemode(stats.st_mode) - user = _get_username(stats.st_uid) - group = _get_groupname(stats.st_gid) - date_mod = datetime.fromtimestamp(stats.st_mtime) - size = stats.st_size - try: - link = ( - readlink(path) if S_ISLNK(stats.st_mode) or is_junction(stats) else None - ) - except OSError: - plink = None - else: - plink = PurePath(link) if link else None - fs_stat = FSstat( - permissions=permissions, - user=user, - group=group, - date_mod=date_mod, - size=size, - link=plink, - ) - return fs_stat - - return await to_thread(cont) - - -async def resolve(path: PurePath, strict: bool) -> Path: - def cont() -> Path: - return Path(path).resolve(strict=strict) - - return await to_thread(cont) - - -async def exists(path: PurePath, follow: bool) -> bool: - def cont() -> bool: - try: - stat(path, follow_symlinks=follow) - except (OSError, ValueError): - return False - else: - return True - - return await to_thread(cont) - - -async def exists_many( - paths: Iterable[PurePath], follow: bool -) -> Mapping[PurePath, bool]: - existence = await gather(*(exists(path, follow=follow) for path in paths)) - return {path: exi for path, exi in zip(paths, existence)} - - -async def is_dir(path: PurePath) -> bool: - return await to_thread(lambda: isdir(path)) - - -async def is_file(path: PurePath) -> bool: - return await to_thread(lambda: isfile(path)) - - -def _mkdir_p(path: PurePath) -> None: - makedirs(path, mode=_FOLDER_MODE, exist_ok=True) - - -async def _mkdir(path: PurePath) -> None: - def cont() -> None: - _mkdir_p(path) - - await to_thread(cont) - - -async def mkdir(paths: Iterable[PurePath]) -> None: - await gather(*map(_mkdir, paths)) - - -async def _new(path: PurePath) -> None: - def cont() -> None: - makedirs(path.parent, mode=_FOLDER_MODE, exist_ok=True) - Path(path).touch(mode=_FILE_MODE, exist_ok=True) - - await to_thread(cont) - - -async def new(paths: Iterable[PurePath]) -> None: - async with lock(): - await gather(*map(_new, paths)) - - -async def _rename(src: PurePath, dst: PurePath) -> None: - def cont() -> None: - makedirs(dst.parent, mode=_FOLDER_MODE, exist_ok=True) - mv(normpath(src), normpath(dst)) - - await to_thread(cont) - - -async def rename(operations: Mapping[PurePath, PurePath]) -> None: - async with lock(): - await gather(*(_rename(src, dst) for src, dst in operations.items())) - - -async def _remove(path: PurePath) -> None: - def cont() -> None: - stats = stat(path, follow_symlinks=False) - if S_ISDIR(stats.st_mode): - rmtree(path) - else: - rm(path) - - await to_thread(cont) - - -async def remove(paths: Iterable[PurePath]) -> None: - async with lock(): - await gather(*map(_remove, paths)) - - -async def _cut(src: PurePath, dst: PurePath) -> None: - def cont() -> None: - mv(normpath(src), normpath(dst)) - - await to_thread(cont) - - -async def cut(operations: Mapping[PurePath, PurePath]) -> None: - async with lock(): - await gather(*(_cut(src, dst) for src, dst in operations.items())) - - -async def _copy(src: PurePath, dst: PurePath) -> None: - def cont() -> None: - stats = stat(src, follow_symlinks=False) - if S_ISDIR(stats.st_mode): - copytree(src, dst, symlinks=True, dirs_exist_ok=True) - else: - copy2(src, dst, follow_symlinks=False) - - await to_thread(cont) - - -async def copy(operations: Mapping[PurePath, PurePath]) -> None: - async with lock(): - await gather(*(_copy(src, dst) for src, dst in operations.items())) - - -async def _link(src: PurePath, dst: PurePath) -> None: - def cont() -> None: - target_is_directory = isdir(src) - _mkdir_p(dst.parent) - symlink(normpath(src), normpath(dst), target_is_directory=target_is_directory) - - await to_thread(cont) - - -async def link(operations: Mapping[PurePath, PurePath]) -> None: - async with lock(): - await gather(*(_link(src, dst) for dst, src in operations.items())) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/fs/types.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/fs/types.py deleted file mode 100644 index 808513c1..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/fs/types.py +++ /dev/null @@ -1,52 +0,0 @@ -from __future__ import annotations - -from dataclasses import dataclass, field -from enum import IntEnum, auto, unique -from pathlib import PurePath -from typing import AbstractSet, Any, Mapping, Optional, Sequence - - -# https://github.com/coreutils/coreutils/blob/master/src/ls.c -@unique -class Mode(IntEnum): - orphan_link = auto() - link = auto() - - pipe = auto() - socket = auto() - block_device = auto() - char_device = auto() - door = auto() - - sticky_other_writable = auto() - other_writable = auto() - sticky = auto() - folder = auto() - - set_uid = auto() - set_gid = auto() - file_w_capacity = auto() - executable = auto() - multi_hardlink = auto() - file = auto() - - -@dataclass -class _RenderCache: - sort_by: Optional[Sequence[Any]] = None - - -@dataclass(frozen=True) -class Node: - mode: AbstractSet[Mode] - path: PurePath - pointed: Optional[PurePath] - children: Mapping[PurePath, Node] - cache: _RenderCache = field(default_factory=_RenderCache) - - -@dataclass(frozen=True) -class Ignored: - name_exact: AbstractSet[str] - name_glob: Sequence[str] - path_glob: Sequence[str] diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/lsp/__init__.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/lsp/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/lsp/diagnostics.lua b/config/neovim/store/lazy-plugins/chadtree/chadtree/lsp/diagnostics.lua deleted file mode 100644 index ea70dabd..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/lsp/diagnostics.lua +++ /dev/null @@ -1,30 +0,0 @@ -(function(_) - if vim.diagnostic then - local diagnostics = vim.diagnostic.get(nil, nil) - vim.validate({diagnostics = {diagnostics, "table"}}) - local acc = {} - for _, row in pairs(diagnostics) do - local buf = row.bufnr - local severity = tostring(row.severity) - vim.validate( - { - buf = {buf, "number"}, - row_severity = {row.severity, "number"} - } - ) - if not acc[buf] then - acc[buf] = {} - end - if not acc[buf][severity] then - acc[buf][severity] = 0 - end - acc[buf][severity] = acc[buf][severity] + 1 - end - local acc2 = {} - for buf, warnings in pairs(acc) do - local path = vim.api.nvim_buf_get_name(buf) - acc2[path] = warnings - end - return acc2 - end -end)(...) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/lsp/diagnostics.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/lsp/diagnostics.py deleted file mode 100644 index 979d6874..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/lsp/diagnostics.py +++ /dev/null @@ -1,44 +0,0 @@ -import sys -from collections import Counter -from pathlib import Path, PurePath -from typing import Mapping, MutableMapping, cast - -from pynvim_pp.nvim import Nvim -from pynvim_pp.types import NoneType - -from ..fs.ops import ancestors -from ..state.types import Diagnostics - -_LUA = ( - Path(__file__).resolve(strict=True).with_name("diagnostics.lua").read_text("UTF-8") -) - -if sys.version_info < (3, 9): - _C = Counter -else: - _C = Counter[int] - - -async def poll(min_severity: int) -> Diagnostics: - diagnostics: Mapping[str, Mapping[str, int]] = cast( - Mapping[str, Mapping[str, int]], await Nvim.fn.luaeval(NoneType, _LUA, ()) - ) - - raw = { - PurePath(path): Counter( - { - s: count - for severity, count in (counts or {}).items() - if (s := int(severity)) <= min_severity - } - ) - for path, counts in (diagnostics or {}).items() - } - - acc: MutableMapping[PurePath, _C] = {} - for path, counts in raw.items(): - for parent in ancestors(path): - c = acc.setdefault(parent, Counter()) - c += counts - - return {**acc, **raw} diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/lsp/notify.lua b/config/neovim/store/lazy-plugins/chadtree/chadtree/lsp/notify.lua deleted file mode 100644 index cd53990b..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/lsp/notify.lua +++ /dev/null @@ -1,9 +0,0 @@ -(function(args) - local method, params = unpack(args) - if vim.lsp then - local clients = (vim.lsp.get_clients or vim.lsp.get_active_clients)() - for _, client in pairs(clients) do - client.notify(method, params) - end - end -end)(...) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/lsp/notify.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/lsp/notify.py deleted file mode 100644 index 9d3025ba..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/lsp/notify.py +++ /dev/null @@ -1,31 +0,0 @@ -from pathlib import Path, PurePath -from typing import Any, Iterable, Mapping - -from pynvim_pp.nvim import Nvim -from pynvim_pp.types import NoneType - -_LUA = Path(__file__).resolve(strict=True).with_name("notify.lua").read_text("UTF-8") - - -async def _notify(method: str, params: Any) -> None: - await Nvim.fn.luaeval(NoneType, _LUA, (method, params)) - - -async def lsp_created(paths: Iterable[PurePath]) -> None: - params = {"files": tuple({"uri": path.as_uri()} for path in paths)} - await _notify("workspace/didCreateFiles", params=params) - - -async def lsp_removed(paths: Iterable[PurePath]) -> None: - params = {"files": tuple({"uri": path.as_uri()} for path in paths)} - await _notify("workspace/didDeleteFiles", params=params) - - -async def lsp_moved(paths: Mapping[PurePath, PurePath]) -> None: - params = { - "files": tuple( - {"oldUri": old.as_uri(), "newUri": new.as_uri()} - for old, new in paths.items() - ) - } - await _notify("workspace/didRenameFiles", params=params) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/nvim/__init__.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/nvim/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/nvim/markers.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/nvim/markers.py deleted file mode 100644 index efb03d72..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/nvim/markers.py +++ /dev/null @@ -1,48 +0,0 @@ -from asyncio import gather -from collections import Counter -from itertools import chain -from pathlib import PurePath -from typing import AbstractSet, Mapping, MutableMapping, MutableSet, Sequence, cast - -from pynvim_pp.atomic import Atomic -from pynvim_pp.buffer import Buffer -from pynvim_pp.nvim import Marker, Nvim -from pynvim_pp.types import NoneType - -from ..fs.ops import ancestors -from .types import Markers - - -async def _bookmarks() -> Mapping[PurePath, AbstractSet[Marker]]: - acc: MutableMapping[PurePath, MutableSet[Marker]] = {} - bookmarks = await Nvim.list_bookmarks() - for marker, (path, _, _) in bookmarks.items(): - if path: - for marked_path in chain((path,), ancestors(path)): - marks = acc.setdefault(marked_path, set()) - marks.add(marker) - - return acc - - -async def _quickfix() -> Mapping[PurePath, int]: - qflist = cast(Sequence[Mapping[str, int]], await Nvim.fn.getqflist(NoneType)) - - atomic = Atomic() - for q in qflist: - bufnr = q["bufnr"] - buf = Buffer.from_int(bufnr) - atomic.buf_get_name(buf) - - bufnames = cast(Sequence[str], await atomic.commit(NoneType)) - filenames = tuple(map(PurePath, bufnames)) - parents = (ancestor for fullname in filenames for ancestor in ancestors(fullname)) - locations = Counter(chain(filenames, parents)) - - return locations - - -async def markers() -> Markers: - qf, bm = await gather(_quickfix(), _bookmarks()) - markers = Markers(quick_fix=qf, bookmarks=bm) - return markers diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/nvim/types.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/nvim/types.py deleted file mode 100644 index 5a321540..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/nvim/types.py +++ /dev/null @@ -1,11 +0,0 @@ -from dataclasses import dataclass -from pathlib import PurePath -from typing import AbstractSet, Mapping - -from pynvim_pp.nvim import Marker - - -@dataclass(frozen=True) -class Markers: - quick_fix: Mapping[PurePath, int] - bookmarks: Mapping[PurePath, AbstractSet[Marker]] diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/registry.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/registry.py deleted file mode 100644 index e6e43b61..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/registry.py +++ /dev/null @@ -1,34 +0,0 @@ -from asyncio import Queue -from functools import lru_cache -from typing import Any, Awaitable, Callable, Sequence, Tuple - -from pynvim_pp.autocmd import AutoCMD -from pynvim_pp.handler import RPC -from pynvim_pp.rpc_types import Method - -_MSG = Tuple[bool, Method, Sequence[Any]] - -NAMESPACE = "CHAD" - - -def _name_gen(fn: Callable[..., Awaitable[Any]]) -> str: - return fn.__qualname__.lstrip("_").capitalize() - - -@lru_cache(maxsize=None) -def queue() -> Queue: - return Queue() - - -autocmd = AutoCMD() -rpc = RPC(NAMESPACE, name_gen=_name_gen) - - -async def enqueue_event(sync: bool, method: Method, params: Sequence[Any] = ()) -> None: - msg = (sync, method, params) - await queue().put(msg) - - -async def dequeue_event() -> _MSG: - msg: _MSG = await queue().get() - return msg diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/settings/__init__.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/settings/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/settings/load.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/settings/load.py deleted file mode 100644 index 9b17d889..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/settings/load.py +++ /dev/null @@ -1,178 +0,0 @@ -from dataclasses import dataclass -from enum import Enum, auto -from locale import strxfrm -from typing import ( - AbstractSet, - Any, - Iterable, - Mapping, - Optional, - Sequence, - SupportsFloat, - Union, - cast, -) - -from pynvim_pp.atomic import Atomic -from pynvim_pp.nvim import Nvim -from pynvim_pp.rpc_types import RPCallable -from pynvim_pp.types import NoneType -from pynvim_pp.window import Window -from std2.configparser import hydrate -from std2.graphlib import merge -from std2.pickle.decoder import new_decoder -from std2.pickle.types import DecodeError -from yaml import safe_load - -from chad_types import ( - ARTIFACT, - Artifact, - IconColourSetEnum, - IconGlyphSetEnum, - LSColoursEnum, - TextColourSetEnum, -) - -from ..consts import CONFIG_YML, SETTINGS_VAR -from ..fs.types import Ignored -from ..registry import NAMESPACE -from ..view.load import load_theme -from ..view.types import HLGroups, Sortby, ViewOptions -from .types import MimetypeOptions, Settings, VersionCtlOpts - - -class _OpenDirection(Enum): - left = auto() - right = auto() - - -@dataclass(frozen=True) -class _UserOptions: - close_on_open: bool - follow: bool - follow_links: bool - follow_ignore: bool - lang: Optional[str] - mimetypes: MimetypeOptions - page_increment: int - polling_rate: SupportsFloat - session: bool - show_hidden: bool - min_diagnostics_severity: int - version_control: VersionCtlOpts - - -@dataclass(frozen=True) -class _UserTheme: - highlights: HLGroups - icon_glyph_set: IconGlyphSetEnum - icon_colour_set: IconColourSetEnum - text_colour_set: Union[LSColoursEnum, TextColourSetEnum] - discrete_colour_map: Mapping[str, str] - - -@dataclass(frozen=True) -class _UserView: - open_direction: _OpenDirection - width: int - sort_by: Sequence[Sortby] - time_format: str - window_options: Mapping[str, Union[bool, str]] - - -@dataclass(frozen=True) -class _UserConfig: - keymap: Mapping[str, AbstractSet[str]] - options: _UserOptions - idle_timeout: SupportsFloat - ignore: Ignored - view: _UserView - theme: _UserTheme - xdg: bool - profiling: bool - - -async def initial(specs: Iterable[RPCallable]) -> Settings: - a_decode = new_decoder[Artifact](Artifact) - c_decode = new_decoder[_UserConfig](_UserConfig) - - win = await Window.get_current() - artifacts = a_decode(safe_load(ARTIFACT.read_text("UTF-8"))) - - user_config = cast( - Mapping[str, Any], await Nvim.vars.get(NoneType, SETTINGS_VAR) or {} - ) - config = c_decode( - merge( - safe_load(CONFIG_YML.read_text("UTF-8")), hydrate(user_config), replace=True - ) - ) - options, view, theme = config.options, config.view, config.theme - - atomic = Atomic() - for opt in view.window_options: - atomic.win_get_option(win, opt) - win_opts = cast(Sequence[Union[bool, str]], await atomic.commit(NoneType)) - win_actual_opts = {k: v for k, v in zip(view.window_options, win_opts)} - - icons, hl_context = load_theme( - artifact=artifacts, - particular_mappings=theme.highlights, - discrete_colours=theme.discrete_colour_map, - icon_set=theme.icon_glyph_set, - icon_colour_set=theme.icon_colour_set, - text_colour_set=theme.text_colour_set, - ) - - use_icons = theme.icon_glyph_set not in { - IconGlyphSetEnum.ascii, - IconGlyphSetEnum.ascii_hollow, - } - - view_opts = ViewOptions( - hl_context=hl_context, - icons=icons, - sort_by=tuple(view.sort_by), - use_icons=use_icons, - time_fmt=view.time_format, - ) - - keymap = {f"{NAMESPACE}.{k.capitalize()}": v for k, v in config.keymap.items()} - legal_keys = {f"{NAMESPACE}.{spec.method.capitalize()}" for spec in specs} - extra_keys = keymap.keys() - legal_keys - - if extra_keys: - raise DecodeError( - path=(_UserOptions, sorted(legal_keys, key=strxfrm)), - actual=None, - missing_keys=(), - extra_keys=sorted(extra_keys, key=strxfrm), - ) - - else: - settings = Settings( - close_on_open=options.close_on_open, - follow=options.follow, - follow_links=options.follow_links, - follow_ignore=options.follow_ignore, - ignores=config.ignore, - idle_timeout=float(config.idle_timeout), - keymap=keymap, - lang=options.lang, - mime=options.mimetypes, - min_diagnostics_severity=options.min_diagnostics_severity, - open_left=view.open_direction is _OpenDirection.left, - page_increment=options.page_increment, - polling_rate=float(options.polling_rate), - session=options.session, - show_hidden=options.show_hidden, - version_ctl=options.version_control, - view=view_opts, - width=view.width, - win_actual_opts=win_actual_opts, - win_local_opts=view.window_options, - xdg=config.xdg, - profiling=config.profiling, - ) - - return settings diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/settings/localization.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/settings/localization.py deleted file mode 100644 index dc8b058f..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/settings/localization.py +++ /dev/null @@ -1,46 +0,0 @@ -from locale import getlocale -from string import Template -from typing import Mapping, MutableMapping, Optional, Union - -from std2.pickle.decoder import new_decoder -from yaml import safe_load - -from ..consts import DEFAULT_LANG, LANG_ROOT - - -def _get_lang(code: Optional[str], fallback: str) -> str: - if code: - return code.casefold() - else: - tag, _ = getlocale() - tag = (tag or fallback).casefold() - primary, _, _ = tag.partition("-") - lang, _, _ = primary.partition("_") - return lang - - -class _Lang: - def __init__(self, specs: MutableMapping[str, str]) -> None: - self._specs = specs - - def __call__(self, key: str, **kwds: Union[int, float, str]) -> str: - spec = self._specs[key] - return Template(spec).substitute(kwds) - - -LANG = _Lang({}) - - -def init(code: Optional[str]) -> None: - decode = new_decoder[Mapping[str, str]](Mapping[str, str]) - - lang = _get_lang(code, fallback=DEFAULT_LANG) - lang_path = (LANG_ROOT / lang).with_suffix(".yml") - yml_path = ( - lang_path - if lang_path.exists() - else (LANG_ROOT / DEFAULT_LANG).with_suffix(".yml") - ) - - specs = decode(safe_load(yml_path.read_text("UTF-8"))) - LANG._specs.update(specs) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/settings/types.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/settings/types.py deleted file mode 100644 index c2ba04b5..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/settings/types.py +++ /dev/null @@ -1,42 +0,0 @@ -from dataclasses import dataclass -from typing import AbstractSet, Mapping, Optional, Union - -from ..fs.types import Ignored -from ..view.types import ViewOptions - - -@dataclass(frozen=True) -class VersionCtlOpts: - enable: bool - - -@dataclass(frozen=True) -class MimetypeOptions: - warn: AbstractSet[str] - allow_exts: AbstractSet[str] - - -@dataclass(frozen=True) -class Settings: - close_on_open: bool - follow: bool - follow_links: bool - follow_ignore: bool - ignores: Ignored - keymap: Mapping[str, AbstractSet[str]] - lang: Optional[str] - mime: MimetypeOptions - open_left: bool - page_increment: int - polling_rate: float - idle_timeout: float - profiling: bool - session: bool - show_hidden: bool - version_ctl: VersionCtlOpts - view: ViewOptions - width: int - win_actual_opts: Mapping[str, Union[bool, str]] - win_local_opts: Mapping[str, Union[bool, str]] - min_diagnostics_severity: int - xdg: bool diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/state/__init__.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/state/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/state/cache.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/state/cache.py deleted file mode 100644 index c89f0650..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/state/cache.py +++ /dev/null @@ -1,25 +0,0 @@ -from functools import cached_property - -from ..timeit import timeit -from ..view.render import render -from ..view.types import Derived -from .types import State - - -class DeepState(State): - @cached_property - def derived(self) -> Derived: - with timeit("render"): - return render( - self.root, - settings=self.settings, - index=self.index, - selection=self.selection, - filter_pattern=self.filter_pattern, - markers=self.markers, - diagnostics=self.diagnostics, - vc=self.vc, - follow_links=self.follow_links, - show_hidden=self.show_hidden, - current=self.current, - ) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/state/executor.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/state/executor.py deleted file mode 100644 index b299d61c..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/state/executor.py +++ /dev/null @@ -1,56 +0,0 @@ -from asyncio import ( - AbstractEventLoop, - get_running_loop, - run, - run_coroutine_threadsafe, - wrap_future, -) -from concurrent.futures import Future, InvalidStateError, ThreadPoolExecutor -from contextlib import suppress -from threading import Thread -from typing import Any, Awaitable, Callable, Coroutine, TypeVar - -_T = TypeVar("_T") - - -class AsyncExecutor: - def __init__(self, threadpool: ThreadPoolExecutor) -> None: - f: Future = Future() - self._fut: Future = Future() - - async def cont() -> None: - loop = get_running_loop() - if threadpool: - loop.set_default_executor(threadpool) - f.set_result(loop) - main: Coroutine = await wrap_future(self._fut) - await main - - self._th = Thread(daemon=True, target=lambda: run(cont())) - self._th.start() - self.threadpool = threadpool - self.loop: AbstractEventLoop = f.result() - - def run(self, main: Awaitable[Any]) -> None: - self._fut.set_result(main) - - def fsubmit(self, f: Callable[..., Any], *args: Any, **kwargs: Any) -> Future: - fut: Future = Future() - - def cont() -> None: - if fut.set_running_or_notify_cancel(): - try: - ret = f(*args, **kwargs) - except BaseException as e: - with suppress(InvalidStateError): - fut.set_exception(e) - else: - with suppress(InvalidStateError): - fut.set_result(ret) - - self.loop.call_soon_threadsafe(cont) - return fut - - def submit(self, co: Awaitable[_T]) -> Awaitable[_T]: - f = run_coroutine_threadsafe(co, loop=self.loop) - return wrap_future(f) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/state/load.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/state/load.py deleted file mode 100644 index 996520c3..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/state/load.py +++ /dev/null @@ -1,72 +0,0 @@ -from asyncio import gather -from concurrent.futures import ThreadPoolExecutor -from pathlib import Path - -from pynvim_pp.nvim import Nvim - -from ..consts import SESSION_DIR -from ..fs.cartographer import new -from ..nvim.markers import markers -from ..settings.types import Settings -from ..version_ctl.types import VCStatus -from .cache import DeepState -from .executor import AsyncExecutor -from .ops import load_session -from .types import Selection, Session, State - - -async def initial(settings: Settings, th: ThreadPoolExecutor) -> State: - executor = AsyncExecutor(threadpool=th) - cwd, marks = await gather(Nvim.getcwd(), markers()) - storage = ( - Path(await Nvim.fn.stdpath(str, "cache")) / "chad_sessions" - if settings.xdg - else SESSION_DIR - ) - - session = Session(workdir=cwd, storage=storage) - stored = await load_session(session) if settings.session else None - index = {cwd} | (stored.index if stored else frozenset()) - - show_hidden = ( - stored.show_hidden - if stored and stored.show_hidden is not None - else settings.show_hidden - ) - enable_vc = ( - stored.enable_vc - if stored and stored.enable_vc is not None - else settings.version_ctl.enable - ) - - selection: Selection = frozenset() - node = await new( - executor, follow_links=settings.follow_links, root=cwd, index=index - ) - vc = VCStatus() - - current = None - filter_pattern = None - - state = DeepState( - executor=executor, - settings=settings, - session=session, - vim_focus=True, - index=index, - selection=selection, - filter_pattern=filter_pattern, - show_hidden=show_hidden, - follow=settings.follow, - follow_links=settings.follow_links, - follow_ignore=settings.follow_ignore, - enable_vc=enable_vc, - width=settings.width, - root=node, - markers=marks, - diagnostics={}, - vc=vc, - current=current, - window_order={}, - ) - return state diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/state/next.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/state/next.py deleted file mode 100644 index 61f9ff68..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/state/next.py +++ /dev/null @@ -1,85 +0,0 @@ -from pathlib import PurePath -from typing import AbstractSet, Mapping, Optional, Union, cast - -from pynvim_pp.rpc_types import ExtData -from std2.types import Void, VoidType, or_else - -from ..fs.cartographer import update -from ..fs.types import Node -from ..nvim.types import Markers -from ..version_ctl.types import VCStatus -from .cache import DeepState -from .types import Diagnostics, FilterPattern, Index, Selection, Session, State - - -async def forward( - state: State, - *, - root: Union[Node, VoidType] = Void, - index: Union[Index, VoidType] = Void, - selection: Union[Selection, VoidType] = Void, - filter_pattern: Union[Optional[FilterPattern], VoidType] = Void, - show_hidden: Union[bool, VoidType] = Void, - follow: Union[bool, VoidType] = Void, - follow_links: Union[bool, VoidType] = Void, - follow_ignore: Union[bool, VoidType] = Void, - enable_vc: Union[bool, VoidType] = Void, - width: Union[int, VoidType] = Void, - markers: Union[Markers, VoidType] = Void, - diagnostics: Union[Diagnostics, VoidType] = Void, - vc: Union[VCStatus, VoidType] = Void, - current: Union[PurePath, VoidType] = Void, - invalidate_dirs: Union[AbstractSet[PurePath], VoidType] = Void, - window_order: Union[Mapping[ExtData, None], VoidType] = Void, - session: Union[Session, VoidType] = Void, - vim_focus: Union[bool, VoidType] = Void, - trace: bool = True, -) -> State: - new_index = or_else(index, state.index) - new_selection = or_else(selection, state.selection) - new_filter_pattern = or_else(filter_pattern, state.filter_pattern) - new_current = or_else(current, state.current) - new_follow_links = or_else(follow_links, state.follow_links) - new_root = cast( - Node, - root - or ( - await update( - state.executor, - root=state.root, - follow_links=new_follow_links, - index=new_index, - invalidate_dirs=invalidate_dirs, - ) - if not isinstance(invalidate_dirs, VoidType) - else state.root - ), - ) - new_markers = or_else(markers, state.markers) - new_vc = or_else(vc, state.vc) - new_hidden = or_else(show_hidden, state.show_hidden) - new_vim_focus = or_else(vim_focus, state.vim_focus) - - new_state = DeepState( - executor=state.executor, - settings=state.settings, - session=or_else(session, state.session), - vim_focus=new_vim_focus, - index=new_index, - selection=new_selection, - filter_pattern=new_filter_pattern, - show_hidden=new_hidden, - follow=or_else(follow, state.follow), - follow_links=new_follow_links, - follow_ignore=or_else(follow_ignore, state.follow_ignore), - enable_vc=or_else(enable_vc, state.enable_vc), - width=or_else(width, state.width), - root=new_root, - markers=new_markers, - diagnostics=or_else(diagnostics, state.diagnostics), - vc=new_vc, - current=new_current, - window_order=or_else(window_order, state.window_order), - ) - - return new_state diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/state/ops.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/state/ops.py deleted file mode 100644 index c860e9c9..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/state/ops.py +++ /dev/null @@ -1,69 +0,0 @@ -from hashlib import sha1 -from json import dumps, loads -from os.path import normcase -from pathlib import Path, PurePath -from tempfile import NamedTemporaryFile -from typing import Any, MutableMapping, Optional - -from pynvim_pp.lib import decode, encode -from std2.asyncio import to_thread -from std2.pickle.decoder import new_decoder -from std2.pickle.encoder import new_encoder - -from .types import Session, State, StoredSession - -_DECODER = new_decoder[StoredSession](StoredSession) -_ENCODER = new_encoder[StoredSession](StoredSession) - - -def _session_path(cwd: PurePath, storage: Path) -> Path: - hashed = sha1(normcase(cwd).encode()).hexdigest() - part = storage / hashed - return part.with_suffix(".json") - - -async def _load_json(path: Path) -> Optional[Any]: - def cont() -> Optional[Any]: - try: - json = decode(path.read_bytes()) - except FileNotFoundError: - return None - else: - return loads(json) - - return await to_thread(cont) - - -async def load_session(session: Session) -> StoredSession: - load_path = _session_path(session.workdir, storage=session.storage) - try: - json = await _load_json(load_path) - if isinstance(json, MutableMapping): - json.pop("bookmarks", None) - sessions = _DECODER(json) - except Exception: - return StoredSession(index=frozenset(), show_hidden=None, enable_vc=None) - else: - return sessions - - -async def dump_session(state: State) -> None: - stored = StoredSession( - index=state.index, - show_hidden=state.show_hidden, - enable_vc=state.enable_vc, - ) - - json = _ENCODER(stored) - path = _session_path(state.session.workdir, storage=state.session.storage) - parent = path.parent - dumped = encode(dumps(json, ensure_ascii=False, check_circular=False, indent=2)) - - def cont() -> None: - parent.mkdir(parents=True, exist_ok=True) - with NamedTemporaryFile(dir=parent, delete=False) as f: - f.write(dumped) - - Path(f.name).replace(path) - - await to_thread(cont) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/state/types.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/state/types.py deleted file mode 100644 index 09980a87..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/state/types.py +++ /dev/null @@ -1,63 +0,0 @@ -from dataclasses import dataclass -from pathlib import Path, PurePath -from typing import AbstractSet, Mapping, Optional - -from pynvim_pp.rpc_types import ExtData - -from ..fs.types import Node -from ..nvim.types import Markers -from ..settings.types import Settings -from ..version_ctl.types import VCStatus -from ..view.types import Derived -from .executor import AsyncExecutor - -Index = AbstractSet[PurePath] -Selection = Index -Diagnostics = Mapping[PurePath, Mapping[int, int]] - - -@dataclass(frozen=True) -class FilterPattern: - pattern: str - - -@dataclass(frozen=True) -class Session: - workdir: PurePath - storage: Path - - -@dataclass(frozen=True) -class State: - executor: AsyncExecutor - settings: Settings - session: Session - follow_links: bool - follow_ignore: bool - vim_focus: bool - current: Optional[PurePath] - enable_vc: bool - filter_pattern: Optional[FilterPattern] - follow: bool - index: Index - markers: Markers - root: Node - selection: Selection - show_hidden: bool - vc: VCStatus - width: int - diagnostics: Diagnostics - window_order: Mapping[ExtData, None] - - @property - def derived(self) -> Derived: - raise NotImplementedError() - - -@dataclass(frozen=True) -class StoredSession: - # TODO: sync across sessions - # pid: int - index: Index - show_hidden: Optional[bool] - enable_vc: Optional[bool] diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/timeit.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/timeit.py deleted file mode 100644 index c1112de2..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/timeit.py +++ /dev/null @@ -1,35 +0,0 @@ -from contextlib import contextmanager -from typing import Any, Iterator, MutableMapping, Optional, Tuple - -from pynvim_pp.logging import log -from std2.locale import si_prefixed_smol -from std2.timeit import timeit as _timeit - -from .consts import DEBUG - -_RECORDS: MutableMapping[str, Tuple[int, float]] = {} - - -@contextmanager -def timeit( - name: str, *args: Any, force: bool = False, warn: Optional[float] = None -) -> Iterator[None]: - if DEBUG or force or warn is not None: - with _timeit() as t: - yield None - delta = t().total_seconds() - if DEBUG or force or delta >= (warn or 0): - times, cum = _RECORDS.get(name, (0, 0)) - tt, c = times + 1, cum + delta - _RECORDS[name] = tt, c - - label = name.ljust(50) - time = f"{si_prefixed_smol(delta, precision=0)}s".ljust(8) - ttime = f"{si_prefixed_smol(c / tt, precision=0)}s".ljust(8) - msg = f"TIME -- {label} :: {time} @ {ttime} {' '.join(map(str, args))}" - if force: - log.info("%s", msg) - else: - log.debug("%s", msg) - else: - yield None diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/__init__.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/autocmds.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/autocmds.py deleted file mode 100644 index 95e78554..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/autocmds.py +++ /dev/null @@ -1,199 +0,0 @@ -from asyncio import Task, create_task, sleep -from collections.abc import Sequence -from itertools import chain -from typing import Optional - -from pynvim_pp.buffer import Buffer -from pynvim_pp.nvim import Nvim -from pynvim_pp.rpc_types import NvimError -from pynvim_pp.window import Window -from std2.asyncio import cancel -from std2.cell import RefCell - -from ..consts import FM_FILETYPE, URI_SCHEME -from ..fs.ops import ancestors, is_file -from ..lsp.diagnostics import poll -from ..nvim.markers import markers -from ..registry import NAMESPACE, autocmd, rpc -from ..settings.types import Settings -from ..state.next import forward -from ..state.ops import dump_session -from ..state.types import State -from .shared.current import new_current_file, new_root -from .shared.wm import ( - find_current_buffer_path, - find_fm_buffers, - is_fm_buf_name, - is_fm_buffer, - restore_non_fm_win, - setup_fm_buf, -) -from .types import Stage - -_CELL = RefCell[Optional[Task]](None) - - -async def _setup_fm_win(settings: Settings, win: Window) -> None: - for key, val in settings.win_local_opts.items(): - await win.opts.set(key, val=val) - - -async def setup(settings: Settings) -> None: - async for buf in find_fm_buffers(): - await setup_fm_buf(settings, buf=buf) - for win in await Window.list(): - buf = await win.get_buf() - if await is_fm_buffer(buf): - await _setup_fm_win(settings, win=win) - - -@rpc(blocking=False) -async def _when_idle(state: State) -> None: - if task := _CELL.val: - _CELL.val = None - await cancel(task) - - async def cont() -> None: - await sleep(state.settings.idle_timeout) - diagnostics = await poll(state.settings.min_diagnostics_severity) - await forward(state, diagnostics=diagnostics) - - _CELL.val = create_task(cont()) - - -_ = autocmd("CursorHold", "CursorHoldI") << f"lua {NAMESPACE}.{_when_idle.method}()" - - -@rpc(blocking=False) -async def save_session(state: State) -> None: - """ - Save CHADTree state - """ - - await dump_session(state) - - -_ = autocmd("ExitPre") << f"lua {NAMESPACE}.{save_session.method}()" -_ = ( - autocmd("User", modifiers=("CHADSave",)) - << f"lua {NAMESPACE}.{save_session.method}()" -) - - -@rpc(blocking=False) -async def focus_lost(state: State) -> Stage: - """ - Save CHADTree state - """ - - await dump_session(state) - new_state = await forward(state, vim_focus=False) - return Stage(new_state) - - -_ = autocmd("FocusLost") << f"lua {NAMESPACE}.{focus_lost.method}()" - - -@rpc(blocking=False) -async def _focus_gained(state: State) -> Stage: - """ """ - - new_state = await forward(state, vim_focus=True) - return Stage(new_state) - - -_ = autocmd("FocusGained") << f"lua {NAMESPACE}.{_focus_gained.method}()" - - -@rpc(blocking=False) -async def _record_win_pos(state: State) -> Stage: - """ - Record last windows - """ - - win = await Window.get_current() - win_id = win.data - - window_order = { - wid: None - for wid in chain( - (wid for wid in state.window_order if wid != win_id), (win_id,) - ) - } - new_state = await forward(state, window_order=window_order) - return Stage(new_state) - - -_ = autocmd("WinEnter") << f"lua {NAMESPACE}.{_record_win_pos.method}()" - - -@rpc(blocking=False) -async def _changedir(state: State) -> Stage: - """ - Follow cwd update - """ - - cwd = await Nvim.getcwd() - new_state = await new_root(state, new_cwd=cwd, indices=frozenset()) - return Stage(new_state) - - -_ = autocmd("DirChanged") << f"lua {NAMESPACE}.{_changedir.method}()" - - -@rpc(blocking=False) -async def _restore(state: State, args: Sequence[str]) -> None: - win = await Window.get_current() - await restore_non_fm_win(state.settings.win_actual_opts, win=win) - - -@rpc(blocking=False) -async def _update_follow(state: State) -> Optional[Stage]: - """ - Follow buffer - """ - - win = await Window.get_current() - buf = await Buffer.get_current() - name = await buf.get_name() - is_fm_win = await win.vars.get(bool, URI_SCHEME) - is_fm_buf = await buf.filetype() == FM_FILETYPE - is_fm_uri = name and is_fm_buf_name(name) - - if is_fm_win and not is_fm_buf: - await restore_non_fm_win(state.settings.win_actual_opts, win=win) - - if is_fm_uri or is_fm_buf and not is_fm_win: - await _setup_fm_win(state.settings, win=win) - - if is_fm_uri and not is_fm_buf: - await setup_fm_buf(state.settings, buf=buf) - - try: - if (current := await find_current_buffer_path(name)) and await is_file(current): - if state.vc.ignored & {current, *ancestors(current)}: - return None - else: - stage = await new_current_file(state, current=current) - return stage - else: - return None - except NvimError: - return None - - -_ = autocmd("BufEnter") << f"lua {NAMESPACE}.{_update_follow.method}()" - - -@rpc(blocking=False) -async def _update_markers(state: State) -> Stage: - """ - Update markers - """ - - mks = await markers() - new_state = await forward(state, markers=mks) - return Stage(new_state) - - -_ = autocmd("QuickfixCmdPost") << f"lua {NAMESPACE}.{_update_markers.method}()" diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/click.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/click.py deleted file mode 100644 index 5d585854..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/click.py +++ /dev/null @@ -1,108 +0,0 @@ -from typing import Optional - -from pynvim_pp.nvim import Nvim -from std2 import anext - -from ..fs.cartographer import is_dir -from ..fs.types import Mode -from ..registry import rpc -from ..settings.localization import LANG -from ..state.next import forward -from ..state.types import State -from .shared.index import indices -from .shared.open_file import open_file -from .shared.wm import find_fm_windows -from .types import ClickType, Stage - - -async def _click( - state: State, is_visual: bool, click_type: ClickType -) -> Optional[Stage]: - node = await anext(indices(state, is_visual=is_visual), None) - - if not node: - return None - else: - if Mode.orphan_link in node.mode: - await Nvim.write(LANG("dead_link", name=node.path.name), error=True) - return None - else: - if is_dir(node): - if node.path == state.root.path: - return None - elif node.pointed and not state.follow_links: - return None - elif state.filter_pattern: - await Nvim.write(LANG("filter_click")) - return None - else: - index = state.index ^ {node.path} - invalidate_dirs = {node.path} - new_state = await forward( - state, - index=index, - invalidate_dirs=invalidate_dirs, - ) - return Stage(new_state) - else: - nxt = await open_file( - state, - path=node.path, - click_type=click_type, - ) - - if state.settings.close_on_open and click_type != ClickType.secondary: - async for win, _ in find_fm_windows(): - await win.close() - - return nxt - - -@rpc(blocking=False) -async def _primary(state: State, is_visual: bool) -> Optional[Stage]: - """ - Folders -> toggle - File -> open - """ - - return await _click(state, is_visual=is_visual, click_type=ClickType.primary) - - -@rpc(blocking=False) -async def _secondary(state: State, is_visual: bool) -> Optional[Stage]: - """ - Folders -> toggle - File -> preview - """ - - return await _click(state, is_visual=is_visual, click_type=ClickType.secondary) - - -@rpc(blocking=False) -async def _tertiary(state: State, is_visual: bool) -> Optional[Stage]: - """ - Folders -> toggle - File -> open in new tab - """ - - return await _click(state, is_visual=is_visual, click_type=ClickType.tertiary) - - -@rpc(blocking=False) -async def _v_split(state: State, is_visual: bool) -> Optional[Stage]: - """ - Folders -> toggle - File -> open in vertical split - """ - - return await _click(state, is_visual=is_visual, click_type=ClickType.v_split) - - -@rpc(blocking=False) -async def _h_split(state: State, is_visual: bool) -> Optional[Stage]: - """ - Folders -> toggle - File -> open in horizontal split - """ - - return await _click(state, is_visual=is_visual, click_type=ClickType.h_split) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/collapse.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/collapse.py deleted file mode 100644 index 4d21342b..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/collapse.py +++ /dev/null @@ -1,38 +0,0 @@ -from typing import Optional - -from std2 import anext - -from ..fs.cartographer import act_like_dir -from ..fs.ops import ancestors -from ..registry import rpc -from ..state.next import forward -from ..state.types import State -from .shared.index import indices -from .types import Stage - - -@rpc(blocking=False) -async def _collapse(state: State, is_visual: bool) -> Optional[Stage]: - """ - Collapse folder - """ - - node = await anext(indices(state, is_visual=is_visual), None) - if not node: - return None - else: - if act_like_dir(node, follow_links=state.follow_links): - path = node.path if node.path in state.index else node.path.parent - else: - path = node.path.parent - - paths = { - indexed - for indexed in state.index - if path in (ancestors(indexed) | {indexed}) - } - - index = (state.index - paths) | {state.root.path} - invalidate_dirs = {path} - new_state = await forward(state, index=index, invalidate_dirs=invalidate_dirs) - return Stage(new_state, focus=path) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/copy_name.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/copy_name.py deleted file mode 100644 index fcf5abee..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/copy_name.py +++ /dev/null @@ -1,75 +0,0 @@ -from locale import strxfrm -from os import linesep -from os.path import normpath, sep -from pathlib import PurePath -from typing import AsyncIterator, Callable - -from pynvim_pp.nvim import Nvim -from pynvim_pp.types import NoneType - -from ..fs.cartographer import is_dir -from ..fs.ops import is_dir as iis_dir -from ..registry import rpc -from ..settings.localization import LANG -from ..state.types import State -from .shared.index import indices - - -async def _cn(state: State, is_visual: bool, proc: Callable[[PurePath], str]) -> None: - async def gen_paths() -> AsyncIterator[str]: - if selection := state.selection: - for path in selection: - suffix = sep if await iis_dir(path) else "" - yield proc(path) + suffix - else: - nodes = indices(state, is_visual=is_visual) - async for node in nodes: - suffix = sep if is_dir(node) else "" - yield proc(node.path) + suffix - - paths = sorted([path async for path in gen_paths()], key=strxfrm) - clip = linesep.join(paths) - copied_paths = ", ".join(paths) - - await Nvim.fn.setreg(NoneType, "+", clip) - await Nvim.fn.setreg(NoneType, "*", clip) - await Nvim.write(LANG("copy_paths", copied_paths=copied_paths)) - - -@rpc(blocking=False) -async def _copy_name(state: State, is_visual: bool) -> None: - """ - Copy dirname / filename - """ - - await _cn( - state, - is_visual=is_visual, - proc=lambda p: normpath(p.name), - ) - - -@rpc(blocking=False) -async def _copy_basename(state: State, is_visual: bool) -> None: - """ - Copy basename of dirname / filename - """ - - await _cn( - state, - is_visual=is_visual, - proc=normpath, - ) - - -@rpc(blocking=False) -async def _copy_relname(state: State, is_visual: bool) -> None: - """ - Copy relname of dirname / filename - """ - - await _cn( - state, - is_visual=is_visual, - proc=lambda p: normpath(p.relative_to(state.root.path)), - ) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/cut_copy.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/cut_copy.py deleted file mode 100644 index eee7de95..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/cut_copy.py +++ /dev/null @@ -1,171 +0,0 @@ -from itertools import chain -from os import linesep -from pathlib import PurePath -from typing import AbstractSet, Awaitable, Callable, Mapping, MutableMapping, Optional - -from pynvim_pp.nvim import Nvim -from std2 import anext -from std2.locale import pathsort_key - -from ..fs.cartographer import act_like_dir -from ..fs.ops import ancestors, copy, cut, exists, unify_ancestors -from ..fs.types import Node -from ..lsp.notify import lsp_created, lsp_moved -from ..registry import rpc -from ..settings.localization import LANG -from ..state.next import forward -from ..state.types import State -from ..view.ops import display_path -from .shared.index import indices -from .shared.refresh import refresh -from .shared.wm import kill_buffers -from .types import Stage - - -def _find_dest(src: PurePath, node: Node, follow_links: bool) -> PurePath: - parent = ( - node.path if act_like_dir(node, follow_links=follow_links) else node.path.parent - ) - dst = parent / src.name - return dst - - -async def _operation( - *, - state: State, - is_visual: bool, - nono: AbstractSet[PurePath], - op_name: str, - is_move: bool, - action: Callable[[Mapping[PurePath, PurePath]], Awaitable[None]], -) -> Optional[Stage]: - node = await anext(indices(state, is_visual=is_visual), None) - selection = state.selection - unified = unify_ancestors(selection) - - if not unified or not node: - await Nvim.write(LANG("nothing_select"), error=True) - return None - elif not unified.isdisjoint(nono): - await Nvim.write(LANG("operation not permitted on root"), error=True) - return None - else: - pre_operations = { - src: _find_dest(src, node=node, follow_links=state.follow_links) - for src in unified - } - pre_existing = { - s: d for s, d in pre_operations.items() if await exists(d, follow=False) - } - - new_operations: MutableMapping[PurePath, PurePath] = {} - while pre_existing: - source, dest = pre_existing.popitem() - resp = await Nvim.input(question=LANG("path_exists_err"), default=dest.name) - new_dest = dest.parent / resp if resp else None - - if not new_dest: - pre_existing[source] = dest - break - elif await exists(new_dest, follow=False): - pre_existing[source] = new_dest - else: - new_operations[source] = new_dest - - if pre_existing: - msg = linesep.join( - f"{display_path(s, state=state)} -> {display_path(d, state=state)}" - for s, d in sorted( - pre_existing.items(), key=lambda t: pathsort_key(t[0]) - ) - ) - await Nvim.write( - LANG("paths already exist", operation=op_name, paths=msg), - error=True, - ) - return None - - else: - operations = {**pre_operations, **new_operations} - msg = linesep.join( - f"{display_path(s, state=state)} -> {display_path(d, state=state)}" - for s, d in sorted(operations.items(), key=lambda t: pathsort_key(t[0])) - ) - - question = LANG("confirm op", operation=op_name, paths=msg) - ans = await Nvim.confirm( - question=question, - answers=LANG("ask_yesno"), - answer_key={1: True, 2: False}, - ) - - if not ans: - return None - else: - try: - await action(operations) - except Exception as e: - await Nvim.write(e, error=True) - return await refresh(state) - else: - parents = { - p.parent for p in chain(operations.keys(), operations.values()) - } - invalidate_dirs = parents - index = state.index | parents - new_selection = {*operations.values()} - new_state = await forward( - state, - index=index, - selection=new_selection if is_move else selection, - invalidate_dirs=invalidate_dirs, - ) - focus = next( - iter(sorted(new_selection, key=pathsort_key)), - None, - ) - - if is_move: - await kill_buffers( - last_used=new_state.window_order, - paths=selection, - reopen={}, - ) - await lsp_moved(operations) - else: - await lsp_created(new_selection) - return Stage(new_state, focus=focus) - - -@rpc(blocking=False) -async def _cut(state: State, is_visual: bool) -> Optional[Stage]: - """ - Cut selected - """ - - cwd, root = await Nvim.getcwd(), state.root.path - nono = {cwd, root} | ancestors(cwd, root) - return await _operation( - state=state, - is_visual=is_visual, - nono=nono, - op_name=LANG("cut"), - action=cut, - is_move=True, - ) - - -@rpc(blocking=False) -async def _copy(state: State, is_visual: bool) -> Optional[Stage]: - """ - Copy selected - """ - - return await _operation( - state=state, - is_visual=is_visual, - nono=frozenset(), - op_name=LANG("copy"), - action=copy, - is_move=False, - ) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/delete.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/delete.py deleted file mode 100644 index ff71d75b..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/delete.py +++ /dev/null @@ -1,102 +0,0 @@ -from locale import strxfrm -from os import linesep -from pathlib import PurePath -from subprocess import CalledProcessError -from typing import Awaitable, Callable, Iterable, Optional - -from pynvim_pp.nvim import Nvim -from std2.asyncio.subprocess import call - -from ..fs.ops import ancestors, remove, unify_ancestors, which -from ..lsp.notify import lsp_removed -from ..registry import rpc -from ..settings.localization import LANG -from ..state.next import forward -from ..state.types import State -from ..view.ops import display_path -from .shared.index import indices -from .shared.refresh import refresh -from .shared.wm import kill_buffers -from .types import Stage - - -async def _remove( - state: State, - is_visual: bool, - yeet: Callable[[Iterable[PurePath]], Awaitable[None]], -) -> Optional[Stage]: - cwd, root = await Nvim.getcwd(), state.root.path - nono = {cwd, root} | ancestors(cwd, root) - - selection = state.selection or { - node.path async for node in indices(state, is_visual=is_visual) - } - unified = unify_ancestors(selection) - - if not unified: - return None - elif not unified.isdisjoint(nono): - await Nvim.write(LANG("operation not permitted on root"), error=True) - return None - else: - display_paths = linesep.join( - sorted((display_path(path, state=state) for path in unified), key=strxfrm) - ) - - question = LANG("ask_trash", display_paths=display_paths) - ans = await Nvim.confirm( - question=question, - answers=LANG("ask_yesno"), - answer_key={1: True, 2: False}, - ) - - if not ans: - return None - else: - try: - await yeet(unified) - except Exception as e: - await Nvim.write(e, error=True) - return await refresh(state) - else: - invalidate_dirs = {path.parent for path in unified} - new_state = await forward( - state, selection=frozenset(), invalidate_dirs=invalidate_dirs - ) - - await kill_buffers( - last_used=new_state.window_order, paths=selection, reopen={} - ) - await lsp_removed(unified) - return Stage(new_state) - - -@rpc(blocking=False) -async def _delete(state: State, is_visual: bool) -> Optional[Stage]: - """ - Delete selected - """ - - return await _remove(state, is_visual=is_visual, yeet=remove) - - -async def _sys_trash(paths: Iterable[PurePath]) -> None: - cwd = await Nvim.getcwd() - - if arg0 := which("trash"): - try: - await call(arg0, "--", *map(str, paths), cwd=cwd) - except CalledProcessError as e: - await Nvim.write(e, e.stderr, e.stdout, error=True) - - else: - await Nvim.write(LANG("sys_trash_err"), error=True) - - -@rpc(blocking=False) -async def _trash(state: State, is_visual: bool) -> Optional[Stage]: - """ - Delete selected - """ - - return await _remove(state, is_visual=is_visual, yeet=_sys_trash) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/filter.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/filter.py deleted file mode 100644 index a74fde4e..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/filter.py +++ /dev/null @@ -1,48 +0,0 @@ -from typing import Optional - -from pynvim_pp.nvim import Nvim -from std2 import anext - -from ..registry import rpc -from ..settings.localization import LANG -from ..state.next import forward -from ..state.types import FilterPattern, Selection, State -from .shared.index import indices -from .types import Stage - - -@rpc(blocking=False) -async def _clear_filter(state: State, is_visual: bool) -> Optional[Stage]: - """ - Clear filter - """ - - node = await anext(indices(state, is_visual=is_visual), None) - if not node: - return None - else: - focus = node.path - new_state = await forward(state, filter_pattern=None) - return Stage(new_state, focus=focus) - - -@rpc(blocking=False) -async def _filter(state: State, is_visual: bool) -> Optional[Stage]: - """ - Update filter - """ - - node = await anext(indices(state, is_visual=is_visual), None) - if not node: - return None - else: - focus = node.path - old_p = state.filter_pattern.pattern if state.filter_pattern else "" - pattern = await Nvim.input(question=LANG("new_filter"), default=old_p) - - filter_pattern = FilterPattern(pattern=pattern) if pattern else None - selection: Selection = state.selection if filter_pattern else frozenset() - new_state = await forward( - state, selection=selection, filter_pattern=filter_pattern - ) - return Stage(new_state, focus=focus) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/focus.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/focus.py deleted file mode 100644 index 307def10..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/focus.py +++ /dev/null @@ -1,105 +0,0 @@ -from os.path import normcase, normpath -from pathlib import PurePath -from typing import Optional - -from pynvim_pp.nvim import Nvim -from std2 import anext - -from ..fs.cartographer import act_like_dir -from ..registry import rpc -from ..settings.localization import LANG -from ..state.types import State -from .shared.current import maybe_path_above, new_current_file, new_root -from .shared.index import indices -from .types import Stage - - -async def _jump(state: State, path: PurePath) -> Optional[Stage]: - if new_state := await maybe_path_above(state, paths={path}): - return Stage(new_state, focus=path) - elif stage := await new_current_file(state, current=path): - return Stage(stage.state, focus=path) - else: - return None - - -@rpc(blocking=False) -async def _jump_to_current(state: State, is_visual: bool) -> Optional[Stage]: - """ - Jump to active file - """ - - if not (curr := state.current): - return None - else: - return await _jump(state, path=curr) - - -@rpc(blocking=False) -async def _refocus(state: State, is_visual: bool) -> Stage: - """ - Follow cwd update - """ - - cwd = await Nvim.getcwd() - new_state = await new_root(state, new_cwd=cwd, indices=frozenset()) - focus = new_state.root.path - return Stage(new_state, focus=focus) - - -@rpc(blocking=False) -async def _change_dir(state: State, is_visual: bool) -> Optional[Stage]: - """ - Change root directory - """ - - node = await anext(indices(state, is_visual=is_visual), None) - if not node: - return None - else: - cwd = ( - node.path - if act_like_dir(node, follow_links=state.follow_links) - else node.path.parent - ) - new_state = await new_root(state, new_cwd=cwd, indices=frozenset()) - escaped = await Nvim.fn.fnameescape(str, normcase(new_state.root.path)) - await Nvim.exec(f"chdir {escaped}") - await Nvim.write(LANG("new cwd", cwd=normpath(new_state.root.path))) - return Stage(new_state, focus=new_state.root.path) - - -@rpc(blocking=False) -async def _change_focus(state: State, is_visual: bool) -> Optional[Stage]: - """ - Refocus root directory - """ - - node = await anext(indices(state, is_visual=is_visual), None) - if not node: - return None - else: - new_base = ( - node.path - if act_like_dir(node, follow_links=state.follow_links) - else node.path.parent - ) - new_state = await new_root(state, new_cwd=new_base, indices=frozenset()) - focus = node.path - return Stage(new_state, focus=focus) - - -@rpc(blocking=False) -async def _change_focus_up(state: State, is_visual: bool) -> Optional[Stage]: - """ - Refocus root directory up - """ - - node = await anext(indices(state, is_visual=is_visual), None) - if not node: - return None - else: - new_state = await new_root( - state, new_cwd=state.root.path.parent, indices=frozenset() - ) - return Stage(new_state, focus=node.path) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/help.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/help.py deleted file mode 100644 index 00347dae..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/help.py +++ /dev/null @@ -1,95 +0,0 @@ -from enum import Enum, auto -from pathlib import Path -from typing import Sequence, Tuple -from uuid import uuid4 -from webbrowser import open as open_w - -from pynvim_pp.buffer import Buffer -from pynvim_pp.float_win import list_floatwins, open_float_win -from pynvim_pp.nvim import Nvim -from std2.argparse import ArgparseError, ArgParser -from std2.types import never - -from ..consts import ( - CONFIGURATION_MD, - CONFIGURATION_URI, - FEATURES_MD, - FEATURES_URI, - KEYBIND_MD, - KEYBIND_URI, - MIGRATION_MD, - MIGRATION_URI, - README_MD, - README_URI, - THEME_MD, - THEME_URI, -) -from ..registry import rpc -from ..state.types import State - -_NS = uuid4() - - -class _Topics(Enum): - index = auto() - features = auto() - keybind = auto() - config = auto() - theme = auto() - migration = auto() - - -def _directory(topic: _Topics) -> Tuple[Path, str]: - if topic is _Topics.index: - return README_MD, README_URI - elif topic is _Topics.features: - return FEATURES_MD, FEATURES_URI - elif topic is _Topics.keybind: - return KEYBIND_MD, KEYBIND_URI - elif topic is _Topics.config: - return CONFIGURATION_MD, CONFIGURATION_URI - elif topic is _Topics.theme: - return THEME_MD, THEME_URI - elif topic is _Topics.migration: - return MIGRATION_MD, MIGRATION_URI - else: - never(topic) - - -def _parse_args(args: Sequence[str]) -> Tuple[_Topics, bool]: - parser = ArgParser() - parser.add_argument( - "topic", - nargs="?", - choices=tuple(topic.name for topic in _Topics), - default=_Topics.index.name, - ) - parser.add_argument("-w", "--web", action="store_true", default=False) - ns = parser.parse_args(args) - return _Topics[ns.topic], ns.web - - -@rpc(blocking=False) -async def _help(state: State, args: Sequence[str]) -> None: - """ - Open help doc - """ - - try: - topic, use_web = _parse_args(args) - except ArgparseError as e: - await Nvim.write(e, error=True) - else: - md, uri = _directory(topic) - web_d = open_w(uri) if use_web else False - if not web_d: - async for win in list_floatwins(_NS): - await win.close() - lines = md.read_text("UTF-8").splitlines() - buf = await Buffer.create( - listed=False, scratch=True, wipe=True, nofile=True, noswap=True - ) - await buf.set_lines(lines=lines) - await buf.opts.set("modifiable", val=False) - await buf.opts.set("syntax", val="markdown") - await open_float_win(_NS, margin=0, relsize=0.95, buf=buf, border="rounded") diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/link.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/link.py deleted file mode 100644 index 5c9d4ca6..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/link.py +++ /dev/null @@ -1,79 +0,0 @@ -from os.path import normpath, relpath -from pathlib import PurePath -from typing import MutableMapping, Optional - -from pynvim_pp.nvim import Nvim -from std2 import anext -from std2.locale import pathsort_key - -from ..fs.cartographer import act_like_dir -from ..fs.ops import ancestors, exists, link, resolve -from ..lsp.notify import lsp_created -from ..registry import rpc -from ..settings.localization import LANG -from ..state.next import forward -from ..state.types import State -from ..view.ops import display_path -from .shared.current import maybe_path_above -from .shared.index import indices -from .shared.refresh import refresh -from .types import Stage - - -@rpc(blocking=False) -async def _link(state: State, is_visual: bool) -> Optional[Stage]: - """ - Symlink selected - """ - - node = await anext(indices(state, is_visual=is_visual), None) - if node is None: - return None - else: - parent = ( - node.path - if act_like_dir(node, follow_links=state.follow_links) - else node.path.parent - ) - selection = state.selection or {node.path} - operations: MutableMapping[PurePath, PurePath] = {} - for selected in selection: - display = display_path(selected, state=state) - if child := await Nvim.input( - question=LANG("link", src=display), default="" - ): - try: - dst = await resolve(parent / child, strict=False) - except Exception as e: - await Nvim.write(e, error=True) - return None - else: - if dst in operations or await exists(dst, follow=False): - await Nvim.write( - LANG("already_exists", name=normpath(dst)), error=True - ) - return None - else: - src = PurePath(relpath(selected, start=dst.parent)) - operations[dst] = src - else: - return None - - try: - await link(operations) - except Exception as e: - await Nvim.write(e, error=True) - return await refresh(state) - else: - paths = operations.keys() - new_state = await maybe_path_above(state, paths=paths) or state - await lsp_created(paths) - focus, *_ = sorted(paths, key=pathsort_key) - invalidate_dirs = {path.parent for path in paths} - index = state.index | ancestors(*paths) - next_state = await forward( - new_state, - index=index, - invalidate_dirs=invalidate_dirs, - ) - return Stage(next_state, focus=focus) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/marks.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/marks.py deleted file mode 100644 index a299e89d..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/marks.py +++ /dev/null @@ -1,57 +0,0 @@ -from locale import strxfrm -from pathlib import PurePath -from typing import Any, Iterator, MutableMapping, MutableSet, Optional, Tuple - -from pynvim_pp.nvim import Nvim -from std2.locale import pathsort_key -from std2.pathlib import is_relative_to - -from ..registry import rpc -from ..settings.localization import LANG -from ..state.types import State -from ..view.ops import display_path -from .focus import _jump -from .types import Stage - - -def _order(root: PurePath, marks: str, path: PurePath) -> Tuple[bool, str, Any]: - return not is_relative_to(path, root), "", pathsort_key(path) - - -def _display_path(state: State, marks: str, path: PurePath, idx: int) -> str: - display = display_path(path, state=state) - return f"{idx}. [{marks}] {display}" - - -@rpc(blocking=False) -async def _bookmark_goto(state: State, is_visual: bool) -> Optional[Stage]: - """ - Goto bookmark - """ - - def cont() -> Iterator[Tuple[str, PurePath]]: - root = state.root.path - markers: MutableMapping[str, PurePath] = {} - for path, marks in state.markers.bookmarks.items(): - for mark in marks: - if m := markers.get(mark): - markers[mark] = max(m, path) - else: - markers[mark] = path - - seen: MutableSet[PurePath] = set() - for _, path in sorted(markers.items(), key=lambda kv: _order(root, *kv)): - if path not in seen: - ms = sorted(state.markers.bookmarks.get(path, ()), key=strxfrm) - yield "".join(ms), path - - opts = { - _display_path(state, marks=marks, path=path, idx=idx): path - for idx, (marks, path) in enumerate(cont(), start=1) - } - - if mark := await Nvim.input_list(opts): - return await _jump(state, path=mark) - else: - await Nvim.write(LANG("no_bookmarks"), error=True) - return None diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/new.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/new.py deleted file mode 100644 index 9c183cd2..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/new.py +++ /dev/null @@ -1,68 +0,0 @@ -from os import sep -from os.path import abspath, normpath -from pathlib import PurePath -from typing import Optional - -from pynvim_pp.nvim import Nvim -from std2 import anext - -from ..fs.cartographer import act_like_dir -from ..fs.ops import ancestors, exists, mkdir, new -from ..lsp.notify import lsp_created -from ..registry import rpc -from ..settings.localization import LANG -from ..state.next import forward -from ..state.types import State -from .shared.current import maybe_path_above -from .shared.index import indices -from .shared.refresh import refresh -from .types import Stage - - -@rpc(blocking=False) -async def _new(state: State, is_visual: bool) -> Optional[Stage]: - """ - new file / folder - """ - - node = await anext(indices(state, is_visual=is_visual), None) - if not node: - return None - else: - parent = ( - node.path - if act_like_dir(node, follow_links=state.follow_links) - else node.path.parent - ) - - child = await Nvim.input(question=LANG("pencil"), default="") - - if not child: - return None - else: - path = PurePath(abspath(parent / child)) - if await exists(path, follow=False): - await Nvim.write( - LANG("already_exists", name=normpath(path)), error=True - ) - return None - else: - try: - if child.endswith(sep): - await mkdir((path,)) - else: - await new((path,)) - except Exception as e: - await Nvim.write(e, error=True) - return await refresh(state=state) - else: - new_state = await maybe_path_above(state, paths={path}) or state - invalidate_dirs = {path.parent} - index = state.index | ancestors(path) - next_state = await forward( - new_state, - index=index, - invalidate_dirs=invalidate_dirs, - ) - await lsp_created((path,)) - return Stage(next_state, focus=path) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/noop.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/noop.py deleted file mode 100644 index 707de3fc..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/noop.py +++ /dev/null @@ -1,11 +0,0 @@ -from typing import Any - -from ..registry import rpc -from ..state.types import State - - -@rpc(blocking=False) -async def _noop(state: State, *_: Any) -> None: - """ - NOOP - """ diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/open_system.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/open_system.py deleted file mode 100644 index 50418fe4..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/open_system.py +++ /dev/null @@ -1,52 +0,0 @@ -import sys -from asyncio import create_task -from pathlib import PurePath -from subprocess import CalledProcessError - -from pynvim_pp.logging import suppress_and_log -from pynvim_pp.nvim import Nvim -from std2 import anext -from std2.asyncio.subprocess import call -from std2.pathlib import AnyPath -from std2.platform import OS, os - -from ..fs.ops import which -from ..registry import rpc -from ..settings.localization import LANG -from ..state.types import State -from .shared.index import indices - - -async def _call(cwd: PurePath, arg0: AnyPath, *args: AnyPath) -> None: - try: - await call(arg0, *args, cwd=cwd) - except CalledProcessError as e: - await Nvim.write(e, e.stderr, e.stdout, error=True) - - -async def _open_gui(path: PurePath, cwd: PurePath) -> None: - with suppress_and_log(): - if sys.platform == "win32": - from os import startfile - - startfile(path, cwd=cwd) - elif os is OS.macos and (arg0 := which("open")): - await _call(cwd, arg0, "--", path) - elif os is OS.linux and (arg0 := which("xdg-open")): - await _call(cwd, arg0, path) - else: - await Nvim.write(LANG("sys_open_err")) - - -@rpc(blocking=False) -async def _open_sys(state: State, is_visual: bool) -> None: - """ - Open using finder / dolphin, etc - """ - - node = await anext(indices(state, is_visual=is_visual), None) - if not node: - return None - else: - cwd = await Nvim.getcwd() - create_task(_open_gui(node.path, cwd=cwd)) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/quit.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/quit.py deleted file mode 100644 index 5c82b3bc..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/quit.py +++ /dev/null @@ -1,20 +0,0 @@ -from pynvim_pp.nvim import Nvim -from pynvim_pp.window import Window - -from ..registry import rpc -from ..state.types import State -from .shared.wm import find_fm_windows_in_tab - - -@rpc(blocking=False) -async def _quit(state: State, is_visual: bool) -> None: - """ - Close sidebar - """ - - wins = await Window.list() - if len(wins) <= 1: - await Nvim.exec("quit") - else: - async for win in find_fm_windows_in_tab(state.window_order): - await win.close() diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/redraw.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/redraw.py deleted file mode 100644 index b555a3d2..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/redraw.py +++ /dev/null @@ -1,145 +0,0 @@ -from pathlib import Path, PurePath -from posixpath import sep -from typing import Optional, Sequence -from uuid import uuid4 - -from pynvim_pp.atomic import Atomic -from pynvim_pp.buffer import Buffer -from pynvim_pp.nvim import Nvim -from pynvim_pp.operators import operator_marks -from pynvim_pp.rpc_types import NvimError -from pynvim_pp.types import NoneType -from std2.difflib import trans_inplace -from std2.pickle.decoder import new_decoder -from std2.pickle.types import DecodeError - -from ..consts import URI_SCHEME -from ..state.types import State -from ..view.types import Derived -from .shared.wm import find_fm_windows - - -class UnrecoverableError(Exception): - ... - - -_NS = uuid4() - - -_DECODER = new_decoder[Sequence[str]](Sequence[str]) -_HOME = Path.home() - - -def _buf_name(root: PurePath) -> str: - try: - rel = root.relative_to(_HOME) - except ValueError: - name = root.as_posix() - else: - name = f"~{sep}{rel.as_posix()}" - - return name - - -def _update( - use_extmarks: bool, - buf: Buffer, - ns: int, - derived: Derived, - hashed_lines: Sequence[str], -) -> Atomic: - atomic = Atomic() - for (i1, i2), (j1, j2) in trans_inplace( - src=hashed_lines, dest=derived.hashed, unifying=10 - ): - atomic.buf_clear_namespace(buf, ns, i1, i2) - atomic.buf_set_lines(buf, i1, i2, True, derived.lines[j1:j2]) - - for idx, highlights in enumerate(derived.highlights[j1:j2], start=i1): - for hl in highlights: - atomic.buf_add_highlight(buf, ns, hl.group, idx, hl.begin, hl.end) - - for idx, badges in enumerate(derived.badges[j1:j2], start=i1): - vtxt = tuple((bdg.text, bdg.group) for bdg in badges) - if use_extmarks: - atomic.buf_set_extmark( - buf, ns, idx, -1, {"virt_text": vtxt, "hl_mode": "combine"} - ) - else: - atomic.buf_set_virtual_text(buf, ns, idx, vtxt, {}) - - atomic.buf_set_var(buf, str(_NS), derived.hashed) - return atomic - - -async def redraw(state: State, focus: Optional[PurePath]) -> None: - focus_row = state.derived.path_row_lookup.get(focus) if focus else None - buf_name = _buf_name(state.root.path) - - ns = await Nvim.create_namespace(_NS) - use_extmarks = await Nvim.api.has("nvim-0.6") - - async for win, buf in find_fm_windows(): - is_fm_win = await win.vars.get(bool, URI_SCHEME) - p_count = await buf.line_count() - n_count = len(state.derived.lines) - row, col = await win.get_cursor() - (r1, c1), (r2, c2) = await operator_marks(buf, visual_type=None) - buf_var = await buf.vars.get(NoneType, str(_NS)) - - try: - hashed_lines = _DECODER(buf_var) - except DecodeError: - hashed_lines = ("",) - - if focus_row is not None: - new_row: Optional[int] = focus_row + 1 - elif row >= n_count: - new_row = n_count - elif p_count != n_count: - new_row = row + 1 - else: - new_row = None - - a1 = Atomic() - a1.buf_set_option(buf, "modifiable", True) - - a2 = _update( - use_extmarks, - buf=buf, - ns=ns, - derived=state.derived, - hashed_lines=hashed_lines, - ) - - a3 = Atomic() - a3.buf_set_option(buf, "modifiable", False) - a3.call_function("setpos", ("'<", (buf.number, r1 + 1, c1 + 1, 0))) - a3.call_function("setpos", ("'>", (buf.number, r2 + 1, c2, 0))) - if new_row is not None: - win_height = await win.get_height() - win_lo = await Nvim.fn.line(int, "w0", win) - win_hi = await Nvim.fn.line(int, "w$", win) - lo = max(1, new_row - win_height // 2) - hi = min(n_count, new_row + win_height // 2) - - if new_row < win_lo or new_row > win_hi: - a3.win_set_cursor(win, (lo, 0)) - a3.win_set_cursor(win, (hi, 0)) - a3.win_set_cursor(win, (lo, 0)) - a3.win_set_cursor(win, (hi, 0)) - - a3.win_set_cursor(win, (new_row, col)) - - a3.buf_set_name(buf, f"{URI_SCHEME}://{buf_name}") - a3.win_set_var(win, URI_SCHEME, True) - - if not is_fm_win: - for key, val in state.settings.win_local_opts.items(): - a3.win_set_option(win, key, val) - - a4 = a1 + a2 + a3 - try: - await a4.commit(NoneType) - except NvimError as e: - raise UnrecoverableError(e) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/refresh.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/refresh.py deleted file mode 100644 index e90a610c..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/refresh.py +++ /dev/null @@ -1,23 +0,0 @@ -from contextlib import asynccontextmanager -from typing import AsyncIterator - -from pynvim_pp.nvim import Nvim - -from ..registry import rpc -from ..settings.localization import LANG -from ..state.types import State -from .shared.refresh import refresh as _refresh -from .types import Stage - - -@asynccontextmanager -async def with_manual() -> AsyncIterator[None]: - await Nvim.write(LANG("hourglass")) - yield None - await Nvim.write(LANG("ok_sym")) - - -@rpc(blocking=False) -async def refresh(state: State, is_visual: bool) -> Stage: - async with with_manual(): - return await _refresh(state) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/rename.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/rename.py deleted file mode 100644 index 533f7442..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/rename.py +++ /dev/null @@ -1,75 +0,0 @@ -from os.path import abspath, normpath -from pathlib import PurePath -from typing import Optional - -from pynvim_pp.hold import hold_win -from pynvim_pp.nvim import Nvim -from pynvim_pp.window import Window -from std2 import anext - -from ..fs.ops import ancestors, exists, rename -from ..lsp.notify import lsp_moved -from ..registry import rpc -from ..settings.localization import LANG -from ..state.next import forward -from ..state.types import State -from .shared.current import maybe_path_above -from .shared.index import indices -from .shared.refresh import refresh -from .shared.wm import kill_buffers -from .types import Stage - - -@rpc(blocking=False) -async def _rename(state: State, is_visual: bool) -> Optional[Stage]: - """ - rename file / folder - """ - - node = await anext(indices(state, is_visual=is_visual), None) - if not node: - return None - else: - old_path = node.path - child = await Nvim.input(question=LANG("pencil"), default=old_path.name) - if not child: - return None - else: - new_path = PurePath(abspath(old_path.parent / child)) - operations = {old_path: new_path} - if await exists(new_path, follow=False): - await Nvim.write( - LANG("already_exists", name=normpath(new_path)), error=True - ) - return None - else: - killed = await kill_buffers( - last_used=state.window_order, - paths={old_path}, - reopen={old_path: new_path}, - ) - try: - await rename(operations) - except Exception as e: - await Nvim.write(e, error=True) - return await refresh(state=state) - else: - async with hold_win(win=None): - for win, new_path in killed.items(): - await Window.set_current(win) - escaped = await Nvim.fn.fnameescape(str, normpath(new_path)) - await Nvim.exec(f"edit! {escaped}") - - new_state = await maybe_path_above(state, paths={new_path}) or state - parents = ancestors(new_path) - invalidate_dirs = {old_path.parent, new_path.parent} - index = state.index | parents - new_selection = {new_path} if state.selection else frozenset() - next_state = await forward( - new_state, - index=index, - invalidate_dirs=invalidate_dirs, - selection=new_selection, - ) - await lsp_moved(operations) - return Stage(next_state, focus=new_path) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/resize.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/resize.py deleted file mode 100644 index 15f94afc..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/resize.py +++ /dev/null @@ -1,42 +0,0 @@ -from operator import add, sub -from typing import Callable, Optional - -from pynvim_pp.window import Window - -from ..registry import rpc -from ..state.next import forward -from ..state.types import State -from .shared.wm import is_fm_window, resize_fm_windows -from .types import Stage - - -async def _resize( - state: State, direction: Callable[[int, int], int] -) -> Optional[Stage]: - win = await Window.get_current() - if not await is_fm_window(win): - return None - else: - old_width = await win.get_width() - new_width = max(direction(old_width, 10), 1) - new_state = await forward(state, width=new_width) - await resize_fm_windows(new_state.window_order, width=new_state.width) - return Stage(new_state) - - -@rpc(blocking=False) -async def _bigger(state: State, is_visual: bool) -> Optional[Stage]: - """ - Bigger sidebar - """ - - return await _resize(state, direction=add) - - -@rpc(blocking=False) -async def _smaller(state: State, is_visual: bool) -> Optional[Stage]: - """ - Smaller sidebar - """ - - return await _resize(state, direction=sub) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/schedule_update.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/schedule_update.py deleted file mode 100644 index 7abe265e..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/schedule_update.py +++ /dev/null @@ -1,37 +0,0 @@ -from asyncio import gather -from typing import Optional - -from pynvim_pp.nvim import Nvim -from pynvim_pp.rpc_types import NvimError -from std2.asyncio import pure - -from ..lsp.diagnostics import poll -from ..registry import rpc -from ..state.next import forward -from ..state.ops import dump_session -from ..state.types import State -from ..version_ctl.git import status -from ..version_ctl.types import VCStatus -from .shared.refresh import refresh -from .types import Stage - - -@rpc(blocking=False) -async def scheduled_update(state: State, init: bool = False) -> Optional[Stage]: - cwd = await Nvim.getcwd() - store = dump_session(state) if state.vim_focus else pure(None) - - try: - stage, diagnostics, vc, _ = await gather( - refresh(state=state), - poll(state.settings.min_diagnostics_severity), - status(cwd, prev=state.vc) - if not init and state.enable_vc - else pure(VCStatus()), - store, - ) - except NvimError: - return None - else: - new_state = await forward(stage.state, diagnostics=diagnostics, vc=vc) - return Stage(new_state, focus=stage.focus) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/selection.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/selection.py deleted file mode 100644 index 12e6f051..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/selection.py +++ /dev/null @@ -1,27 +0,0 @@ -from ..registry import rpc -from ..state.next import forward -from ..state.types import State -from .shared.index import indices -from .types import Stage - - -@rpc(blocking=False) -async def _clear_selection(state: State, is_visual: bool) -> Stage: - """ - Clear selected - """ - - new_state = await forward(state, selection=frozenset()) - return Stage(new_state) - - -@rpc(blocking=False) -async def _select(state: State, is_visual: bool) -> Stage: - """ - Folder / File -> select - """ - - nodes = indices(state, is_visual=is_visual) - selection = state.selection ^ {node.path async for node in nodes} - new_state = await forward(state, selection=selection) - return Stage(new_state) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/shared/__init__.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/shared/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/shared/current.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/shared/current.py deleted file mode 100644 index d48f325d..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/shared/current.py +++ /dev/null @@ -1,65 +0,0 @@ -from pathlib import PurePath -from typing import AbstractSet, Iterator, Optional - -from std2.locale import pathsort_key -from std2.pathlib import is_relative_to, longest_common_path - -from ...fs.cartographer import new -from ...fs.ops import ancestors -from ...state.next import forward -from ...state.types import State -from ..types import Stage - - -async def new_current_file(state: State, current: PurePath) -> Stage: - """ - New file focused in buf - """ - - parents = ancestors(current) - if state.root.path in parents: - invalidate_dirs = {current.parent} - index = state.index | parents - new_state = await forward( - state, - index=index, - invalidate_dirs=invalidate_dirs, - current=current, - ) - else: - new_state = await forward(state, current=current) - - focus = current if state.follow else None - return Stage(new_state, focus=focus) - - -async def new_root( - state: State, - new_cwd: PurePath, - indices: AbstractSet[PurePath], -) -> State: - index = state.index | ancestors(new_cwd) | {new_cwd} | indices - root = await new( - state.executor, follow_links=state.follow_links, root=new_cwd, index=index - ) - selection = {path for path in state.selection if root.path in ancestors(path)} - return await forward(state, root=root, selection=selection, index=index) - - -async def maybe_path_above( - state: State, paths: AbstractSet[PurePath] -) -> Optional[State]: - root = state.root.path - if all(is_relative_to(path, root) for path in paths): - return None - else: - - def cont() -> Iterator[PurePath]: - for path in paths: - lcp = longest_common_path(path, root) - yield lcp if lcp else path.parent - - ordered = sorted(cont(), key=pathsort_key) - indices = ancestors(*ordered) - new_cwd, *_ = ordered - return await new_root(state=state, new_cwd=new_cwd, indices=indices) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/shared/index.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/shared/index.py deleted file mode 100644 index bb19675b..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/shared/index.py +++ /dev/null @@ -1,35 +0,0 @@ -from typing import AsyncIterator, Optional - -from pynvim_pp.operators import operator_marks -from pynvim_pp.window import Window - -from ...fs.types import Node -from ...state.types import State -from .wm import is_fm_buffer - - -def _row_index(state: State, row: int) -> Optional[Node]: - if (row >= 0) and (row < len(state.derived.node_row_lookup)): - return state.derived.node_row_lookup[row] - else: - return None - - -async def indices(state: State, is_visual: bool) -> AsyncIterator[Node]: - win = await Window.get_current() - buf = await win.get_buf() - - if not await is_fm_buffer(buf): - return - else: - row, _ = await win.get_cursor() - if node := _row_index(state, row): - yield node - - if is_visual: - (row1, _), (row2, _) = await operator_marks(buf, visual_type=None) - - for r in range(row1, row2 + 1): - if r != row: - if node := _row_index(state, r): - yield node diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/shared/open_file.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/shared/open_file.py deleted file mode 100644 index 819e6ee1..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/shared/open_file.py +++ /dev/null @@ -1,117 +0,0 @@ -from contextlib import suppress -from mimetypes import guess_type -from os.path import getsize, normpath -from pathlib import PurePath -from posixpath import sep -from typing import AsyncContextManager, Optional, cast - -from pynvim_pp.buffer import Buffer -from pynvim_pp.hold import hold_win -from pynvim_pp.nvim import Nvim -from pynvim_pp.window import Window -from std2 import anext -from std2.aitertools import achain, to_async -from std2.contextlib import nullacontext - -from ...settings.localization import LANG -from ...state.next import forward -from ...state.types import State -from ..types import ClickType, Stage -from .wm import ( - find_buffers_with_file, - find_non_fm_windows_in_tab, - find_window_with_file_in_tab, - new_window, - resize_fm_windows, -) - - -async def _show_file(*, state: State, click_type: ClickType) -> None: - if click_type is ClickType.tertiary: - await Nvim.exec("tabnew") - win = await Window.get_current() - for key, val in state.settings.win_actual_opts.items(): - await win.opts.set(key, val=val) - - if path := state.current: - mgr = ( - cast(AsyncContextManager[None], hold_win(win=None)) - if click_type is ClickType.secondary - else nullacontext(None) - ) - async with mgr: - non_fm_windows = [ - win - async for win in find_non_fm_windows_in_tab( - last_used=state.window_order - ) - ] - buf = await anext(find_buffers_with_file(file=path), None) - win = await anext( - achain( - find_window_with_file_in_tab( - last_used=state.window_order, file=path - ), - to_async(non_fm_windows), - ), - cast(Window, None), - ) or await new_window( - last_used=state.window_order, - win_local=state.settings.win_actual_opts, - open_left=not state.settings.open_left, - width=None - if len(non_fm_windows) - else await Nvim.opts.get(int, "columns") - state.width - 1, - ) - - await Window.set_current(win) - non_fm_count = len(non_fm_windows) - - if click_type is ClickType.v_split and non_fm_count: - await Nvim.exec("vnew") - temp_buf = await Buffer.get_current() - await temp_buf.opts.set("bufhidden", val="wipe") - elif click_type is ClickType.h_split and non_fm_count: - await Nvim.exec("new") - temp_buf = await Buffer.get_current() - await temp_buf.opts.set("bufhidden", val="wipe") - - win = await Window.get_current() - - if buf: - await win.set_buf(buf) - else: - escaped = await Nvim.fn.fnameescape(str, normpath(path)) - await Nvim.exec(f"edit! {escaped}") - - await resize_fm_windows(last_used=state.window_order, width=state.width) - - -async def open_file( - state: State, path: PurePath, click_type: ClickType -) -> Optional[Stage]: - mime, _ = guess_type(path.name, strict=False) - m_type, _, _ = (mime or "").partition(sep) - - with suppress(OSError): - size = getsize(path) - - question = LANG("mime_warn", name=path.name, mime=str(mime)) - - go = ( - await Nvim.confirm( - question=question, - answers=LANG("ask_yesno"), - answer_key={1: True, 2: False}, - ) - if m_type in state.settings.mime.warn - and path.suffix not in state.settings.mime.allow_exts - else True - ) - - if go: - new_state = await forward(state, current=path) - await _show_file(state=new_state, click_type=click_type) - return Stage(new_state, focus=path) - else: - return None diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/shared/refresh.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/shared/refresh.py deleted file mode 100644 index 51202266..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/shared/refresh.py +++ /dev/null @@ -1,78 +0,0 @@ -from asyncio import gather -from pathlib import PurePath -from typing import AbstractSet, Mapping - -from pynvim_pp.rpc_types import ExtData -from pynvim_pp.window import Window -from std2.types import Void - -from ...fs.ops import ancestors, exists_many -from ...nvim.markers import markers -from ...state.next import forward -from ...state.types import State -from ..shared.wm import find_current_buffer_path -from ..types import Stage - - -async def _index(state: State, paths: AbstractSet[PurePath]) -> AbstractSet[PurePath]: - index = { - path - for path, exists in (await exists_many(state.index, follow=True)).items() - if exists - } | paths - - return index - - -async def _selection(state: State) -> AbstractSet[PurePath]: - selection = { - selected - for selected, exists in ( - await exists_many(state.selection, follow=False) - ).items() - if exists - } - - return selection - - -async def _window_order(state: State) -> Mapping[ExtData, None]: - window_ids = {w.data for w in await Window.list()} - window_order = { - win_id: None for win_id in state.window_order if win_id in window_ids - } - return window_order - - -async def refresh(state: State) -> Stage: - cwd = state.root.path - invalidate_dirs = {cwd} - - current, index, selection, window_order, mks = await gather( - find_current_buffer_path(), - _index(state, paths=invalidate_dirs), - _selection(state), - _window_order(state), - markers(), - ) - current_ancestors = ancestors(current) if current else frozenset() - new_current = current if cwd in current_ancestors else None - - parent_paths: AbstractSet[PurePath] = ( - current_ancestors if state.follow else frozenset() - ) - new_index = index if new_current else index | parent_paths - focus = current if state.follow else None - - new_state = await forward( - state, - index=new_index, - selection=selection, - markers=mks, - invalidate_dirs=invalidate_dirs, - current=new_current or Void, - window_order=window_order, - trace=False, - ) - - return Stage(new_state, focus=focus) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/shared/wm.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/shared/wm.py deleted file mode 100644 index db509e93..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/shared/wm.py +++ /dev/null @@ -1,254 +0,0 @@ -from contextlib import suppress -from math import inf -from pathlib import PurePath -from typing import ( - AbstractSet, - AsyncIterator, - Mapping, - Optional, - Sequence, - Tuple, - Union, - cast, -) -from urllib.parse import urlsplit - -from pynvim_pp.atomic import Atomic -from pynvim_pp.buffer import Buffer -from pynvim_pp.keymap import Keymap -from pynvim_pp.lib import resolve_path -from pynvim_pp.nvim import Nvim -from pynvim_pp.rpc_types import ExtData -from pynvim_pp.tabpage import Tabpage -from pynvim_pp.types import NoneType -from pynvim_pp.window import Window - -from ...consts import FM_FILETYPE, URI_SCHEME -from ...fs.ops import ancestors -from ...settings.types import Settings - - -def is_fm_buf_name(name: str) -> bool: - with suppress(ValueError): - uri = urlsplit(name) - return uri.scheme == URI_SCHEME - return False - - -async def is_fm_buffer(buf: Buffer) -> bool: - ft = await buf.filetype() - if ft == FM_FILETYPE: - return True - elif name := await buf.get_name(): - return is_fm_buf_name(name) - - return False - - -async def is_fm_window(win: Window) -> bool: - buf = await win.get_buf() - return await is_fm_buffer(buf) - - -async def find_windows_in_tab( - last_used: Mapping[ExtData, None], no_secondary: bool -) -> AsyncIterator[Window]: - ordering = {win_id: idx for idx, win_id in enumerate(reversed(last_used.keys()))} - tab = await Tabpage.get_current() - wins = await tab.list_wins() - - atomic = Atomic() - for win in wins: - atomic.win_get_position(win) - pos = cast(Sequence[Tuple[int, int]], await atomic.commit(NoneType)) - positions = {win.data: rc for win, rc in zip(wins, pos)} - - def key_by(win: Window) -> Tuple[float, float, float]: - """ - -> sort by last_used, then row, then col - """ - - order = ordering.get(win.data, inf) - row, col = positions.get(win.data, (inf, inf)) - return order, col, row - - ordered = sorted(wins, key=key_by) - - for win in ordered: - is_preview = await win.opts.get(bool, "previewwindow") - buf = await win.get_buf() - ft = await buf.filetype() - is_secondary = is_preview or ft == "qf" - if not is_secondary or not no_secondary: - yield win - - -async def find_fm_windows() -> AsyncIterator[Tuple[Window, Buffer]]: - for win in await Window.list(): - buf = await win.get_buf() - if await is_fm_buffer(buf): - yield win, buf - - -async def find_fm_windows_in_tab( - last_used: Mapping[ExtData, None] -) -> AsyncIterator[Window]: - async for win in find_windows_in_tab(last_used, no_secondary=True): - buf = await win.get_buf() - if await is_fm_buffer(buf): - yield win - - -async def find_non_fm_windows_in_tab( - last_used: Mapping[ExtData, None] -) -> AsyncIterator[Window]: - async for win in find_windows_in_tab(last_used, no_secondary=True): - buf = await win.get_buf() - if not await is_fm_buffer(buf): - yield win - - -async def find_window_with_file_in_tab( - last_used: Mapping[ExtData, None], file: PurePath -) -> AsyncIterator[Window]: - async for win in find_windows_in_tab(last_used, no_secondary=True): - buf = await win.get_buf() - if name := await buf.get_name(): - if PurePath(name) == file: - yield win - - -async def find_fm_buffers() -> AsyncIterator[Buffer]: - for buf in await Buffer.list(listed=True): - if await is_fm_buffer(buf): - yield buf - - -async def find_buffers_with_file(file: PurePath) -> AsyncIterator[Buffer]: - for buf in await Buffer.list(listed=True): - if name := await buf.get_name(): - if PurePath(name) == file: - yield buf - - -async def find_current_buffer_path( - buf_name: Optional[str] = None, -) -> Optional[PurePath]: - if buf_name is None: - buf = await Buffer.get_current() - buf_name = await buf.get_name() - - if buf_name and not is_fm_buf_name(buf_name): - return await resolve_path(None, path=buf_name) - - return None - - -async def setup_fm_buf(settings: Settings, buf: Buffer) -> None: - await buf.opts.set("modifiable", val=False) - await buf.opts.set("filetype", val=FM_FILETYPE) - await buf.opts.set("undolevels", val=-1) - - km = Keymap() - _ = km.n("{") << f"{settings.page_increment}g" - _ = km.n("}") << f"{settings.page_increment}g" - for function, mappings in settings.keymap.items(): - for mapping in mappings: - _ = ( - km.n(mapping, noremap=True, silent=True, nowait=True) - << f"lua {function}(false)" - ) - _ = ( - km.v(mapping, noremap=True, silent=True, nowait=True) - << rf"lua {function}(true)" - ) - - await km.drain(buf=buf).commit(NoneType) - - -async def new_fm_buffer(settings: Settings) -> Buffer: - buf = await Buffer.create( - listed=False, scratch=True, wipe=False, nofile=True, noswap=True - ) - await setup_fm_buf(settings, buf=buf) - return buf - - -async def restore_non_fm_win( - win_local: Mapping[str, Union[bool, str]], win: Window -) -> None: - await win.vars.set(URI_SCHEME, False) - for key, val in win_local.items(): - await win.opts.set(key, val=val) - - -async def new_window( - *, - last_used: Mapping[ExtData, None], - win_local: Mapping[str, Union[bool, str]], - open_left: bool, - width: Optional[int], -) -> Window: - split_r = await Nvim.opts.get(bool, "splitright") - - wins = [win async for win in find_windows_in_tab(last_used, no_secondary=False)] - focus_win = wins[0] if open_left else wins[-1] - direction = False if open_left else True - - await Nvim.opts.set("splitright", val=direction) - await Window.set_current(focus_win) - await Nvim.exec(f"{width}vnew" if width else "vnew") - await Nvim.opts.set("splitright", val=split_r) - - win = await Window.get_current() - buf = await win.get_buf() - await restore_non_fm_win(win_local, win=win) - await buf.opts.set("bufhidden", val="wipe") - return win - - -async def resize_fm_windows(last_used: Mapping[ExtData, None], width: int) -> None: - async for win in find_fm_windows_in_tab(last_used): - await win.set_width(width) - - -async def kill_buffers( - last_used: Mapping[ExtData, None], - paths: AbstractSet[PurePath], - reopen: Mapping[PurePath, PurePath], -) -> Mapping[Window, PurePath]: - active = ( - { - await win.get_buf(): win - async for win in find_non_fm_windows_in_tab( - last_used, - ) - } - if reopen - else {} - ) - - async def cont() -> AsyncIterator[Tuple[Window, PurePath]]: - for buf in await Buffer.list(listed=True): - if bufname := await buf.get_name(): - name = PurePath(bufname) - buf_paths = ancestors(name) | {name} - - if not buf_paths.isdisjoint(paths): - if ( - reopen - and (win := active.get(buf)) - and (new_path := reopen.get(name)) - ): - tmp = await Buffer.create( - listed=False, - scratch=True, - wipe=True, - nofile=True, - noswap=True, - ) - await win.set_buf(tmp) - yield win, new_path - await buf.delete() - - return {win: path async for win, path in cont()} diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/stat.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/stat.py deleted file mode 100644 index 30c5c124..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/stat.py +++ /dev/null @@ -1,35 +0,0 @@ -from pynvim_pp.nvim import Nvim -from std2 import anext -from std2.locale import si_prefixed - -from ..fs.ops import fs_stat -from ..registry import rpc -from ..state.types import State -from ..view.ops import display_path -from .shared.index import indices - - -@rpc(blocking=False) -async def _stat(state: State, is_visual: bool) -> None: - """ - Print file stat to cmdline - """ - - node = await anext(indices(state, is_visual=is_visual), None) - if not node: - return None - else: - try: - stat = await fs_stat(node.path) - except Exception as e: - await Nvim.write(e, error=True) - else: - permissions = stat.permissions - size = si_prefixed(stat.size, precision=2) - user = stat.user - group = stat.group - mtime = stat.date_mod.strftime(state.settings.view.time_fmt) - name = display_path(node.path, state=state) - full_name = f"{name} -> {stat.link}" if stat.link else name - mode_line = f"{permissions} {size}b {user} {group} {mtime} {full_name}" - await Nvim.write(mode_line) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/toggle_exec.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/toggle_exec.py deleted file mode 100644 index be3f64d7..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/toggle_exec.py +++ /dev/null @@ -1,43 +0,0 @@ -from os import chmod, stat, stat_result -from pathlib import PurePath -from stat import S_ISDIR, S_IXGRP, S_IXOTH, S_IXUSR -from typing import Iterator, Tuple - -from ..fs.cartographer import act_like_dir -from ..registry import rpc -from ..state.next import forward -from ..state.types import State -from .shared.index import indices -from .types import Stage - - -@rpc(blocking=False) -async def _toggle_exec(state: State, is_visual: bool) -> Stage: - """ - Toggle chmod +-x - """ - - selected = state.selection or { - node.path - async for node in indices(state, is_visual=is_visual) - if not act_like_dir(node, follow_links=state.follow_links) - } - - def cont() -> Iterator[Tuple[PurePath, stat_result]]: - for path in selected: - try: - st = stat(path) - except FileNotFoundError: - pass - else: - if not S_ISDIR(st.st_mode): - yield path, st - - stats = {path: st for path, st in cont()} - - for path, st in stats.items(): - chmod(path, st.st_mode ^ S_IXUSR ^ S_IXGRP ^ S_IXOTH) - - invalidate_dirs = {path.parent for path in stats.keys()} - new_state = await forward(state, invalidate_dirs=invalidate_dirs) - return Stage(state=new_state) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/toggle_open.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/toggle_open.py deleted file mode 100644 index 2e1b46fc..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/toggle_open.py +++ /dev/null @@ -1,184 +0,0 @@ -from dataclasses import dataclass -from pathlib import PurePath -from subprocess import CalledProcessError -from typing import Mapping, Optional, Sequence - -from pynvim_pp.nvim import Nvim -from pynvim_pp.rpc_types import ExtData -from pynvim_pp.window import Window -from std2 import anext -from std2.argparse import ArgparseError, ArgParser - -from ..fs.ops import exists, new, which -from ..registry import rpc -from ..settings.localization import LANG -from ..settings.types import Settings -from ..state.types import State -from ..version_ctl.git import root as version_ctl_toplv -from .shared.current import maybe_path_above, new_current_file, new_root -from .shared.open_file import open_file -from .shared.wm import ( - find_current_buffer_path, - find_fm_buffers, - find_fm_windows_in_tab, - find_windows_in_tab, - new_fm_buffer, - new_window, - resize_fm_windows, -) -from .types import ClickType, Stage - - -@dataclass(frozen=True) -class _Args: - path: Optional[PurePath] - version_ctl: bool - toggle: bool - focus: bool - - -def _parse_args(args: Sequence[str]) -> _Args: - parser = ArgParser() - parser.add_argument("path", nargs="?", type=PurePath) - parser.add_argument("--version-ctl", action="store_true") - - focus_group = parser.add_mutually_exclusive_group() - focus_group.add_argument( - "--always-focus", dest="toggle", action="store_false", default=True - ) - focus_group.add_argument( - "--nofocus", dest="focus", action="store_false", default=True - ) - - ns = parser.parse_args(args=args) - opts = _Args( - path=ns.path, - version_ctl=ns.version_ctl, - toggle=False if ns.version_ctl or ns.path else ns.toggle, - focus=ns.focus, - ) - return opts - - -async def _ensure_side_window( - *, - settings: Settings, - window_order: Mapping[ExtData, None], - width: int, - window: Window, -) -> None: - open_left = settings.open_left - windows = [ - win - async for win in find_windows_in_tab(last_used=window_order, no_secondary=False) - ] - target = windows[0] if open_left else windows[-1] - if window.data != target.data: - if open_left: - await Nvim.exec("wincmd H") - else: - await Nvim.exec("wincmd L") - await resize_fm_windows(last_used=window_order, width=width) - - -async def _open_fm_window( - settings: Settings, - window_order: Mapping[ExtData, None], - opts: _Args, - width: int, -) -> None: - cwin = await Window.get_current() - win = await anext(find_fm_windows_in_tab(last_used=window_order), None) - if win: - if opts.toggle: - wins = await Window.list() - if len(wins) > 1: - await win.close() - else: - await Window.set_current(win) - else: - buf = await anext(find_fm_buffers(), None) - if not buf: - buf = await new_fm_buffer(settings=settings) - - win = await new_window( - last_used=window_order, - win_local=settings.win_actual_opts, - open_left=settings.open_left, - width=width, - ) - - await win.set_buf(buf) - - await _ensure_side_window( - window=win, settings=settings, window_order=window_order, width=width - ) - if not opts.focus: - await Window.set_current(cwin) - - -@rpc(blocking=False) -async def _open(state: State, args: Sequence[str]) -> Optional[Stage]: - """ - Toggle sidebar - """ - - try: - opts = _parse_args(args) - except ArgparseError as e: - await Nvim.write(e, error=True) - return None - else: - if opts.version_ctl: - if git := which("git"): - try: - cwd = await version_ctl_toplv(git, cwd=state.root.path) - new_state = await new_root( - state=state, new_cwd=cwd, indices=frozenset() - ) - except CalledProcessError: - await Nvim.write(LANG("cannot find version ctl root"), error=True) - return None - else: - await Nvim.write(LANG("cannot find version ctl root"), error=True) - return None - else: - new_state = state - - if opts.path: - path = ( - opts.path - if opts.path.is_absolute() - else await Nvim.getcwd() / opts.path - ) - if not await exists(path, follow=True): - await new((path,)) - next_state = await maybe_path_above(new_state, paths={path}) or new_state - await _open_fm_window( - state.settings, - opts=opts, - window_order=new_state.window_order, - width=next_state.width, - ) - await open_file( - state=state, - path=path, - click_type=ClickType.primary, - ) - return Stage(next_state, focus=path) - else: - curr = await find_current_buffer_path() - stage = ( - await new_current_file(state=new_state, current=curr) if curr else None - ) - await _open_fm_window( - state.settings, - opts=opts, - window_order=new_state.window_order, - width=new_state.width, - ) - return ( - Stage(stage.state, focus=curr) - if stage - else Stage(new_state, focus=curr) - ) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/toggles.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/toggles.py deleted file mode 100644 index 13478416..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/toggles.py +++ /dev/null @@ -1,78 +0,0 @@ -from typing import Optional, Union - -from pynvim_pp.nvim import Nvim -from std2 import anext -from std2.types import Void, VoidType - -from ..registry import rpc -from ..settings.localization import LANG -from ..state.next import forward -from ..state.types import Selection, State -from ..version_ctl.types import VCStatus -from .shared.index import indices -from .types import Stage - - -@rpc(blocking=False) -async def _toggle_hidden(state: State, is_visual: bool) -> Optional[Stage]: - """ - Toggle hidden - """ - - node = await anext(indices(state, is_visual=is_visual)) - if not node: - return None - else: - focus = node.path - show_hidden = not state.show_hidden - selection: Selection = state.selection if show_hidden else frozenset() - new_state = await forward(state, show_hidden=show_hidden, selection=selection) - return Stage(new_state, focus=focus) - - -@rpc(blocking=False) -async def _toggle_follow(state: State, is_visual: bool) -> Stage: - """ - Toggle follow - """ - - new_state = await forward(state, follow=not state.follow) - await Nvim.write(LANG("follow_mode_indi", follow=str(new_state.follow))) - return Stage(new_state) - - -@rpc(blocking=False) -async def _toggle_follow_links(state: State, is_visual: bool) -> Stage: - """ - Toggle --follow - """ - - follow_links = not state.follow_links - new_state = await forward(state, follow_links=follow_links) - await Nvim.write(LANG("follow_links_indi", follow=str(new_state.follow_links))) - return Stage(new_state) - - -@rpc(blocking=False) -async def _toggle_follow_ignore(state: State, is_visual: bool) -> Stage: - """ - Toggle --follow - """ - - follow_links = not state.follow_links - new_state = await forward(state, follow_links=follow_links) - await Nvim.write(LANG("follow_ignore_indi", follow=str(new_state.follow_links))) - return Stage(new_state) - - -@rpc(blocking=False) -async def _toggle_version_control(state: State, is_visual: bool) -> Stage: - """ - Toggle version control - """ - - enable_vc = not state.enable_vc - vc: Union[VoidType, VCStatus] = Void if enable_vc else VCStatus() - new_state = await forward(state, enable_vc=enable_vc, vc=vc) - await Nvim.write(LANG("version_control_indi", enable_vc=str(new_state.enable_vc))) - return Stage(new_state) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/types.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/types.py deleted file mode 100644 index abc8e376..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/transitions/types.py +++ /dev/null @@ -1,20 +0,0 @@ -from dataclasses import dataclass -from enum import Enum, auto -from pathlib import PurePath -from typing import Optional - -from ..state.types import State - - -class ClickType(Enum): - primary = auto() - secondary = auto() - tertiary = auto() - v_split = auto() - h_split = auto() - - -@dataclass(frozen=True) -class Stage: - state: State - focus: Optional[PurePath] = None diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/version_ctl/__init__.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/version_ctl/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/version_ctl/git.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/version_ctl/git.py deleted file mode 100644 index ca2c9540..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/version_ctl/git.py +++ /dev/null @@ -1,189 +0,0 @@ -from asyncio import gather -from functools import lru_cache -from itertools import chain -from locale import strxfrm -from os import linesep -from os.path import normpath -from pathlib import PurePath -from string import whitespace -from subprocess import CalledProcessError -from typing import ( - Iterable, - Iterator, - MutableMapping, - MutableSequence, - MutableSet, - Sequence, - Tuple, -) - -from std2.asyncio import to_thread -from std2.pathlib import ROOT -from std2.string import removeprefix, removesuffix - -from ..fs.ops import ancestors, which -from .nice import nice_call -from .types import VCStatus - -_Stats = Iterable[Tuple[str, PurePath]] - -_WHITE_SPACES = {*whitespace} -_GIT_LIST_CMD = ( - "--no-optional-locks", - "status", - "--ignored", - "--renames", - "--porcelain", - "-z", -) - - -_GIT_SUBMODULE_MARKER = "Entering " -_SUBMODULE_MARKER = "S" -_IGNORED_MARKER = "I" -_UNTRACKED_MARKER = "?" - - -async def root(git: PurePath, cwd: PurePath) -> PurePath: - stdout = await nice_call( - ( - git, - "--no-optional-locks", - "rev-parse", - "--path-format=relative", - "--show-toplevel", - ), - cwd=cwd, - ) - return PurePath(normpath(cwd / stdout.rstrip())) - - -@lru_cache(maxsize=1) -def _parse_stats_main(stdout: str) -> Sequence[Tuple[str, PurePath]]: - def cont() -> Iterator[Tuple[str, PurePath]]: - it = iter(stdout.split("\0")) - for line in it: - prefix, file = line[:2], line[3:] - yield prefix, PurePath(file) - - if "R" in prefix: - next(it, None) - - return tuple(cont()) - - -async def _stat_main(git: PurePath, cwd: PurePath) -> str: - stdout = await nice_call((git, *_GIT_LIST_CMD), cwd=cwd) - return stdout - - -@lru_cache(maxsize=1) -def _parse_sub_modules(stdout: str) -> Sequence[Tuple[str, PurePath]]: - def cont() -> Iterator[Tuple[str, PurePath]]: - it = iter(stdout) - sub_module = ROOT - acc: MutableSequence[str] = [] - - for char in it: - if char == linesep: - line = "".join(acc) - acc.clear() - - if not line.startswith(_GIT_SUBMODULE_MARKER): - raise ValueError(stdout) - else: - quoted = removeprefix(line, prefix=_GIT_SUBMODULE_MARKER) - if not (quoted.startswith("'") and quoted.endswith("'")): - raise ValueError(stdout) - else: - sub_module = PurePath( - removesuffix(removeprefix(quoted, prefix="'"), suffix="'") - ) - yield _SUBMODULE_MARKER, sub_module - - elif char == "\0": - line = "".join(acc) - acc.clear() - - if not sub_module: - raise ValueError(stdout) - else: - prefix, file = line[:2], line[3:] - yield prefix, sub_module / file - - if "R" in prefix: - next(it, None) - else: - acc.append(char) - - return tuple(cont()) - - -async def _stat_sub_modules(git: PurePath, cwd: PurePath) -> str: - stdout = await nice_call( - ( - git, - "--no-optional-locks", - "submodule", - "foreach", - "--recursive", - git, - *_GIT_LIST_CMD, - ), - cwd=cwd, - ) - return stdout - - -def _stat_name(stat: str) -> str: - markers = { - "!!": _IGNORED_MARKER, - "??": _UNTRACKED_MARKER, - } - return markers.get(stat, stat) - - -def _parse(root: PurePath, stats: _Stats) -> VCStatus: - above = ancestors(root) - ignored: MutableSet[PurePath] = set() - status: MutableMapping[PurePath, str] = {} - directories: MutableMapping[PurePath, MutableSet[str]] = {} - - for stat, name in stats: - path = root / name - status[path] = _stat_name(stat) - if "!" in stat: - ignored.add(path) - else: - for ancestor in ancestors(path): - parents = directories.setdefault(ancestor, set()) - if stat != _SUBMODULE_MARKER: - for sym in stat: - parents.add(sym) - - for directory, syms in directories.items(): - pre_existing = {*status.get(directory, "")} - symbols = pre_existing | syms - _WHITE_SPACES - consoildated = sorted(symbols, key=strxfrm) - status[directory] = "".join(consoildated) - - trimmed = {path: stat for path, stat in status.items() if path not in above} - return VCStatus(ignored=ignored, status=trimmed) - - -async def status(cwd: PurePath, prev: VCStatus) -> VCStatus: - if git := which("git"): - bin = PurePath(git) - try: - raw_root, main, submodules = await gather( - root(bin, cwd=cwd), - _stat_main(bin, cwd=cwd), - _stat_sub_modules(bin, cwd=cwd), - ) - stats = chain((_parse_stats_main(main)), _parse_sub_modules(submodules)) - except CalledProcessError: - return VCStatus() - else: - return await to_thread(lambda: _parse(raw_root, stats=stats)) - else: - return VCStatus() diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/version_ctl/nice.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/version_ctl/nice.py deleted file mode 100644 index de1c3472..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/version_ctl/nice.py +++ /dev/null @@ -1,42 +0,0 @@ -import sys -from contextlib import suppress -from os import environ -from pathlib import PurePath -from typing import Optional, Sequence - -from pynvim_pp.lib import decode -from std2.asyncio.subprocess import call -from std2.pathlib import AnyPath - -if sys.platform == "win32": - from subprocess import BELOW_NORMAL_PRIORITY_CLASS - - nice = lambda _: None -else: - from os import nice - - BELOW_NORMAL_PRIORITY_CLASS = 0 - - -_ENV = {**environ, "LC_ALL": "C"} - - -def _nice() -> None: - with suppress(PermissionError): - nice(19) - - -async def nice_call( - argv: Sequence[AnyPath], - stdin: Optional[bytes] = None, - cwd: Optional[PurePath] = None, -) -> str: - proc = await call( - *argv, - cwd=cwd, - stdin=stdin, - env=_ENV, - preexec_fn=_nice, - creationflags=BELOW_NORMAL_PRIORITY_CLASS, - ) - return decode(proc.stdout) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/version_ctl/types.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/version_ctl/types.py deleted file mode 100644 index aa9378d3..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/version_ctl/types.py +++ /dev/null @@ -1,12 +0,0 @@ -from dataclasses import dataclass, field -from pathlib import PurePath -from typing import AbstractSet, Mapping, MutableMapping - - -@dataclass(frozen=True) -class VCStatus: - main: str = "" - submodules: str = "" - ignored: AbstractSet[PurePath] = frozenset() - status: Mapping[PurePath, str] = field(default_factory=dict) - ignore_cache: MutableMapping[PurePath, bool] = field(default_factory=dict) diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/view/__init__.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/view/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/view/highlight.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/view/highlight.py deleted file mode 100644 index 301e5f47..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/view/highlight.py +++ /dev/null @@ -1,27 +0,0 @@ -from typing import Iterator, Mapping, Tuple -from uuid import uuid4 - -from pynvim_pp.highlight import HLgroup - -from ..consts import FM_HL_PREFIX - -LEGAL_CTERM = { - "bold", - "underline", - "undercurl", - "strikethrough", - "reverse", - "italic", - "standout", -} - -LEGAL_CTERM_COLOURS = range(8) - - -def gen_hl(name_prefix: str, mapping: Mapping[str, str]) -> Mapping[str, HLgroup]: - def cont() -> Iterator[Tuple[str, HLgroup]]: - for key, val in mapping.items(): - name = f"{FM_HL_PREFIX}_{name_prefix}_{uuid4().hex}" - yield key, HLgroup(name=name, guifg=val) - - return {k: v for k, v in cont()} diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/view/load.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/view/load.py deleted file mode 100644 index ae7b8032..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/view/load.py +++ /dev/null @@ -1,118 +0,0 @@ -from itertools import chain -from os import environ -from typing import Mapping, Tuple, TypeVar, Union - -from pynvim_pp.highlight import HLgroup -from std2.types import never - -from chad_types import ( - Artifact, - IconColourSetEnum, - IconGlyphs, - IconGlyphSetEnum, - LSColoursEnum, - TextColourSetEnum, -) - -from ..consts import FM_HL_PREFIX -from .highlight import gen_hl -from .ls_colours import parse_lsc -from .types import HLcontext, HLGroups - -T = TypeVar("T") - - -def _trans(mapping: Mapping[T, HLgroup]) -> Mapping[T, str]: - return {k: v.name for k, v in mapping.items()} - - -def load_theme( - artifact: Artifact, - particular_mappings: HLGroups, - discrete_colours: Mapping[str, str], - icon_set: IconGlyphSetEnum, - icon_colour_set: IconColourSetEnum, - text_colour_set: Union[LSColoursEnum, TextColourSetEnum], -) -> Tuple[IconGlyphs, HLcontext]: - if icon_set is IconGlyphSetEnum.ascii: - icons = artifact.icons.ascii - elif icon_set is IconGlyphSetEnum.ascii_hollow: - icons = artifact.icons.ascii_hollow - elif icon_set is IconGlyphSetEnum.devicons: - icons = artifact.icons.devicons - elif icon_set is IconGlyphSetEnum.emoji: - icons = artifact.icons.emoji - else: - never(icon_set) - - if text_colour_set is LSColoursEnum.env and "LS_COLORS" not in environ: - text_colour_set = LSColoursEnum.solarized_dark_256 - - if isinstance(text_colour_set, LSColoursEnum): - if text_colour_set is LSColoursEnum.env: - _lsc = environ.get("LS_COLORS", "") - elif text_colour_set is LSColoursEnum.solarized_dark_256: - _lsc = artifact.ls_colours.solarized_dark_256 - elif text_colour_set is LSColoursEnum.solarized_light: - _lsc = artifact.ls_colours.solarized_light - elif text_colour_set is LSColoursEnum.solarized_dark: - _lsc = artifact.ls_colours.solarized_dark - elif text_colour_set is LSColoursEnum.solarized_universal: - _lsc = artifact.ls_colours.solarized_universal - elif text_colour_set is LSColoursEnum.nord: - _lsc = artifact.ls_colours.nord - elif text_colour_set is LSColoursEnum.trapdoor: - _lsc = artifact.ls_colours.trapdoor - else: - never(text_colour_set) - - lsc = parse_lsc(_lsc, discrete_colours=discrete_colours) - mode_pre = lsc.mode_pre - mode_post = lsc.mode_post - ext_exact = lsc.exts - name_exact: Mapping[str, HLgroup] = {} - name_glob = lsc.name_glob - else: - if text_colour_set is TextColourSetEnum.nerdtree_syntax_light: - text_colour = artifact.text_colours.nerdtree_syntax_light - elif text_colour_set is TextColourSetEnum.nerdtree_syntax_dark: - text_colour = artifact.text_colours.nerdtree_syntax_dark - else: - never(text_colour_set) - - mode_pre = {} - mode_post = {} - ext_exact = gen_hl(FM_HL_PREFIX, mapping=text_colour.ext_exact) - name_exact = gen_hl(FM_HL_PREFIX, mapping=text_colour.name_exact) - name_glob = gen_hl(FM_HL_PREFIX, mapping=text_colour.name_glob) - - if icon_colour_set is IconColourSetEnum.github: - icon_exts = gen_hl(FM_HL_PREFIX, mapping=artifact.icon_colours.github) - elif icon_colour_set is IconColourSetEnum.none: - icon_exts = gen_hl(FM_HL_PREFIX, mapping={}) - else: - never(icon_colour_set) - - groups = tuple( - chain( - icon_exts.values(), - mode_pre.values(), - mode_post.values(), - ext_exact.values(), - name_exact.values(), - name_glob.values(), - ), - ) - - context = HLcontext( - groups=groups, - icon_exts=_trans(icon_exts), - mode_pre=_trans(mode_pre), - mode_post=_trans(mode_post), - ext_exact=_trans(ext_exact), - name_exact=_trans(name_exact), - name_glob=_trans(name_glob), - particular_mappings=particular_mappings, - ) - - return icons, context diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/view/ls_colours.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/view/ls_colours.py deleted file mode 100644 index 815b6f8f..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/view/ls_colours.py +++ /dev/null @@ -1,303 +0,0 @@ -from dataclasses import dataclass -from enum import Enum, IntEnum, auto -from itertools import chain, repeat -from typing import ( - AbstractSet, - Callable, - Iterator, - Mapping, - MutableMapping, - MutableSet, - Optional, - Tuple, - Union, -) -from uuid import uuid4 - -from pynvim_pp.highlight import HLgroup -from std2.coloursys import rgb_to_hex - -from ..consts import FM_HL_PREFIX -from ..fs.types import Mode - - -class _Style(IntEnum): - bold = auto() - dimmed = auto() - italic = auto() - underline = auto() - blink = auto() - blink_fast = auto() - reverse = auto() - hidden = auto() - strikethrough = auto() - - -class _Ground(Enum): - fore = auto() - back = auto() - - -class _AnsiColour(IntEnum): - black = auto() - red = auto() - green = auto() - yellow = auto() - blue = auto() - magenta = auto() - cyan = auto() - white = auto() - - bright_black = auto() - bright_red = auto() - bright_green = auto() - bright_yellow = auto() - bright_blue = auto() - bright_magenta = auto() - bright_cyan = auto() - bright_white = auto() - - -@dataclass(frozen=True) -class _Colour: - r: int - g: int - b: int - - -@dataclass(frozen=True) -class _Styling: - styles: AbstractSet[_Style] - foreground: Union[_AnsiColour, _Colour, None] - background: Union[_AnsiColour, _Colour, None] - - -@dataclass(frozen=True) -class LSC: - mode_pre: Mapping[Mode, HLgroup] - mode_post: Mapping[Optional[Mode], HLgroup] - exts: Mapping[str, HLgroup] - name_glob: Mapping[str, HLgroup] - - -_ANSI_RANGE = range(256) -_RGB_RANGE = range(256) - -_STYLE_TABLE: Mapping[str, _Style] = {str(code + 0): code for code in _Style} - -_GROUND_TABLE: Mapping[str, _Ground] = { - str(code): ground - for code, ground in chain( - zip(chain(range(30, 39), range(90, 98)), repeat(_Ground.fore)), - zip(chain(range(40, 49), range(100, 108)), repeat(_Ground.back)), - ) -} - -_COLOUR_TABLE: Mapping[str, _AnsiColour] = { - str(code): colour - for code, colour in chain( - ((c + 29 if c <= 8 else c + 31, c) for c in _AnsiColour), - ((c + 89 if c <= 8 else c + 91, c) for c in _AnsiColour), - ) -} - -_RGB_TABLE: AbstractSet[str] = {"38", "48"} - -_E_BASIC_TABLE: Mapping[int, _AnsiColour] = {i: c for i, c in enumerate(_AnsiColour)} - -_E_GREY_TABLE: Mapping[int, _Colour] = { - i: _Colour(r=s, g=s, b=s) - for i, s in enumerate((round(step / 23 * 255) for step in range(24)), 232) -} - - -def _parse_8(codes: Iterator[str]) -> Union[_AnsiColour, _Colour, None]: - try: - ansi_code = int(next(codes, "")) - except ValueError: - return None - else: - if ansi_code in _ANSI_RANGE: - basic = _E_BASIC_TABLE.get(ansi_code) - if basic: - return basic - grey = _E_GREY_TABLE.get(ansi_code) - if grey: - return grey - ratio = 255 / 5 - code = ansi_code - 16 - r = code // 36 - g = code % 36 // 6 - b = code % 36 % 6 - return _Colour(r=round(r * ratio), g=round(g * ratio), b=round(b * ratio)) - else: - return None - - -def _parse_24(codes: Iterator[str]) -> Optional[_Colour]: - try: - r, g, b = int(next(codes, "")), int(next(codes, "")), int(next(codes, "")) - except ValueError: - return None - else: - if r in _RGB_RANGE and g in _RGB_RANGE and b in _RGB_RANGE: - return _Colour(r=r, g=g, b=b) - else: - return None - - -_PARSE_TABLE: Mapping[ - str, Callable[[Iterator[str]], Union[_AnsiColour, _Colour, None]] -] = { - "5": _parse_8, - "2": _parse_24, -} - - -_SPECIAL_PRE_TABLE: Mapping[str, Mode] = { - "bd": Mode.block_device, - "ca": Mode.file_w_capacity, - "cd": Mode.char_device, - "di": Mode.folder, - "do": Mode.door, - "ex": Mode.executable, - "ln": Mode.link, - "mh": Mode.multi_hardlink, - "or": Mode.orphan_link, - "ow": Mode.other_writable, - "pi": Mode.pipe, - "sg": Mode.set_gid, - "so": Mode.socket, - "st": Mode.sticky, - "su": Mode.set_uid, - "tw": Mode.sticky_other_writable, -} - - -_SPECIAL_POST_TABLE: Mapping[str, Optional[Mode]] = { - "fi": Mode.file, - "no": None, -} - -_UNUSED = { - "mi": "colour of missing symlink pointee", - "cl": "ANSI clear", - "ec": "ANSI end_code", - "lc": "ANSI left_code", - "rc": "ANSI right_code", - "rs": "ANSI reset", -} - -assert _UNUSED - - -_HL_STYLE_TABLE: Mapping[_Style, Optional[str]] = { - _Style.bold: "bold", - _Style.dimmed: None, - _Style.italic: "italic", - _Style.underline: "underline", - _Style.blink: None, - _Style.blink_fast: None, - _Style.reverse: "reverse", - _Style.hidden: None, - _Style.strikethrough: "strikethrough", -} - - -def _parse_codes( - codes: str, -) -> Iterator[Union[_Style, Tuple[_Ground, Union[_AnsiColour, _Colour]]]]: - it = (code.lstrip("0") for code in codes.split(";")) - for code in it: - style = _STYLE_TABLE.get(code) - if style: - yield style - continue - ground = _GROUND_TABLE.get(code) - ansi_colour = _COLOUR_TABLE.get(code) - if ground and ansi_colour: - yield ground, ansi_colour - elif ground and code in _RGB_TABLE: - code = next(it, "") - parse = _PARSE_TABLE.get(code) - if parse: - colour = parse(it) - if colour: - yield ground, colour - - -def _parse_styling(codes: str) -> _Styling: - styles: MutableSet[_Style] = set() - colours: MutableMapping[_Ground, Union[_AnsiColour, _Colour]] = {} - for ret in _parse_codes(codes): - if isinstance(ret, _Style): - styles.add(ret) - elif isinstance(ret, tuple): - ground, colour = ret - colours[ground] = colour - - styling = _Styling( - styles=styles, - foreground=colours.get(_Ground.fore), - background=colours.get(_Ground.back), - ) - return styling - - -def _parseHLGroup(styling: _Styling, discrete_colours: Mapping[str, str]) -> HLgroup: - fg, bg = styling.foreground, styling.background - name = f"{FM_HL_PREFIX}_ls_{uuid4().hex}" - cterm = { - style - for style in (_HL_STYLE_TABLE.get(style) for style in styling.styles) - if style - } - ctermfg = fg.value - 1 if isinstance(fg, _AnsiColour) else None - ctermbg = bg.value - 1 if isinstance(bg, _AnsiColour) else None - guifg = ( - rgb_to_hex(fg.r, fg.g, fg.b) - if isinstance(fg, _Colour) - else (discrete_colours.get(fg.name) if isinstance(fg, _AnsiColour) else None) - ) - guibg = ( - rgb_to_hex(bg.r, bg.g, bg.b) - if isinstance(bg, _Colour) - else (discrete_colours.get(bg.name) if isinstance(bg, _AnsiColour) else None) - ) - group = HLgroup( - name=name, - cterm=cterm, - ctermfg=ctermfg, - ctermbg=ctermbg, - guifg=guifg, - guibg=guibg, - ) - return group - - -def parse_lsc(ls_colours: str, discrete_colours: Mapping[str, str]) -> LSC: - hl_lookup = { - key: _parseHLGroup(_parse_styling(val), discrete_colours=discrete_colours) - for key, _, val in ( - segment.partition("=") for segment in ls_colours.strip(":").split(":") - ) - } - - mode_pre = { - mode: hl - for indicator, mode in _SPECIAL_PRE_TABLE.items() - if (hl := hl_lookup.pop(indicator, None)) - } - mode_post = { - mode: hl - for indicator, mode in _SPECIAL_POST_TABLE.items() - if (hl := hl_lookup.pop(indicator, None)) - } - - _ext_keys = tuple( - key for key in hl_lookup if key.startswith("*.") and key.count(".") == 1 - ) - exts = {key[1:]: hl_lookup.pop(key) for key in _ext_keys} - - lsc = LSC(exts=exts, mode_pre=mode_pre, mode_post=mode_post, name_glob=hl_lookup) - return lsc diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/view/ops.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/view/ops.py deleted file mode 100644 index 73f78dd9..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/view/ops.py +++ /dev/null @@ -1,25 +0,0 @@ -from os import sep -from os.path import relpath -from pathlib import Path, PurePath -from string import whitespace - -from ..state.types import State - -_WS = {*whitespace} - {"\t"} - - -def encode_for_display(text: str) -> str: - encoded = "".join( - char.encode("unicode_escape").decode("utf-8") if char in _WS else char - for char in text - ) - return encoded - - -def display_path(path: PurePath, state: State) -> str: - raw = relpath(path, start=state.root.path) - name = encode_for_display(raw) - if Path(path).is_dir(): - return f"{name}{sep}" - else: - return name diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/view/render.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/view/render.py deleted file mode 100644 index 093d4496..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/view/render.py +++ /dev/null @@ -1,345 +0,0 @@ -from collections import UserString -from enum import IntEnum, auto -from fnmatch import fnmatch -from functools import lru_cache -from locale import strxfrm -from os.path import extsep, sep -from pathlib import PurePath -from typing import Any, Callable, Iterator, Optional, Sequence, Tuple, Union, cast - -from pynvim_pp.lib import encode -from std2.platform import OS, os -from std2.types import never - -from ..fs.cartographer import is_dir, user_ignored -from ..fs.types import Mode, Node -from ..nvim.types import Markers -from ..settings.types import Settings -from ..state.types import Diagnostics, FilterPattern, Index, Selection -from ..version_ctl.types import VCStatus -from .ops import encode_for_display -from .types import Badge, Derived, Highlight, Sortby - - -class _CompVals(IntEnum): - FOLDER = auto() - FILE = auto() - - -_Str = Union[str, UserString] -_Render = Tuple[str, Sequence[Highlight], Sequence[Badge]] -_NRender = Tuple[Node, str, Sequence[Highlight], Sequence[Badge]] - - -class _str(UserString): - def __lt__(self, _: _Str) -> bool: - return False - - def __gt__(self, _: _Str) -> bool: - return True - - -_EMPTY = _str("") - - -def _suffixx(path: PurePath) -> _Str: - if path.suffix: - return strxfrm(path.suffix) - elif path.stem.startswith(extsep): - return strxfrm(path.stem) - else: - return _EMPTY - - -def _lax_suffix(path: PurePath) -> str: - return path.suffix or path.name - - -@lru_cache(maxsize=None) -def _gen_comp(sortby: Sequence[Sortby]) -> Callable[[Node], Any]: - def comp(node: Node) -> Sequence[Any]: - if node.cache.sort_by is None: - - def cont() -> Iterator[Any]: - for sb in sortby: - if sb is Sortby.is_folder: - yield _CompVals.FOLDER if is_dir(node) else _CompVals.FILE - elif sb is Sortby.ext: - yield "" if is_dir(node) else _suffixx(node.path) - elif sb is Sortby.file_name_lower: - yield strxfrm(node.path.name.casefold()) - elif sb is Sortby.file_name: - yield strxfrm(node.path.name) - else: - never(sb) - - node.cache.sort_by = tuple(cont()) - return node.cache.sort_by - - return comp - - -def _vc_ignored(node: Node, vc: VCStatus) -> bool: - path = node.path - if (ignored := vc.ignore_cache.get(path, None)) is not None: - return ignored - else: - ignored = not vc.ignored.isdisjoint({path} | {*map(PurePath, path.parents)}) - vc.ignore_cache[path] = ignored - return ignored - - -def _gen_spacer(depth: int) -> str: - return (depth * 2 - 1) * " " - - -def _paint( - settings: Settings, - index: Index, - selection: Selection, - markers: Markers, - diagnostics: Diagnostics, - vc: VCStatus, - follow_links: bool, - show_hidden: bool, - current: Optional[PurePath], -) -> Callable[[Node, int], Optional[_Render]]: - icons = settings.view.icons - context = settings.view.hl_context - - def search_icon_hl(node: Node, ignored: bool) -> Optional[str]: - if ignored: - return context.particular_mappings.ignored - else: - return context.icon_exts.get(_lax_suffix(node.path)) - - def search_text_hl(node: Node, ignored: bool) -> Optional[str]: - if ignored: - return context.particular_mappings.ignored - - s_modes = sorted(node.mode) - for mode in s_modes: - if os is OS.windows and mode is Mode.other_writable: - pass - elif hl := context.mode_pre.get(mode): - return hl - - if hl := context.name_exact.get(node.path.name): - return hl - - for pattern, hl in context.name_glob.items(): - if fnmatch(node.path.name, pattern): - return hl - - if hl := context.ext_exact.get(_lax_suffix(node.path)): - return hl - - for mode in s_modes: - if hl := context.mode_post.get(mode): - return hl - else: - return context.mode_post.get(None) - - def gen_status(path: PurePath) -> str: - selected = ( - icons.status.selected if path in selection else icons.status.not_selected - ) - active = icons.status.active if path == current else icons.status.inactive - return f"{selected}{active}" - - def gen_decor_pre(node: Node, depth: int) -> Iterator[str]: - yield _gen_spacer(depth) - yield gen_status(node.path) - - def gen_icon(node: Node) -> Iterator[str]: - yield " " - if is_dir(node): - if node.pointed and not follow_links: - yield icons.link.normal - elif node.path in index: - yield icons.folder.open - else: - yield icons.folder.closed - else: - yield ( - ( - icons.name_exact.get(node.path.name, "") - or icons.ext_exact.get(_lax_suffix(node.path), "") - or next( - ( - v - for k, v in icons.name_glob.items() - if fnmatch(node.path.name, k) - ), - icons.default_icon, - ) - ) - if settings.view.use_icons - else icons.default_icon - ) - yield " " - - def gen_name(node: Node) -> Iterator[str]: - yield encode_for_display(node.path.name) - if not settings.view.use_icons and is_dir(node): - yield sep - - def gen_decor_post(node: Node) -> Iterator[str]: - mode = node.mode - if Mode.orphan_link in mode: - yield " " - yield icons.link.broken - elif Mode.link in mode: - yield " " - if is_dir(node) and not follow_links: - if node.path in index: - yield icons.folder.open - else: - yield icons.folder.closed - else: - yield icons.link.normal - - def gen_badges(path: PurePath) -> Iterator[Badge]: - l = "" - if diagnostic := diagnostics.get(path, {}): - l = " " - dl = len(diagnostic) - for idx, (severity, count) in enumerate(sorted(diagnostic.items())): - group = context.particular_mappings.diagnostics.get( - severity, context.particular_mappings.diagnostic_unknown - ) - lhs, rhs = not idx, idx + 1 == dl - r = " " if dl > 1 and not rhs else "" - if lhs: - yield Badge( - text="{", group=context.particular_mappings.diagnostic_context - ) - yield Badge(text=f"{count}{r}", group=group) - if rhs: - yield Badge( - text="}", group=context.particular_mappings.diagnostic_context - ) - - if marks := markers.bookmarks.get(path): - ordered = "".join(sorted(marks)) - yield Badge( - text=f"{l}<{ordered}>", - group=context.particular_mappings.bookmarks, - ) - - if qf_count := markers.quick_fix.get(path): - yield Badge( - text=f"{l}({qf_count})", - group=context.particular_mappings.quickfix, - ) - - if stat := vc.status.get(path): - yield Badge( - text=f"{l}[{stat}]", - group=context.particular_mappings.version_control, - ) - - def gen_highlights( - node: Node, pre: str, icon: str, name: str, ignored: bool - ) -> Iterator[Highlight]: - icon_begin = len(encode(pre)) - icon_end = icon_begin + len(encode(icon)) - text_begin = icon_end - text_end = len(encode(name)) + text_begin - - if icon_group := search_icon_hl(node, ignored=ignored): - hl = Highlight(group=icon_group, begin=icon_begin, end=icon_end) - yield hl - - if text_group := search_text_hl(node, ignored=ignored): - hl = Highlight(group=text_group, begin=text_begin, end=text_end) - yield hl - - def show(node: Node, depth: int) -> Optional[_Render]: - _user_ignored = user_ignored(node, ignores=settings.ignores) - vc_ignored = _vc_ignored(node, vc=vc) - ignored = vc_ignored or _user_ignored - - if depth and _user_ignored and not show_hidden: - return None - else: - pre = "".join(gen_decor_pre(node, depth=depth)) - icon = "".join(gen_icon(node)) - name = "".join(gen_name(node)) - post = "".join(gen_decor_post(node)) - - line = f"{pre}{icon}{name}{post}" - badges = tuple(gen_badges(node.path)) - highlights = tuple( - gen_highlights(node, pre=pre, icon=icon, name=name, ignored=ignored) - ) - return line, highlights, badges - - return show - - -def render( - node: Node, - *, - settings: Settings, - index: Index, - selection: Selection, - filter_pattern: Optional[FilterPattern], - markers: Markers, - diagnostics: Diagnostics, - vc: VCStatus, - follow_links: bool, - show_hidden: bool, - current: Optional[PurePath], -) -> Derived: - show = _paint( - settings, - index=index, - selection=selection, - markers=markers, - diagnostics=diagnostics, - vc=vc, - follow_links=follow_links, - show_hidden=show_hidden, - current=current, - ) - comp = _gen_comp(settings.view.sort_by) - keep_open = {node.path} - - def render(node: Node, *, depth: int, cleared: bool) -> Iterator[_NRender]: - clear = ( - cleared - or not filter_pattern - or fnmatch(node.path.name, filter_pattern.pattern) - ) - - if rend := show(node, depth): - - def gen_children() -> Iterator[_NRender]: - for child in sorted(node.children.values(), key=comp): - yield from render(child, depth=depth + 1, cleared=clear) - - children = tuple(gen_children()) - if clear or children or node.path in keep_open: - yield (node, *rend) - yield from iter(children) - - rendered = render(node, depth=0, cleared=False) - _nodes, _lines, _highlights, _badges = zip(*rendered) - nodes, lines, highlights, badges = ( - cast(Sequence[Node], _nodes), - cast(Sequence[str], _lines), - cast(Sequence[Sequence[Highlight]], _highlights), - cast(Sequence[Sequence[Badge]], _badges), - ) - hashed = tuple(str(hash(zipped)) for zipped in zip(lines, highlights, badges)) - path_row_lookup = {node.path: idx for idx, node in enumerate(nodes)} - derived = Derived( - lines=lines, - highlights=highlights, - badges=badges, - hashed=hashed, - node_row_lookup=nodes, - path_row_lookup=path_row_lookup, - ) - return derived diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/view/types.py b/config/neovim/store/lazy-plugins/chadtree/chadtree/view/types.py deleted file mode 100644 index 1c11037a..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/chadtree/view/types.py +++ /dev/null @@ -1,74 +0,0 @@ -from dataclasses import dataclass -from enum import Enum, auto -from pathlib import PurePath -from typing import Mapping, Optional, Sequence - -from pynvim_pp.highlight import HLgroup - -from chad_types import IconGlyphs - -from ..fs.types import Mode, Node - - -@dataclass(frozen=True) -class HLGroups: - bookmarks: str - ignored: str - marks: str - quickfix: str - diagnostics: Mapping[int, str] - diagnostic_unknown: str - diagnostic_context: str - version_control: str - - -@dataclass(frozen=True) -class HLcontext: - groups: Sequence[HLgroup] - icon_exts: Mapping[str, str] - mode_pre: Mapping[Mode, str] - mode_post: Mapping[Optional[Mode], str] - name_exact: Mapping[str, str] - name_glob: Mapping[str, str] - ext_exact: Mapping[str, str] - particular_mappings: HLGroups - - -class Sortby(Enum): - is_folder = auto() - ext = auto() - file_name_lower = auto() - file_name = auto() - - -@dataclass(frozen=True) -class ViewOptions: - hl_context: HLcontext - icons: IconGlyphs - sort_by: Sequence[Sortby] - time_fmt: str - use_icons: bool - - -@dataclass(frozen=True) -class Badge: - text: str - group: str - - -@dataclass(frozen=True) -class Highlight: - begin: int - end: int - group: str - - -@dataclass(frozen=True) -class Derived: - lines: Sequence[str] - highlights: Sequence[Sequence[Highlight]] - badges: Sequence[Sequence[Badge]] - - hashed: Sequence[str] - node_row_lookup: Sequence[Node] - path_row_lookup: Mapping[PurePath, int] diff --git a/config/neovim/store/lazy-plugins/chadtree/ci/__init__.py b/config/neovim/store/lazy-plugins/chadtree/ci/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/config/neovim/store/lazy-plugins/chadtree/ci/__main__.py b/config/neovim/store/lazy-plugins/chadtree/ci/__main__.py deleted file mode 100644 index eef3012a..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/ci/__main__.py +++ /dev/null @@ -1,31 +0,0 @@ -from json import dump - -from std2.graphlib import recur_sort -from std2.pickle.encoder import new_encoder - -from chad_types import ARTIFACT, Artifact - -from .icon_colours import load_icon_colours -from .ls_colours import load_ls_colours -from .text_decorations import load_text_decors - - -def main() -> None: - encode = new_encoder[Artifact](Artifact) - ls_colours = load_ls_colours() - icon_colours = load_icon_colours() - icons, text_colours = load_text_decors() - - artifact = Artifact( - icons=icons, - ls_colours=ls_colours, - icon_colours=icon_colours, - text_colours=text_colours, - ) - - json = recur_sort(encode(artifact)) - with ARTIFACT.open("w") as fd: - dump(json, fd, ensure_ascii=False, check_circular=False, indent=2) - - -main() diff --git a/config/neovim/store/lazy-plugins/chadtree/ci/icon_colours/__init__.py b/config/neovim/store/lazy-plugins/chadtree/ci/icon_colours/__init__.py deleted file mode 100644 index b516da4d..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/ci/icon_colours/__init__.py +++ /dev/null @@ -1,47 +0,0 @@ -from dataclasses import dataclass -from typing import Mapping, Optional, Sequence - -from std2.pickle.decoder import new_decoder -from std2.urllib import urlopen -from yaml import safe_load - -from chad_types import Hex, IconColours, IconColourSet - -_LINGUIST = """ -https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml -""" - - -@dataclass(frozen=True) -class _GithubColours: - extensions: Sequence[str] = () - color: Optional[Hex] = None - - -_GithubSpec = Mapping[str, _GithubColours] - - -def _fetch(uri: str) -> str: - with urlopen(uri) as resp: - code = resp.getcode() - body = resp.read() - if code != 200: - raise Exception(resp.headers, body) - else: - return body.decode() - - -def load_icon_colours() -> IconColourSet: - decode = new_decoder[_GithubSpec](_GithubSpec, strict=False) - - rawGH = _fetch(_LINGUIST) - yamlGH = decode(safe_load(rawGH)) - - github: IconColours = { - ext: spec.color - for spec in yamlGH.values() - for ext in spec.extensions - if spec.color - } - colours = IconColourSet(github=github) - return colours diff --git a/config/neovim/store/lazy-plugins/chadtree/ci/ls_colours/Dockerfile b/config/neovim/store/lazy-plugins/chadtree/ci/ls_colours/Dockerfile deleted file mode 100644 index a6aa4fe8..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/ci/ls_colours/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM ubuntu:latest - - -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends -- python3 git ca-certificates && \ - rm -rf -- /var/lib/apt/lists/* && \ - update-ca-certificates - - -WORKDIR /root - - -RUN git clone --depth=1 https://github.com/seebi/dircolors-solarized.git && \ - git clone --depth=1 https://github.com/arcticicestudio/nord-dircolors.git && \ - git clone --depth=1 https://github.com/trapd00r/LS_COLORS -COPY . / - - -ENTRYPOINT ["./lsc.py"] diff --git a/config/neovim/store/lazy-plugins/chadtree/ci/ls_colours/__init__.py b/config/neovim/store/lazy-plugins/chadtree/ci/ls_colours/__init__.py deleted file mode 100644 index 044afb39..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/ci/ls_colours/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -from json import loads -from pathlib import Path - -from std2.pickle.decoder import new_decoder - -from chad_types import LSColourSet - -from ..run import docker_run - -_DOCKERFILE = Path(__file__).resolve(strict=True).with_name("Dockerfile") - - -def load_ls_colours() -> LSColourSet: - decode = new_decoder[LSColourSet](LSColourSet) - - json = loads(docker_run(_DOCKERFILE)) - lsc = decode(json) - return lsc diff --git a/config/neovim/store/lazy-plugins/chadtree/ci/ls_colours/root/lsc.py b/config/neovim/store/lazy-plugins/chadtree/ci/ls_colours/root/lsc.py deleted file mode 100755 index a030131b..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/ci/ls_colours/root/lsc.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python3 - -from json import dump -from os.path import normcase -from pathlib import Path -from subprocess import check_output -from sys import stdout - -_LSC_SH = Path(__file__).resolve(strict=True).with_name("lsc.sh") - -_SOLARIZED = Path("dircolors-solarized").resolve(strict=True) -_NORD = Path("nord-dircolors").resolve(strict=True) -_TRAP_DOOR = Path("LS_COLORS").resolve(strict=True) - -_PARSING = { - _SOLARIZED / "dircolors.256dark": "solarized_dark_256", - _SOLARIZED / "dircolors.ansi-dark": "solarized_dark", - _SOLARIZED / "dircolors.ansi-light": "solarized_light", - _SOLARIZED / "dircolors.ansi-universal": "solarized_universal", - _NORD / "src" / "dir_colors": "nord", - _TRAP_DOOR / "LS_COLORS": "trapdoor", -} - - -def main() -> None: - lsc = { - dest: check_output((str(_LSC_SH), normcase(file_name)), text=True) - for file_name, dest in _PARSING.items() - } - dump(lsc, stdout, ensure_ascii=False, check_circular=False) - - -main() diff --git a/config/neovim/store/lazy-plugins/chadtree/ci/ls_colours/root/lsc.sh b/config/neovim/store/lazy-plugins/chadtree/ci/ls_colours/root/lsc.sh deleted file mode 100755 index ce0ce121..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/ci/ls_colours/root/lsc.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/bash - -set -eu -set -o pipefail - -FILE="$1" -export TERM=xterm-256color -eval "$(dircolors -b "$FILE")" -printf '%s' "$LS_COLORS" diff --git a/config/neovim/store/lazy-plugins/chadtree/ci/prepare.py b/config/neovim/store/lazy-plugins/chadtree/ci/prepare.py deleted file mode 100755 index 3669d087..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/ci/prepare.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python3 - -from datetime import datetime, timezone -from os import environ, sep -from pathlib import Path -from subprocess import check_call, check_output, run -from sys import executable -from typing import Iterator - -_TOP_LV = Path(__file__).resolve(strict=True).parent.parent - - -def _git_identity() -> None: - email = "ci@ci.ci" - username = "ci-bot" - check_call(("git", "config", "--global", "user.email", email)) - check_call(("git", "config", "--global", "user.name", username)) - - -def _get_branch() -> str: - if ref := environ.get("GITHUB_REF"): - return ref.replace("refs/heads/", "") - else: - br = check_output(("git", "branch", "--show-current"), text=True, cwd=_TOP_LV) - return br.strip() - - -def _git_clone(path: Path) -> None: - if not path.is_dir(): - if token := environ.get("CI_TOKEN"): - uri = f"https://ms-jpq:{token}@github.com/ms-jpq/chadtree.git" - else: - uri = "git@github.com:ms-jpq/chadtree.git" - - branch = _get_branch() - check_call(("git", "clone", "--branch", branch, uri, path)) - - -def _build() -> None: - check_call((executable, "-m", "ci"), cwd=_TOP_LV) - - -def _git_alert(cwd: Path) -> None: - prefix = "ci" - remote_brs = check_output(("git", "branch", "--remotes"), text=True, cwd=cwd) - - def cont() -> Iterator[str]: - for br in remote_brs.splitlines(): - b = br.strip() - if b and "->" not in b: - _, _, name = b.partition(sep) - if name.startswith(prefix): - yield name - - refs = tuple(cont()) - - if refs: - check_call(("git", "push", "--delete", "origin", *refs), cwd=cwd) - - proc = run(("git", "diff", "--exit-code"), cwd=cwd) - print(proc) - if proc.returncode: - time = datetime.now(tz=timezone.utc).strftime("%Y-%m-%d") - brname = f"{prefix}--{time}" - check_call(("git", "checkout", "-b", brname), cwd=cwd) - check_call(("git", "add", "."), cwd=cwd) - check_call(("git", "commit", "-m", f"update_icons: {time}"), cwd=cwd) - check_call( - ("git", "push", "--force", "--set-upstream", "origin", brname), cwd=cwd - ) - - -def main() -> None: - cwd = Path() / "temp" - if "CI" in environ: - _git_identity() - _git_clone(cwd) - _build() - _git_alert(_TOP_LV) - - -main() diff --git a/config/neovim/store/lazy-plugins/chadtree/ci/run.py b/config/neovim/store/lazy-plugins/chadtree/ci/run.py deleted file mode 100644 index 6ae694e5..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/ci/run.py +++ /dev/null @@ -1,25 +0,0 @@ -from pathlib import Path -from subprocess import check_call, check_output - - -def docker_run(dockerfile: Path) -> str: - parent = dockerfile.parent - name = f"chad_{parent.name}" - check_call( - ( - "docker", - "buildx", - "build", - "--progress", - "plain", - "--tag", - name, - "--file", - dockerfile, - "--", - ".", - ), - cwd=parent, - ) - output = check_output(("docker", "run", "--rm", name), text=True) - return output diff --git a/config/neovim/store/lazy-plugins/chadtree/ci/text_decorations/Dockerfile b/config/neovim/store/lazy-plugins/chadtree/ci/text_decorations/Dockerfile deleted file mode 100644 index 1aafae84..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/ci/text_decorations/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM ubuntu:latest - - -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends -- neovim git ca-certificates && \ - rm -rf -- /var/lib/apt/lists/* - - -WORKDIR /root - - -RUN git clone --depth=1 https://github.com/ryanoasis/vim-devicons.git && \ - git clone --depth=1 https://github.com/adelarsq/vim-emoji-icon-theme.git && \ - git clone --depth=1 https://github.com/tiagofumo/vim-nerdtree-syntax-highlight.git - - -COPY . / - - -RUN nvim --headless -ENTRYPOINT ["cat", "exports.json"] diff --git a/config/neovim/store/lazy-plugins/chadtree/ci/text_decorations/__init__.py b/config/neovim/store/lazy-plugins/chadtree/ci/text_decorations/__init__.py deleted file mode 100644 index 8d82ae6e..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/ci/text_decorations/__init__.py +++ /dev/null @@ -1,104 +0,0 @@ -from dataclasses import dataclass -from json import loads -from pathlib import Path -from typing import Mapping, Tuple - -from std2.coloursys import hex_inverse -from std2.graphlib import merge -from std2.pickle.decoder import new_decoder -from yaml import safe_load - -from chad_types import ASSETS, Hex, IconGlyphs, IconGlyphSet, TextColours, TextColourSet - -from ..run import docker_run - - -@dataclass(frozen=True) -class _TCAliases: - ext_exact: Mapping[str, str] - name_exact: Mapping[str, str] - name_glob: Mapping[str, str] - - -@dataclass(frozen=True) -class _Aliases: - icon_colours: Mapping[str, str] - text_colours: _TCAliases - - -_DOCKERFILE = Path(__file__).resolve(strict=True).with_name("Dockerfile") -_ICON_BASE = ASSETS / "icon_base.yml" -_ALIASES = ASSETS / "aliases.yml" - - -def _process_exts(exts: Mapping[str, str]) -> Mapping[str, str]: - return {f".{k}": v for k, v in exts.items()} - - -def _process_glob(glob: Mapping[str, str]) -> Mapping[str, str]: - return {k.rstrip("$").replace(r"\.", "."): v for k, v in glob.items()} - - -def _process_hexcode(colours: Mapping[str, str]) -> Mapping[str, Hex]: - return {k: f"#{v}" for k, v in colours.items()} - - -def _process_inverse(colours: Mapping[str, str]) -> Mapping[str, str]: - return {k: hex_inverse(v) for k, v in colours.items()} - - -def _process_icons(icons: IconGlyphs) -> IconGlyphs: - return IconGlyphs( - default_icon=icons.default_icon, - folder=icons.folder, - link=icons.link, - status=icons.status, - ext_exact=_process_exts(icons.ext_exact), - name_exact=icons.name_exact, - name_glob=_process_glob(icons.name_glob), - ) - - -def _process_colours(colours: TextColours) -> TextColours: - return TextColours( - ext_exact=_process_hexcode(_process_exts(colours.ext_exact)), - name_exact=_process_hexcode(colours.name_exact), - name_glob=_process_hexcode(_process_glob(colours.name_glob)), - ) - - -def _make_lightmode(colours: TextColours) -> TextColours: - return TextColours( - ext_exact=_process_inverse(colours.ext_exact), - name_exact=_process_inverse(colours.name_exact), - name_glob=_process_inverse(colours.name_glob), - ) - - -def load_text_decors() -> Tuple[IconGlyphSet, TextColourSet]: - i_decode = new_decoder[IconGlyphSet](IconGlyphSet, strict=False) - c_decode = new_decoder[TextColourSet](TextColourSet, strict=False) - a_decode = new_decoder[_Aliases](_Aliases) - - icon_base = safe_load(_ICON_BASE.read_text("UTF-8")) - aliases = safe_load(_ALIASES.read_text("UTF-8")) - - json = loads(docker_run(_DOCKERFILE)) - data = merge(json, icon_base) - icon_spec = i_decode(data) - ali = a_decode(aliases) - - icon_set = IconGlyphSet( - ascii=_process_icons(icon_spec.ascii), - ascii_hollow=_process_icons(icon_spec.ascii_hollow), - devicons=_process_icons(icon_spec.devicons), - emoji=_process_icons(icon_spec.emoji), - ) - colour_spec = c_decode(data) - colour_set = TextColourSet( - nerdtree_syntax_light=_make_lightmode( - _process_colours(colour_spec.nerdtree_syntax_light) - ), - nerdtree_syntax_dark=_process_colours(colour_spec.nerdtree_syntax_dark), - ) - return icon_set, colour_set diff --git a/config/neovim/store/lazy-plugins/chadtree/ci/text_decorations/root/.config/nvim/init.vim b/config/neovim/store/lazy-plugins/chadtree/ci/text_decorations/root/.config/nvim/init.vim deleted file mode 100644 index 8c161e57..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/ci/text_decorations/root/.config/nvim/init.vim +++ /dev/null @@ -1 +0,0 @@ -lua require 'chad' diff --git a/config/neovim/store/lazy-plugins/chadtree/ci/text_decorations/root/.config/nvim/lua/chad.lua b/config/neovim/store/lazy-plugins/chadtree/ci/text_decorations/root/.config/nvim/lua/chad.lua deleted file mode 100644 index a490321c..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/ci/text_decorations/root/.config/nvim/lua/chad.lua +++ /dev/null @@ -1,49 +0,0 @@ -local export_icons = function() - return { - ext_exact = vim.g.WebDevIconsUnicodeDecorateFileNodesExtensionSymbols, - name_exact = vim.g.WebDevIconsUnicodeDecorateFileNodesExactSymbols, - name_glob = vim.g.WebDevIconsUnicodeDecorateFileNodesPatternSymbols, - default_icon = vim.g.WebDevIconsUnicodeDecorateFileNodesDefaultSymbol, - folder = { - open = vim.g.DevIconsDefaultFolderOpenSymbol, - closed = vim.g.WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol - } - } -end - -local export_colours = function() - return { - ext_exact = vim.g.NERDTreeExtensionHighlightColor, - name_exact = vim.g.NERDTreeExactMatchHighlightColor, - name_glob = vim.g.NERDTreePatternMatchHighlightColor - } -end - -local load_rtp = function(src) - vim.o.runtimepath = vim.o.runtimepath .. "," .. "/root/" .. src -end - -local load_viml = function(src) - vim.cmd("source " .. "/root/" .. src) -end - -load_viml "vim-devicons/plugin/webdevicons.vim" -local devicons = export_icons() - -load_viml "vim-emoji-icon-theme/plugin/vim-emoji-icon-theme.vim" -local emoji = export_icons() - -load_viml "vim-nerdtree-syntax-highlight/after/syntax/nerdtree.vim" -local nerdtree_syntax = export_colours() - -local exports = { - devicons = devicons, - emoji = emoji, - nerdtree_syntax_light = nerdtree_syntax, - nerdtree_syntax_dark = nerdtree_syntax -} -local json = vim.fn.json_encode(exports) - -vim.fn.writefile({json}, "exports.json") - -os.exit(0) diff --git a/config/neovim/store/lazy-plugins/chadtree/config/defaults.yml b/config/neovim/store/lazy-plugins/chadtree/config/defaults.yml deleted file mode 100644 index 8ddb9096..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/config/defaults.yml +++ /dev/null @@ -1,171 +0,0 @@ ---- -idle_timeout: 1.0 -ignore: - name_exact: - - .DS_Store - - .directory - - .git - - .localized - - thumbs.db - name_glob: [] - path_glob: [] -keymap: - bigger: - - + - - "=" - bookmark_goto: - - m - change_dir: - - b - change_focus: - - c - change_focus_up: - - C - clear_filter: - - F - clear_selection: - - S - collapse: - - - - "`" - copy: - - p - copy_basename: - - Y - copy_name: - - y - copy_relname: - - - cut: - - x - delete: - - d - filter: - - f - h_split: - - W - jump_to_current: - - J - link: - - A - new: - - a - open_sys: - - o - primary: - - - quit: - - q - refocus: - - "~" - refresh: - - - rename: - - r - secondary: - - - - <2-leftmouse> - select: - - s - smaller: - - "-" - - _ - stat: - - K - tertiary: - - - - - toggle_exec: - - X - toggle_follow: - - u - toggle_follow_links: - - U - toggle_follow_ignore: - - T - toggle_hidden: - - . - toggle_version_control: - - i - trash: - - t - v_split: - - w -options: - close_on_open: false - follow: true - follow_links: true - follow_ignore: false - lang: null - mimetypes: - allow_exts: - - .svg - - .ts - warn: - - audio - - font - - image - - video - min_diagnostics_severity: 2 - page_increment: 5 - polling_rate: 2.0 - session: true - show_hidden: false - version_control: - enable: true -profiling: false -theme: - discrete_colour_map: - black: "#202020" - blue: "#4eb5e0" - bright_black: "#000000" - bright_blue: "#58c7ff" - bright_cyan: "#5ac8a9" - bright_green: "#8dc437" - bright_magenta: "#ffa3cc" - bright_red: "#ff8883" - bright_white: "#feffff" - bright_yellow: "#ffa84f" - cyan: "#52bcaf" - green: "#96bc00" - magenta: "#f587c5" - red: "#ff4c41" - white: "#feffff" - yellow: "#f6a311" - highlights: - bookmarks: Title - ignored: Comment - marks: Keyword - quickfix: Label - version_control: Comment - diagnostics: - 1: DiagnosticError - 2: DiagnosticWarn - 3: DiagnosticInfo - 4: DiagnosticHint - 5: DiagnosticOk - diagnostic_unknown: DiagnosticOk - diagnostic_context: Menu - - icon_colour_set: github - icon_glyph_set: devicons - text_colour_set: env - -view: - open_direction: left - sort_by: - - is_folder - - ext - - file_name_lower - - file_name - time_format: "%Y-%m-%d %H:%M" - width: 40 - window_options: - cursorline: true - foldenable: false - number: false - relativenumber: false - signcolumn: "no" - winfixwidth: true - wrap: false -xdg: false diff --git a/config/neovim/store/lazy-plugins/chadtree/docker-compose.yml b/config/neovim/store/lazy-plugins/chadtree/docker-compose.yml deleted file mode 100644 index ae67fb03..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/docker-compose.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: "3.7" - -services: - chadtree: - restart: always - build: . - environment: - - TZ - diff --git a/config/neovim/store/lazy-plugins/chadtree/docker/root/.config/nvim/init.vim b/config/neovim/store/lazy-plugins/chadtree/docker/root/.config/nvim/init.vim deleted file mode 100644 index 066355e7..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/docker/root/.config/nvim/init.vim +++ /dev/null @@ -1,17 +0,0 @@ -nnoremap Q -nnoremap QQ quitall! -vnoremap Q -vnoremap QQ quitall! - -filetype on -set nomodeline -set secure -set termguicolors -set shortmess+=I - -let g:python3_host_prog = '/usr/bin/python3' -let g:chadtree_settings = {'profiling': v:true, 'xdg': v:true} -let mapleader=' ' -nnoremap v CHADopen - -packloadall diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/ARCHITECTURE.md b/config/neovim/store/lazy-plugins/chadtree/docs/ARCHITECTURE.md deleted file mode 100644 index 39712218..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/docs/ARCHITECTURE.md +++ /dev/null @@ -1,41 +0,0 @@ -# Architecture - -## Asynchronous Event Loop - -CHADTree uses it's own event loop aside from the `asyncio` one defined by the [`pynvim` client](https://github.com/neovim/pynvim). - -In fact, `pynvim` doesn't even run in the main thread. - -All RPC notifications from the `nvim` server are sent to a global message queue, which is then processed in order of arrival after initialization code. - -No further messages can be processed until the previous ones have. - -`nvim` never blocks on the notifications. The CHADTree client has no blocking API. - -## Parallelism - -CHADTree uses a traditional threadpool for parallelizable operations, this includes querying for `git` status and file system walking, as well as other minor ones such as `mv` or `cp`. - -The fs walk is done using a native parallel BFS strategy with a chunking step to avoid flooding the thread pool. This is not optimal since a [Fork Join](https://en.wikipedia.org/wiki/Fork%E2%80%93join_model) model should be more efficient. - -However, as benchmarked, the performance bottleneck is in fact not the filesystem, but text & decorations rendering. - -## Virtual Rendering - -It turns out, if you have thousands lines of text with decorations such as colour or virtual text, `nvim` struggles to update buffers, even if you batch the render in a single call. - -The answer is to have a virtual render target, and to compute the minimal necessary render instructions. - -Previously I had written [Noact](https://github.com/ms-jpq/noact), a 70 line React like virtual dom engine. CHADTree works similarly, except with a more sophisticated diff algorithm, since the native approach does not cope with flat lists. (A flat list is a degenerate tree) - -Instead of Virtual DOM nodes, a hash is used for each desired line of the render target. - -## Memorylessness - -CHADTree is designed with [Memorylessness](https://en.wikipedia.org/wiki/Memorylessness) in mind. For the most part the state transitions in CHADTree follow the Markov Property in that each successive state is independent from history. - -## Pipelining - -Broadly speaking, CHADTree has a two stage pipeline. The first stage processes messages, and generates render and cursor placement instructions for the second stage. - -Ideally the first stage should be referentially transparent, with zero side effects, while the second stage executes all of the side effects. However, this is too tedious, a memoryless approach is taken for the two stages instead. \ No newline at end of file diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/CONFIGURATION.md b/config/neovim/store/lazy-plugins/chadtree/docs/CONFIGURATION.md deleted file mode 100644 index 6c584998..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/docs/CONFIGURATION.md +++ /dev/null @@ -1,326 +0,0 @@ -# Configurations - -All configurations are under the global variable **`chadtree_settings`**. - -VimL: - -```vim -let g:chadtree_settings = { ... } -``` - -Lua: - -```lua -local chadtree_settings = { ... } -vim.api.nvim_set_var("chadtree_settings", chadtree_settings) -``` - ---- - -## Shorthand - -Dictionary keys will be automatically expanded with the `.` notation. This works recursively. - -ie. The following are equivalent - -```json -{ "dog.puppy": 2 } -``` - -```json -{ "dog": { "puppy": 2 } } -``` - -Note in lua, you will need to quote your keys like so: - -```lua -{ ["dog.puppy"] = 2 } -``` - -Note in VimL, to specify `True` and `False`, you need to use the following: - -```vim -v:true -v:false -``` - ---- - -## Validation - -Variables will be validated against a schema. - -ie. - -```vim -let g:chadtree_settings = { 'ignore.dog': 'scratch, stratch' } -``` - -Will give you the following error message: - -![schema error.png](https://github.com/ms-jpq/chadtree/raw/chad/docs/img/schema_error.png) - -**Notice it says `Extra keys: {dog}`** - ---- - -## Specifics - -The default configuration can be found under an [`yaml` file](https://github.com/ms-jpq/chadtree/tree/chad/config/defaults.yml) - ---- - -### chadtree_settings.xdg - -Use `XDG` specifications for storing the CHADTree runtime and session files. - -If set to false, will store everything under repo location. - -**default:** - -```json -false -``` - ---- - -### chadtree_settings.keymap - -See help docs on [keybind](https://github.com/ms-jpq/chadtree/tree/chad/docs/KEYBIND.md) - ---- - -### chadtree_settings.options - -#### `chadtree_settings.options.follow` - -CHADTree will highlight currently open file, and open all its parents. - -**default:** - -```json -true -``` - -#### `chadtree_settings.options.follow_links` - -CHADTree will follow symlinks - -**default:** - -```json -true -``` - -#### `chadtree_settings.options.lang` - -CHADTree will guess your locale from [unix environmental variables](https://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html). - -Set to `c` to disable emojis. - -**default:** - -```json -null -``` - -**note:** - -I only wrote localization for `en`. `zh` will be coming, and maybe `fr` if I can get my girlfriend to help. - -#### `chadtree_settings.options.mimetypes` - -CHADTree will attempt to warn you when you try to open say an image. This is done via the [Internet Assigned Numbers Authority](https://www.iana.org/assignments/media-types/media-types.xhtml)'s mimetype database. - -##### `chadtree_settings.options.mimetypes.warn` - -Show a warning before opening these datatypes - -**default:** - -```json -["audio", "font", "image", "video"] -``` - -##### `chadtree_settings.options.mimetypes.allow_exts` - -Skip warning for these extensions - -**default:** - -```json -[".ts"] -``` - -#### `chadtree_settings.options.page_increment` - -Change how many lines `{` and `}` scroll - -**default:** - -```json -5 -``` - -#### `chadtree_settings.options.min_diagnostics_severity` - -Lower is more severe. - -**default:** - -```json -2 -``` - -#### `chadtree_settings.options.polling_rate` - -CHADTree's background refresh rate - -**default:** - -```json -2.0 -``` - -#### `chadtree_settings.options.session` - -Save & restore currently open folders - -**default:** - -```json -true -``` - -#### `chadtree_settings.options.show_hidden` - -Hide some files and folders by default. By default this can be toggled using the `.` key. - -see `chadtree_settings.ignore` for more details - -**default:** - -```json -false -``` - -#### `chadtree_settings.options.version_control` - -##### `chadtree_settings.options.version_control.enable` - -Enable version control. This can also be toggled. But unlike `show_hidden`, does not have a default keybind. - -**default:** - -```json -true -``` - ---- - -### chadtree_settings.ignore - -CHADTree can ignore showing some files. This is toggable by default using the `.` key. - -#### `chadtree_settings.ignore.name_exact` - -Files whose name match these exactly will be ignored. - -**default:** - -```json -[".DS_Store", ".directory", "thumbs.db", ".git"] -``` - -#### `chadtree_settings.ignore.name_glob` - -Files whose name match these [glob patterns](https://en.wikipedia.org/wiki/Glob_%28programming%29) will be ignored. - -ie. `*.py` will match all python files - -**default:** - -```json -[] -``` - -#### `chadtree_settings.ignore.path_glob` - -Files whose full path match these [glob patterns](https://en.wikipedia.org/wiki/Glob_%28programming%29) will be ignored. - -**default:** - -```json -[] -``` - ---- - -### chadtree_settings.view - -Some options to change CHADTree's appearance - -#### `chadtree_settings.view.open_direction` - -Which way does CHADTree open? - -**legal keys: one of** - -```json -["left", "right"] -``` - -**default:** - -```json -"left" -``` - -#### `chadtree_settings.view.sort_by` - -CHADTree can sort by the following criterion. Reorder them if you want a different sorting order. - -**legal keys: some of** - -```json -["is_folder", "ext", "file_name_lower", "file_name"] -``` - -**default:** - -```json -["is_folder", "ext", "file_name_lower", "file_name"] -``` - -#### `chadtree_settings.view.width` - -How big is CHADTree when initially opened? - -**default:** - -```json -40 -``` - -#### `chadtree_settings.view.window_options` - -Set of window local options to for CHADTree windows - -**default:** - -```json -{ - "cursorline": true, - "number": false, - "relativenumber": false, - "signcolumn": "no", - "winfixwidth": true, - "wrap": false -} -``` - ---- - -### chadtree_settings.theme - -See help docs on [themes](https://github.com/ms-jpq/chadtree/tree/chad/docs/THEME.md) diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/FEATURES.md b/config/neovim/store/lazy-plugins/chadtree/docs/FEATURES.md deleted file mode 100644 index da7a8cb9..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/docs/FEATURES.md +++ /dev/null @@ -1,41 +0,0 @@ -# Features - -## Filtering - -![filtering.gif](https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/filtering.gif) - -## Follow Mode - -![follow.gif](https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/follow.gif) - -## Git Integrations - -![git.gif](https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/git_showcase.gif) - -## Quickfix - -![quickfix.gif](https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/quickfix.gif) - -## Sessions - -![session.gif](https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/session.gif) - -## Visual Select - -![visual_select.gif](https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/visual_select.gif) - -## Github Colours - -![github_colours.png](https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/github_colours.png) - -## LS_COLORS - -![ls_colours.png](https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/ls_colours.png) - -## LS -l statistics - -![ls_l.png](https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/ls_l.png) - -## MimeType warning - -![mimetype.png](https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/mimetype.png) diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/KEYBIND.md b/config/neovim/store/lazy-plugins/chadtree/docs/KEYBIND.md deleted file mode 100644 index 6633dd46..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/docs/KEYBIND.md +++ /dev/null @@ -1,433 +0,0 @@ -# Keybinds - -Keybinds can be customized under `chadtree_settings.keymap.` with a set of keys. - ---- - -## Window management - -##### `chadtree_settings.keymap.quit` - -Close CHADTree window, quit if it is the last window. - -**default:** - -```json -["q"] -``` - -##### `chadtree_settings.keymap.bigger` - -Resize CHADTree window bigger. - -**default:** - -```json -["+", "="] -``` - -##### `chadtree_settings.keymap.smaller` - -Resize CHADTree window smaller. - -**default:** - -```json -["-", "_"] -``` - -##### `chadtree_settings.keymap.refresh` - -Refresh CHADTree. - -**default:** - -```json -[""] -``` - ---- - -## Rerooting CHADTree - -##### `chadtree_settings.keymap.change_dir` - -Change vim's working directory. - -**default:** - -```json -["b"] -``` - -##### `chadtree_settings.keymap.change_focus` - -Set CHADTree's root to folder at cursor. Does not change working directory. - -**default:** - -```json -["c"] -``` - -##### `chadtree_settings.keymap.change_focus_up` - -Set CHADTree's root one level up. - -**default:** - -```json -["C"] -``` - ---- - -## Open file / folder - -Any of the keys that open files will double as a open / close toggle on folders. - -##### `chadtree_settings.keymap.primary` - -Open file at cursor. - -**default:** - -```json -[""] -``` - -##### `chadtree_settings.keymap.secondary` - -Open file at cursor, keep cursor in CHADTree's window. - -**default:** - -```json -["", "<2-leftmouse>"] -``` - -##### `chadtree_settings.keymap.tertiary` - -Open file at cursor in a new tab. - -**default:** - -```json -["", ""] -``` - -##### `chadtree_settings.keymap.v_split` - -Open file at cursor in vertical split. - -**default:** - -```json -["w"] -``` - -##### `chadtree_settings.keymap.h_split` - -Open file at cursor in horizontal split. - -**default:** - -```json -["W"] -``` - -##### `chadtree_settings.keymap.open_sys` - -Open file with GUI tools using `open` or `xdg open`. This will open third party tools such as `Finder` or `KDE Dolphin` or `GNOME nautilus`, etc. Depends on platform and user setup. - -**default:** - -```json -["o"] -``` - -##### `chadtree_settings.keymap.collapse` - -Collapse all subdirectories for directory at cursor. - -**default:** - -```json -["", "`"] -``` - ---- - -## Doing things with cursor - -##### `chadtree_settings.keymap.refocus` - -Put cursor at the root of CHADTree - -**default:** - -```json -["~"] -``` - -##### `chadtree_settings.keymap.jump_to_current` - -Position cursor in CHADTree at currently open buffer, if the buffer points to a location visible under CHADTree. - -**default:** - -```json -["J"] -``` - -##### `chadtree_settings.keymap.stat` - -Print `ls --long` stat for file under cursor. - -**default:** - -```json -["K"] -``` - -##### `chadtree_settings.keymap.copy_name` - -Copy paths of files under cursor or visual block. - -**default:** - -```json -["Y"] -``` - -##### `chadtree_settings.keymap.copy_basename` - -Copy names of files under cursor or visual block. - -**default:** - -```json -["y"] -``` - -##### `chadtree_settings.keymap.copy_relname` - -Copy relative paths of files under cursor or visual block. - -**default:** - -```json -[""] -``` - ---- - -## Filtering - -##### `chadtree_settings.keymap.filter` - -Set a glob pattern to narrow down visible files. - -**default:** - -```json -["f"] -``` - -##### `chadtree_settings.keymap.clear_filter` - -Clear filter. - -**default:** - -```json -["F"] -``` - ---- - -## Bookmarks - -##### `chadtree_settings.keymap.bookmark_goto` - -Goto bookmark `A-Z`. - -**default:** - -```json -["m"] -``` - ---- - -## Selecting - -##### `chadtree_settings.keymap.select` - -Select files under cursor or visual block. - -**default:** - -```json -["s"] -``` - -##### `chadtree_settings.keymap.clear_selection` - -Clear selection. - -**default:** - -```json -["S"] -``` - ---- - -## File operations - -##### `chadtree_settings.keymap.new` - -Create new file at location under cursor. Files ending with platform specific path separator will be folders. - -Intermediary folders are created automatically. - -ie. `uwu/owo/` under `unix` will create `uwu/` then `owo/` under it. Both are folders. - -**default:** - -```json -["a"] -``` - -##### `chadtree_settings.keymap.link` - -Create links at location under cursor from selection. - -Links are always relative. - -Intermediary folders are created automatically. - -**default:** - -```json -["A"] -``` - -##### `chadtree_settings.keymap.rename` - -Rename file under cursor. - -**default:** - -```json -["r"] -``` - -##### `chadtree_settings.keymap.toggle_exec` - -Toggle all the `+x` bits of the selected / highlighted files. - -Except for directories, where `-x` will prevent reading. - -**default:** - -```json -["X"] -``` - -##### `chadtree_settings.keymap.copy` - -Copy the selected files to location under cursor. - -**default:** - -```json -["p"] -``` - -##### `chadtree_settings.keymap.cut` - -Move the selected files to location under cursor. - -**default:** - -```json -["x"] -``` - -##### `chadtree_settings.keymap.delete` - -Delete the selected files. Items deleted cannot be recovered. - -**default:** - -```json -["d"] -``` - -##### `chadtree_settings.keymap.trash` - -Trash the selected files using platform specific `trash` command, if they are available. Items trashed may be recovered. - -You need [`brew install trash`](https://formulae.brew.sh/formula/trash) for MacOS and [`pip3 install trash-cli`](https://github.com/andreafrancia/trash-cli) on Linux. - -**default:** - -```json -["t"] -``` - ---- - -## Toggle settings on / off - -##### `chadtree_settings.keymap.toggle_hidden` - -Toggle `show_hidden` on and off. See `chadtree_settings.options.show_hidden` for details. - -**default:** - -```json -["."] -``` - -##### `chadtree_settings.keymap.toggle_follow` - -Toggle `follow` on and off. See `chadtree_settings.options.follow` for details. - -**default:** - -```json -["u"] -``` - -##### `chadtree_settings.keymap.toggle_follow_links` - -Toggle `follow_links` on and off. See `chadtree_settings.options.follow_links` for details. - -**default:** - -```json -["U"] -``` - -##### `chadtree_settings.keymap.toggle_follow_ignore` - -Toggle `follow_ignore` on and off. See `chadtree_settings.options.follow_ignore` for details. - -**default:** - -```json -["T"] -``` - -##### `chadtree_settings.keymap.toggle_version_control` - -Toggle version control integration on and off - -**default:** - -```json -["i"] -``` diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/MIGRATION.md b/config/neovim/store/lazy-plugins/chadtree/docs/MIGRATION.md deleted file mode 100644 index 02d2dadf..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/docs/MIGRATION.md +++ /dev/null @@ -1,116 +0,0 @@ -# Migration - -Hello everybody, I am dropping support for `python_version < 3.8.2` for the main branch. - -Please use the `legacy` branch if you cannot use newer versions of `python`. - -I am very sorry about this, but I am doing this in order to support more awesome features. - -## What you need to do: - -Run the following once after updating your git repo to latest - -```vim -:UpdateRemotePlugins -``` - -Change your extension manager to use the following: - -```vim -Plug 'ms-jpq/chadtree', {'branch': 'chad', 'do': 'python3 -m chadtree deps'} - -``` - -Run `:CHADdeps` the first time before you use `:CHADopen` - -**Check out [`new configuration`](https://github.com/ms-jpq/chadtree/blob/chad/docs/CONFIGURATION.md)**. It is incompatible with the old one, BUT comes with a new parser and vaildator so the migration will be mostly just renaming one or two keys. - -If you make a typo, CHADTree will tell you so! - -## Why? - -Several reasons: - -Python `3.8.2` is the version of `python` on the latest Ubuntu LTS. - -There are some features I wanted to add that strictly cannot be supported below `python 3.8`. For example, I wanted to include a spec validator, but `python 3.7` lacks support for `Literal` in the `typing` module, and therefore could introduce ambiguities in the parser. - -The old CHADTree ran by `nvim`'s default extension implementation, which had major short comings: - -1. Everything ran in the same process. - -2. The user needs to call `:UpdateRemotePlugins` each time I add a new RPC end point, or else they will get a random confusing error. - -3. [`pynvim`](https://github.com/neovim/pynvim) needed to be installed, For most users who aren't familiar with how `pip` and python modules work. This will either mess up their usage of `virtualenv`, or require a global or user level `pip` package just to use CHADTree. - -In order to fix these issues, I will have to make breaking changes anyways, why not now? - -## Solutions - -At the cost of one time migration, which means users need to update their configs and perhaps python version. I will deilver enough features to warrant the upgrade. - -## New Features - -### Independent package management - -CHADTree now will use all local dependencies. Which means `pynvim` can be installed under a subdirectory to `chadtree`. Doing a `rm -rf` on CHADTree will cleanly remove everything it brings in. - -Nothing will pollute the global namespace for python. - -### Isolated Process - -CHADTree now runs inside an isolated process! Not only will it start faster, it will also be isolated from your other python plugins. In case of errors or crashes, they will not affect each other nearly as much! - -### New Vaildating Config Parser - -CHADTree will now validate your typos and misunderstandings on how to configure it! No more silent failures. If you make a typo in the config, it will tell you loud and clear! - -New `property.sub_property` syntax also supported on a recursive level. - -### Faster startup - -CHADTree started up kinda of slowly before. I have made it perceptibly faster through various marginal improvements. - -### Bigly Improved Documentation - -CHADTree now comes with it's own help command! - -Use `:CHADhelp {topic}` to open up built-in help docs in a floating window. - -Use `:CHADhelp {topic} --web` to open up the same help docs in a browser. - -### Parallel File System Operations - -Previously CHADTree was fast because it was async. - -Now CHADTree can be even faster because it does things in parallel. - -See [design document here](https://github.com/ms-jpq/chadtree/tree/chad/docs/ARCHITECTURE.md) for details. - -### Vastly Improved Rendering Speed - -You know how React is famous because it only renders what needs to be changed? - -CHADTree now uses a React-like virtual rendering target. It only re-renders the minimal amount of lines. CHADTree can now handle thousands of visible files and still be reasonably performant! - -_This is only visible when you have 1000+ files visible. The old ways was fast enough for most tasks._ - -### Theming - -Yub, this is yuge. The #1 request was for more themes. They have came! - -Go see `:CHADhelp theme` for [details](https://github.com/ms-jpq/chadtree/tree/chad/docs/THEME.md). - -### Even more Polish - -- Maintain cursor position in many circumstances, ie. move root up / down, filtering for files, renaming, creating files, etc - -- Selection of hidden / invisible files no longer possible. - -- Retain selection when copying or moving files. - -- Now shows `git submodules` - -### Even Higher Quality Code - -Yes the quality of code is a feature. The better the code, the easier it is for me and other people to add in future improvements. diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/README.md b/config/neovim/store/lazy-plugins/chadtree/docs/README.md deleted file mode 100644 index 96472235..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/docs/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# Docs - -Use `:CHADhelp` to open up a list of help pages! - -Help docs are written in `markdown` because a picture is worth a thousand words. - -Use `:CHADhelp -w` or `:CHADhelp --web` to open help pages in a browser window if possible. - -Use `:CHADhelp {topic}` or `:CHADhelp {topic} --web` to visit a particular topic for more information - -- [:CHADhelp features](https://github.com/ms-jpq/chadtree/tree/chad/docs/FEATURES.md) - -- [:CHADhelp keybind](https://github.com/ms-jpq/chadtree/tree/chad/docs/KEYBIND.md) - -- [:CHADhelp config](https://github.com/ms-jpq/chadtree/tree/chad/docs/CONFIGURATION.md) - -- [:CHADhelp theme](https://github.com/ms-jpq/chadtree/tree/chad/docs/THEME.md) - -- [:CHADhelp migration](https://github.com/ms-jpq/chadtree/tree/chad/docs/MIGRATION.md) - ---- - -## Commands - -### `CHADopen` - -`:CHADopen` will toggle CHADTree open / close - -`:CHADopen ` will open at `` - -`:CHADopen --always-focus` will disable toggle if already opened - -`:CHADopen --nofocus` will open CHADTree without giving the sidebar focus - -`:CHADopen --version-ctl` will open CHADTree at version control top level. - -### `CHADdeps` - -`:CHADdeps` will install all of CHADTree's dependencies locally. - -Dependencies will be privately installed inside CHADTree's git root under `.vars/runtime`. - -Running `rm -rf` on `chadtree/` will cleanly remove everything CHADTree installs to your local system. diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/THEME.md b/config/neovim/store/lazy-plugins/chadtree/docs/THEME.md deleted file mode 100644 index e9f42b0c..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/docs/THEME.md +++ /dev/null @@ -1,154 +0,0 @@ -# Theme - -CHADTree does not define it's own theme, outside of some minimal defaults. - -All themes are imported from other open source projects. - -You can customize themes using the `chadtree_settings.theme` settings. - ---- - -### `chadtree_settings.theme.highlights` - -Vim comes with some built-in highlight groups, these are used to colour things which I cannot find good imports for. - -see `:help highlight-groups` - -#### `chadtree_settings.theme.highlights.ignored` - -These are used for files that are ignored by user supplied pattern in `chadtree_settings.ignore` and by version control. - -**default:** - -```json -"Comment" -``` - -#### `chadtree_settings.theme.highlights.bookmarks` - -These are used to show bookmarks. - -**default:** - -```json -"Title" -``` - -#### `chadtree_settings.theme.highlights.quickfix` - -These are used to notify the number of times a file / folder appears in the `quickfix` list. - -**default:** - -```json -"Label" -``` - -#### `chadtree_settings.theme.highlights.version_control` - -These are used to put a version control status beside each file. - -**default:** - -```json -"Comment" -``` - ---- - -### `chadtree_settings.theme.icon_glyph_set` - -To use **devicons**, you will need [supported fonts](https://github.com/ryanoasis/nerd-fonts#font-installation) - -**devicons:** - -Imported from [vim-devicons](https://github.com/ryanoasis/vim-devicons) - -![devicons.png](https://github.com/ms-jpq/chadtree/raw/chad/docs/img/icons_devicons.png) - -**emoji:** - -Imported from [vim-emoji-icon-theme](https://github.com/adelarsq/vim-emoji-icon-theme) - -![emojicons.png](https://github.com/ms-jpq/chadtree/raw/chad/docs/img/icons_emoji.png) - -**ascii:** - -![asciicons.png](https://github.com/ms-jpq/chadtree/raw/chad/docs/img/icons_ascii.png) - -**ascii_hollow:** - -![ascii_hollow_icons.png](https://github.com/ms-jpq/chadtree/raw/chad/docs/img/icons_ascii_hollow.png) - - -**default:** - -```json -"devicons" -``` - ---- - -### `chadtree_settings.theme.text_colour_set` - -On `unix`, the command `ls` can produce coloured results based on the `LS_COLORS` environmental variable. - -CHADTree can pretend it's `ls` by setting `chadtree_settings.theme.text_colour_set` to `env`. - -If you are not happy with that, you can choose one of the many others: - -- [dircolors-solarized](https://github.com/seebi/dircolors-solarized) - -- [nord-dircolors](https://github.com/arcticicestudio/nord-dircolors) - -- [trapd00r](https://github.com/trapd00r/LS_COLORS) - -- [vim-nerdtree-syntax-highlight](https://github.com/tiagofumo/vim-nerdtree-syntax-highlight) - -**legal keys: one of** - -```json -[ - "env", - "solarized_dark_256", - "solarized_dark", - "solarized_light", - "solarized_universal", - "nord", - "trapdoor", - "nerdtree_syntax_light", - "nerdtree_syntax_dark" -] -``` - -**default:** - -```json -"env" -``` - ---- - -### `chadtree_settings.theme.icon_colour_set` - -Right now you all the file icons are coloured according to [Github colours](https://github.com/github/linguist). - -You may also disable colouring if you wish. - -**github:** - -![github_colours.png](https://raw.githubusercontent.com/ms-jpq/chadtree/chad/docs/img/github_colours.png) - -**legal keys: one of** - -```json -["github", "none"] -``` - -**default:** - -```json -"github" -``` - ---- diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/img/bookmarks.png b/config/neovim/store/lazy-plugins/chadtree/docs/img/bookmarks.png deleted file mode 100644 index 8c126f0d..00000000 Binary files a/config/neovim/store/lazy-plugins/chadtree/docs/img/bookmarks.png and /dev/null differ diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/img/filtering.gif b/config/neovim/store/lazy-plugins/chadtree/docs/img/filtering.gif deleted file mode 100644 index c6dbf0af..00000000 Binary files a/config/neovim/store/lazy-plugins/chadtree/docs/img/filtering.gif and /dev/null differ diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/img/follow.gif b/config/neovim/store/lazy-plugins/chadtree/docs/img/follow.gif deleted file mode 100644 index b7c46fd7..00000000 Binary files a/config/neovim/store/lazy-plugins/chadtree/docs/img/follow.gif and /dev/null differ diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/img/git_showcase.gif b/config/neovim/store/lazy-plugins/chadtree/docs/img/git_showcase.gif deleted file mode 100644 index dd88c987..00000000 Binary files a/config/neovim/store/lazy-plugins/chadtree/docs/img/git_showcase.gif and /dev/null differ diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/img/github_colours.png b/config/neovim/store/lazy-plugins/chadtree/docs/img/github_colours.png deleted file mode 100644 index 6cb955c0..00000000 Binary files a/config/neovim/store/lazy-plugins/chadtree/docs/img/github_colours.png and /dev/null differ diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/img/icons_ascii.png b/config/neovim/store/lazy-plugins/chadtree/docs/img/icons_ascii.png deleted file mode 100644 index 3d4ecc91..00000000 Binary files a/config/neovim/store/lazy-plugins/chadtree/docs/img/icons_ascii.png and /dev/null differ diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/img/icons_ascii_hollow.png b/config/neovim/store/lazy-plugins/chadtree/docs/img/icons_ascii_hollow.png deleted file mode 100644 index 434768f7..00000000 Binary files a/config/neovim/store/lazy-plugins/chadtree/docs/img/icons_ascii_hollow.png and /dev/null differ diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/img/icons_devicons.png b/config/neovim/store/lazy-plugins/chadtree/docs/img/icons_devicons.png deleted file mode 100644 index 67a20905..00000000 Binary files a/config/neovim/store/lazy-plugins/chadtree/docs/img/icons_devicons.png and /dev/null differ diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/img/icons_emoji.png b/config/neovim/store/lazy-plugins/chadtree/docs/img/icons_emoji.png deleted file mode 100644 index bb18846d..00000000 Binary files a/config/neovim/store/lazy-plugins/chadtree/docs/img/icons_emoji.png and /dev/null differ diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/img/ls_colours.png b/config/neovim/store/lazy-plugins/chadtree/docs/img/ls_colours.png deleted file mode 100644 index c363118f..00000000 Binary files a/config/neovim/store/lazy-plugins/chadtree/docs/img/ls_colours.png and /dev/null differ diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/img/ls_l.png b/config/neovim/store/lazy-plugins/chadtree/docs/img/ls_l.png deleted file mode 100644 index 4ca323b3..00000000 Binary files a/config/neovim/store/lazy-plugins/chadtree/docs/img/ls_l.png and /dev/null differ diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/img/mimetype.png b/config/neovim/store/lazy-plugins/chadtree/docs/img/mimetype.png deleted file mode 100644 index 14d1b7a0..00000000 Binary files a/config/neovim/store/lazy-plugins/chadtree/docs/img/mimetype.png and /dev/null differ diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/img/quickfix.gif b/config/neovim/store/lazy-plugins/chadtree/docs/img/quickfix.gif deleted file mode 100644 index f13b9df8..00000000 Binary files a/config/neovim/store/lazy-plugins/chadtree/docs/img/quickfix.gif and /dev/null differ diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/img/schema_error.png b/config/neovim/store/lazy-plugins/chadtree/docs/img/schema_error.png deleted file mode 100644 index eb424039..00000000 Binary files a/config/neovim/store/lazy-plugins/chadtree/docs/img/schema_error.png and /dev/null differ diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/img/session.gif b/config/neovim/store/lazy-plugins/chadtree/docs/img/session.gif deleted file mode 100644 index 25e46daa..00000000 Binary files a/config/neovim/store/lazy-plugins/chadtree/docs/img/session.gif and /dev/null differ diff --git a/config/neovim/store/lazy-plugins/chadtree/docs/img/visual_select.gif b/config/neovim/store/lazy-plugins/chadtree/docs/img/visual_select.gif deleted file mode 100644 index 62684e2d..00000000 Binary files a/config/neovim/store/lazy-plugins/chadtree/docs/img/visual_select.gif and /dev/null differ diff --git a/config/neovim/store/lazy-plugins/chadtree/locale/c.yml b/config/neovim/store/lazy-plugins/chadtree/locale/c.yml deleted file mode 100644 index 20713ce3..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/locale/c.yml +++ /dev/null @@ -1,97 +0,0 @@ ---- -"already_exists": |- - !! Exists: ${name} - -"paths already exist": |- - !! -- ${operation}: path(s) already exist! :: - ${paths} - -"new cwd": |- - $$PWD=${cwd} - -"ask_trash": |- - Trash? - ${display_paths} - -"ask_yesno": |- - &Yes - &No - -"cannot find version ctl root": |- - !! Cannot find version control top level - -"operation not permitted on root": |- - Operation not permitted on root or parent(s) of root - -"render time warning": |- - !! Warning: Render time is slow @${duration}s, consider closing some folders - -"copy": |- - Copy - -"copy_paths": |- - Copied ${copied_paths} - -"cut": |- - Cut - -"confirm op": |- - ${operation} ? - ${paths} - -"dead_link": |- - !! cannot open dead link: ${name} - -"filter_click": |- - !! cannot click on folders while filtering - -"follow_mode_indi": |- - !! follow mode: ${follow} - -"follow_links_indi": |- - !! follow links: ${follow} - -"follow_ignore_indi": |- - !! follow ignore: ${follow} - -"hourglass": |- - Wait... - -"link": |- - Link ${src} ->: - -"mime_warn": |- - ${name} have possible mimetype ${mime}, continue? - -"new_filter": |- - New Filter: - -"new_search": |- - New Search: - -"nothing_select": |- - !! -- nothing selected! - -"ok_sym": |- - Ok - -"path_exists_err": |- - !! Path exist - Rename: - -"pencil": |- - Input: - -"clear_bookmarks": |- - ${idx}. Clear! - -"no_bookmarks": |- - !! Error - no bookmarks found - -"sys_open_err": |- - !! Error -- cannot find system opener - -"sys_trash_err": |- - !! Error -- cannot find trash program - -"version_control_indi": |- - 🐶 enable version control: ${enable_vc} diff --git a/config/neovim/store/lazy-plugins/chadtree/locale/en.yml b/config/neovim/store/lazy-plugins/chadtree/locale/en.yml deleted file mode 100644 index e45eb637..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/locale/en.yml +++ /dev/null @@ -1,97 +0,0 @@ ---- -"already_exists": |- - ⚠️ Exists: ${name} - -"paths already exist": |- - ⚠️ -- ${operation} : path(s) already exist! :: - ${paths} - -"new cwd": |- - 🏠 =${cwd} - -"ask_trash": |- - 🗑 ? - ${display_paths} - -"ask_yesno": |- - &Yes - &No - -"cannot find version ctl root": |- - ⚠️ Cannot find version control top level - -"operation not permitted on root": |- - ⚠️ Operation not permitted on root or parent(s) of root - -"render time warning": |- - ⚠️ Warning: Render time is slow @${duration}s, consider closing some folders - -"copy": |- - 🖇 - -"copy_paths": |- - 📎 ${copied_paths} - -"cut": |- - ✂️ - -"confirm op": |- - ${operation} ? - ${paths} - -"dead_link": |- - ⚠️ cannot open dead link: ${name} - -"filter_click": |- - ⚠️ cannot click on folders while filtering - -"follow_mode_indi": |- - 🐶 follow mode: ${follow} - -"follow_links_indi": |- - 🔗 follow mode: ${follow} - -"follow_ignore_indi": |- - 🌫️ follow mode: ${follow} - -"hourglass": |- - ⏳...⌛️ - -"link": |- - 🔗 ${src} 👉 : - -"mime_warn": |- - ${name} have possible mimetype ${mime}, continue? - -"new_filter": |- - New Filter: - -"new_search": |- - 🔍: - -"nothing_select": |- - ⚠️ -- nothing selected! - -"ok_sym": |- - ✅ - -"path_exists_err": |- - ⚠️ Path exist!!! Rename: - -"pencil": |- - ✏️ : - -"clear_bookmarks": |- - ${idx}. 🔖 Clear! - -"no_bookmarks": |- - ⚠️ Error - no bookmarks found - -"sys_open_err": |- - ⚠️ Error -- cannot find system opener - -"sys_trash_err": |- - ⚠️ Error -- cannot find trash program - -"version_control_indi": |- - 🐶 enable version control: ${enable_vc} diff --git a/config/neovim/store/lazy-plugins/chadtree/locale/zh.yml b/config/neovim/store/lazy-plugins/chadtree/locale/zh.yml deleted file mode 100644 index 6c5bc50b..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/locale/zh.yml +++ /dev/null @@ -1,97 +0,0 @@ ---- -"already_exists": |- - ⚠️ 已存在: ${name} - -"paths already exist": |- - ⚠️ -- ${operation} : 路径已存在! :: - ${paths} - -"new cwd": |- - 🏠 =${cwd} - -"ask_trash": |- - 🗑 ? - ${display_paths} - -"ask_yesno": |- - &Y (确定) - &N (取消) - -"cannot find version ctl root": |- - ⚠️ 文件系统顶层找不到版本控制 - -"operation not permitted on root": |- - ⚠️ 此操作不可文件系统顶层(以上) - -"render time warning": |- - ⚠️ 警告: 渲染时间有点慢 @${duration}s, 考虑关闭一些文件夹 - -"copy": |- - 🖇 - -"copy_paths": |- - 📎 ${copied_paths} - -"cut": |- - ✂️ - -"confirm op": |- - ${operation} ? - ${paths} - -"dead_link": |- - ⚠️ 打不开死链接: ${name} - -"filter_click": |- - ⚠️ 不可在过滤时点击文件夹 - -"follow_mode_indi": |- - 🐶 跟随模式: ${follow} - -"follow_links_indi": |- - 🔗 跟随模式: ${follow} - -"follow_ignore_indi": |- - 🌫️ 跟随模式: ${follow} - -"hourglass": |- - ⏳...⌛️ - -"link": |- - 🔗 ${src} 👉 : - -"mime_warn": |- - ${name} 文件猜到 mimetype ${mime}, 继续? - -"new_filter": |- - 新过滤: - -"new_search": |- - 🔍: - -"nothing_select": |- - ⚠️ -- 选择是空的! - -"ok_sym": |- - ✅ - -"path_exists_err": |- - ⚠️ 路径已存在!!! 重新命名: - -"pencil": |- - ✏️ : - -"clear_bookmarks": |- - ${idx}. 🔖 清除 - -"no_bookmarks": |- - ⚠️ 错误 -- 找不到书签 - -"sys_open_err": |- - ⚠️ 错误 -- 找不到系统开启程序 - -"sys_trash_err": |- - ⚠️ 错误 -- 找不到垃圾(trash)程序 - -"version_control_indi": |- - 🐶 版本控制: ${enable_vc} diff --git a/config/neovim/store/lazy-plugins/chadtree/lua/chadtree.lua b/config/neovim/store/lazy-plugins/chadtree/lua/chadtree.lua deleted file mode 100644 index 82562bc4..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/lua/chadtree.lua +++ /dev/null @@ -1,212 +0,0 @@ -CHAD = CHAD or {} -chad = chad or {} - -local linesep = "\n" -local POLLING_RATE = 10 -local is_win = vim.api.nvim_call_function("has", {"win32"}) == 1 - -local cwd = (function() - local source = debug.getinfo(2, "S").source - local file = string.match(source, "^@(.*)") - return vim.api.nvim_call_function("fnamemodify", {file, ":p:h:h"}) -end)() - -local function defer(timeout, callback) - local timer = vim.loop.new_timer() - timer:start( - timeout, - 0, - function() - timer:stop() - timer:close() - vim.schedule(callback) - end - ) - return timer -end - -local settings = function() - local go, _settings = pcall(vim.api.nvim_get_var, "chadtree_settings") - local settings = go and _settings or {} - return settings -end - -local job_id = nil -local err_exit = false - -chad.on_exit = function(args) - local code = unpack(args) - if not (code == 0 or code == 143) then - err_exit = true - vim.api.nvim_err_writeln("CHADTree EXITED - " .. code) - else - err_exit = false - end - job_id = nil -end - -chad.on_stdout = function(args) - local msg = unpack(args) - vim.api.nvim_out_write(table.concat(msg, linesep)) -end - -chad.on_stderr = function(args) - local msg = unpack(args) - if vim.api.nvim_call_function("has", {"nvim-0.5"}) == 1 then - vim.api.nvim_echo({{table.concat(msg, linesep), "ErrorMsg"}}, true, {}) - else - vim.api.nvim_err_write(table.concat(msg, linesep)) - end -end - -local go, _py3 = pcall(vim.api.nvim_get_var, "python3_host_prog") -local py3 = go and _py3 or (is_win and "python.exe" or "python3") -local xdg_dir = vim.api.nvim_call_function("stdpath", {"data"}) - -local main = function(is_xdg) - local v_py = - cwd .. - (is_win and [[/.vars/runtime/Scripts/python.exe]] or - "/.vars/runtime/bin/python3") - - if is_win then - local v_py_xdg = xdg_dir .. "/chadrt/Scripts/python" - local v_py = is_xdg and v_py_xdg or v_py - if vim.api.nvim_call_function("filereadable", {v_py}) == 1 then - return {v_py} - else - -- local win_proxy = cwd .. [[/win.cmd]] - return {py3} - end - else - local v_py_xdg = xdg_dir .. "/chadrt/bin/python3" - local v_py = is_xdg and v_py_xdg or v_py - if vim.api.nvim_call_function("filereadable", {v_py}) == 1 then - return {v_py} - else - return {py3} - end - end -end - -local start = function(deps, ...) - local is_xdg = settings().xdg - local args = - vim.tbl_flatten { - deps and py3 or main(is_xdg), - {"-s", "-u", "-m", "chadtree"}, - {...}, - (is_xdg and {"--xdg", xdg_dir} or {}) - } - local params = { - cwd = cwd, - env = {PYTHONSAFEPATH = "1", PYTHONPATH = cwd}, - on_exit = "CHADon_exit", - on_stdout = (function() - if deps then - return nil - else - return "CHADon_stdout" - end - end)(), - on_stderr = (function() - if deps then - return nil - else - return "CHADon_stderr" - end - end)() - } - if deps then - vim.api.nvim_command [[new]] - vim.api.nvim_call_function("termopen", {args, params}) - else - job_id = vim.api.nvim_call_function("jobstart", {args, params}) - return job_id - end -end - -chad.Deps = function() - start(true, "deps") -end - -vim.api.nvim_command [[command! -nargs=0 CHADdeps lua chad.Deps()]] - -local set_chad_call = function(cmd) - local t1 = 0 - chad[cmd] = function(...) - local args = {...} - if t1 == 0 then - t1 = vim.loop.now() - end - - if not job_id then - local srv = is_win and {"localhost:0"} or {} - local server = vim.api.nvim_call_function("serverstart", srv) - job_id = - start( - false, - "run", - "--ppid", - vim.api.nvim_call_function("getpid", {}), - "--socket", - server - ) - end - - if not err_exit and CHAD[cmd] then - CHAD[cmd](args) - local t2 = vim.loop.now() - if settings().profiling and t1 >= 0 then - print("Init " .. (t2 - t1) .. "ms") - end - t1 = -1 - else - defer( - POLLING_RATE, - function() - if err_exit then - return - else - chad[cmd](unpack(args)) - end - end - ) - end - end -end - -set_chad_call("Noop") - -set_chad_call("Open") -vim.api.nvim_command [[command! -nargs=* CHADopen lua chad.Open()]] - -set_chad_call("Help") -vim.api.nvim_command [[command! -nargs=* CHADhelp lua chad.Help()]] - -set_chad_call("Restore") -vim.api.nvim_command [[command! -nargs=0 CHADrestore lua chad.Restore()]] - -chad.lsp_ensure_capabilities = function(cfg) - local spec1 = { - capabilities = vim.lsp.protocol.make_client_capabilities() - } - local spec2 = { - capabilities = { - workspace = { - fileOperations = { - didCreate = true, - didRename = true, - didDelete = true - } - } - } - } - local maps = cfg.capabilities and {spec2} or {spec1, spec2} - local new = - vim.tbl_deep_extend("force", cfg or vim.empty_dict(), unpack(maps)) - return new -end - -chad.Noop() -return chad diff --git a/config/neovim/store/lazy-plugins/chadtree/mypy.ini b/config/neovim/store/lazy-plugins/chadtree/mypy.ini deleted file mode 100644 index db81273c..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/mypy.ini +++ /dev/null @@ -1,26 +0,0 @@ -[mypy] -cache_dir = .vars/mypy -check_untyped_defs = true -disallow_any_generics = false -disallow_any_unimported = true -disallow_incomplete_defs = true -disallow_subclassing_any = true -disallow_untyped_calls = true -disallow_untyped_decorators = true -disallow_untyped_defs = true -error_summary = true -extra_checks = true -implicit_reexport = false -no_implicit_optional = true -pretty = true -show_column_numbers = true -show_error_codes = true -show_error_context = true -strict = true -strict_equality = true -warn_incomplete_stub = true -warn_redundant_casts = true -warn_return_any = true -warn_unreachable = true -warn_unused_configs = true -warn_unused_ignores = true diff --git a/config/neovim/store/lazy-plugins/chadtree/plugin/chadtree.vim b/config/neovim/store/lazy-plugins/chadtree/plugin/chadtree.vim deleted file mode 100644 index 3cd3300b..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/plugin/chadtree.vim +++ /dev/null @@ -1,20 +0,0 @@ -autocmd VimEnter * silent! autocmd! FileExplorer -silent! autocmd! FileExplorer - -augroup CHADTree - autocmd! - autocmd FileType CHADTree autocmd BufEnter,WinEnter stopinsert -augroup end - -function CHADon_exit(_, code, __) - call luaeval('chad.on_exit(...)', [a:code]) -endfunction -function CHADon_stdout(_, msg, __) - call luaeval('chad.on_stdout(...)', [a:msg]) -endfunction -function CHADon_stderr(_, msg, __) - call luaeval('chad.on_stderr(...)', [a:msg]) -endfunction - - -call luaeval('require("chadtree") and 0') diff --git a/config/neovim/store/lazy-plugins/chadtree/pyproject.toml b/config/neovim/store/lazy-plugins/chadtree/pyproject.toml deleted file mode 100644 index 57bd13e1..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/pyproject.toml +++ /dev/null @@ -1,7 +0,0 @@ -[project] -name = "chadtree" -requires-python = ">=3.8.0" -version = "0" - -[project.optional-dependencies] -dev = ["mypy", "types-PyYAML", "black", "isort"] diff --git a/config/neovim/store/lazy-plugins/chadtree/requirements.txt b/config/neovim/store/lazy-plugins/chadtree/requirements.txt deleted file mode 100644 index 9537cd0e..00000000 --- a/config/neovim/store/lazy-plugins/chadtree/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -std2@https://github.com/ms-jpq/std2/archive/d8ac12686cdf0d640aed7cee6a981b1835d1724e.tar.gz -pynvim_pp@https://github.com/ms-jpq/pynvim_pp/archive/34e3a027c595981886d7efd1c91071f3eaa4715d.tar.gz -PyYAML diff --git a/config/neovim/store/lazy-plugins/cmp-async-path/.editorconfig b/config/neovim/store/lazy-plugins/cmp-async-path/.editorconfig new file mode 100644 index 00000000..c156167a --- /dev/null +++ b/config/neovim/store/lazy-plugins/cmp-async-path/.editorconfig @@ -0,0 +1,11 @@ +[*.lua] + +indent_size = 2 +#--no-use-tab +indent_style = space +tab_width = 2 + +continuation_indent = 2 +trailing_table_separator = keep +align_continuous_line_space = 2 +space_around_table_field_list = false diff --git a/config/neovim/store/lazy-plugins/cmp-async-path/README.md b/config/neovim/store/lazy-plugins/cmp-async-path/README.md index 36f0406e..457733a8 100644 --- a/config/neovim/store/lazy-plugins/cmp-async-path/README.md +++ b/config/neovim/store/lazy-plugins/cmp-async-path/README.md @@ -52,3 +52,9 @@ Specify if directory names in the completion menu should include a trailing slas _Default:_ returns the current working directory of the current buffer Specifies the base directory for relative paths. + +### show_hidden_files_by_default (type: boolean) + +_Default:_ `false` + +Specify if hidden files should appear in the completion menu without the need of typing `.` first. diff --git a/config/neovim/store/lazy-plugins/cmp-async-path/lua/cmp_async_path/init.lua b/config/neovim/store/lazy-plugins/cmp-async-path/lua/cmp_async_path/init.lua index 6c80b1b1..7ba9b0f3 100644 --- a/config/neovim/store/lazy-plugins/cmp-async-path/lua/cmp_async_path/init.lua +++ b/config/neovim/store/lazy-plugins/cmp-async-path/lua/cmp_async_path/init.lua @@ -1,8 +1,8 @@ -local cmp = require 'cmp' +local cmp = require 'cmp' local NAME_REGEX = '\\%([^/\\\\:\\*?<>\'"`\\|]\\)' local PATH_REGEX = assert(vim.regex( - ([[\%(\%(/PAT*[^/\\\\:\\*?<>\'"`\\| .~]\)\|\%(/\.\.\)\)*/\zePAT*$]]):gsub( - 'PAT', NAME_REGEX))) + ([[\%(\%(/PAT*[^/\\\\:\\*?<>\'"`\\| .~]\)\|\%(/\.\.\)\)*/\zePAT*$]]):gsub('PAT', + NAME_REGEX))) local source = {} @@ -12,6 +12,7 @@ local constants = {max_lines = 20} ---@field public trailing_slash boolean ---@field public label_trailing_slash boolean ---@field public get_cwd fun(table): string +---@field public show_hidden_files_by_default boolean ---@type cmp_path.Option local defaults = { @@ -20,6 +21,7 @@ local defaults = { get_cwd = function(params) return vim.fn.expand(('#%d:p:h'):format(params.context.bufnr)) end, + show_hidden_files_by_default = false, } source.new = function() return setmetatable({}, {__index = source}) end @@ -36,8 +38,8 @@ source.complete = function(self, params, callback) return callback() end - local include_hidden = string.sub(params.context.cursor_before_line, - params.offset, params.offset) == '.' + local include_hidden = option.show_hidden_files_by_default or + string.sub(params.context.cursor_before_line, params.offset, params.offset) == '.' self:_candidates(dirname, include_hidden, option, function(err, candidates) if err then return callback() @@ -66,7 +68,7 @@ source._dirname = function(self, params, option) end local dirname = string.gsub(string.sub(params.context.cursor_before_line, - s + 2), '%a*$', '') -- exclude '/' + s + 2), '%a*$', '') -- exclude '/' local prefix = string.sub(params.context.cursor_before_line, 1, s + 1) -- include '/' local buf_dirname = option.get_cwd(params) @@ -95,14 +97,14 @@ source._dirname = function(self, params, option) accept = accept and not prefix:match('%a/$') -- Ignore URL scheme accept = accept and not prefix:match('%a+:/$') and - not prefix:match('%a+://$') + not prefix:match('%a+://$') -- Ignore HTML closing tags accept = accept and not prefix:match('(comment_toggle_blockwise) Comment.txt /*(comment_toggle_blockwise)* +(comment_toggle_blockwise_count) Comment.txt /*(comment_toggle_blockwise_count)* +(comment_toggle_blockwise_current) Comment.txt /*(comment_toggle_blockwise_current)* +(comment_toggle_blockwise_visual) Comment.txt /*(comment_toggle_blockwise_visual)* +(comment_toggle_linewise) Comment.txt /*(comment_toggle_linewise)* +(comment_toggle_linewise_count) Comment.txt /*(comment_toggle_linewise_count)* +(comment_toggle_linewise_current) Comment.txt /*(comment_toggle_linewise_current)* +(comment_toggle_linewise_visual) Comment.txt /*(comment_toggle_linewise_visual)* +[count]gbc Comment.txt /*[count]gbc* +[count]gcc Comment.txt /*[count]gcc* +comment-nvim Comment.txt /*comment-nvim* +comment-nvim.txt Comment.txt /*comment-nvim.txt* +comment.api Comment.txt /*comment.api* +comment.api.call Comment.txt /*comment.api.call* +comment.api.comment Comment.txt /*comment.api.comment* +comment.api.comment.blockwise Comment.txt /*comment.api.comment.blockwise* +comment.api.comment.linewise Comment.txt /*comment.api.comment.linewise* +comment.api.insert Comment.txt /*comment.api.insert* +comment.api.locked Comment.txt /*comment.api.locked* +comment.api.toggle Comment.txt /*comment.api.toggle* +comment.api.toggle.blockwise Comment.txt /*comment.api.toggle.blockwise* +comment.api.toggle.linewise Comment.txt /*comment.api.toggle.linewise* +comment.api.uncomment Comment.txt /*comment.api.uncomment* +comment.api.uncomment.blockwise Comment.txt /*comment.api.uncomment.blockwise* +comment.api.uncomment.linewise Comment.txt /*comment.api.uncomment.linewise* +comment.commentstring Comment.txt /*comment.commentstring* +comment.config Comment.txt /*comment.config* +comment.config.CommentConfig Comment.txt /*comment.config.CommentConfig* +comment.config.ExtraMapping Comment.txt /*comment.config.ExtraMapping* +comment.config.Mappings Comment.txt /*comment.config.Mappings* +comment.config.Opleader Comment.txt /*comment.config.Opleader* +comment.config.Toggler Comment.txt /*comment.config.Toggler* +comment.config.defaults Comment.txt /*comment.config.defaults* +comment.config:get Comment.txt /*comment.config:get* +comment.contents Comment.txt /*comment.contents* +comment.dotrepeat Comment.txt /*comment.dotrepeat* +comment.extra Comment.txt /*comment.extra* +comment.extra.insert_above Comment.txt /*comment.extra.insert_above* +comment.extra.insert_below Comment.txt /*comment.extra.insert_below* +comment.extra.insert_eol Comment.txt /*comment.extra.insert_eol* +comment.ft Comment.txt /*comment.ft* +comment.ft.calculate Comment.txt /*comment.ft.calculate* +comment.ft.contains Comment.txt /*comment.ft.contains* +comment.ft.get Comment.txt /*comment.ft.get* +comment.ft.set Comment.txt /*comment.ft.set* +comment.keybindings Comment.txt /*comment.keybindings* +comment.opfunc Comment.txt /*comment.opfunc* +comment.opfunc.OpFnParams Comment.txt /*comment.opfunc.OpFnParams* +comment.opfunc.OpMotion Comment.txt /*comment.opfunc.OpMotion* +comment.opfunc.blockwise Comment.txt /*comment.opfunc.blockwise* +comment.opfunc.count Comment.txt /*comment.opfunc.count* +comment.opfunc.linewise Comment.txt /*comment.opfunc.linewise* +comment.opfunc.opfunc Comment.txt /*comment.opfunc.opfunc* +comment.plugmap Comment.txt /*comment.plugmap* +comment.sourcecode Comment.txt /*comment.sourcecode* +comment.usage Comment.txt /*comment.usage* +comment.usage.setup Comment.txt /*comment.usage.setup* +comment.utils Comment.txt /*comment.utils* +comment.utils.CommentCtx Comment.txt /*comment.utils.CommentCtx* +comment.utils.CommentMode Comment.txt /*comment.utils.CommentMode* +comment.utils.CommentMotion Comment.txt /*comment.utils.CommentMotion* +comment.utils.CommentRange Comment.txt /*comment.utils.CommentRange* +comment.utils.CommentType Comment.txt /*comment.utils.CommentType* +comment.utils.cmode Comment.txt /*comment.utils.cmode* +comment.utils.cmotion Comment.txt /*comment.utils.cmotion* +comment.utils.commenter Comment.txt /*comment.utils.commenter* +comment.utils.ctype Comment.txt /*comment.utils.ctype* +comment.utils.get_count_lines Comment.txt /*comment.utils.get_count_lines* +comment.utils.get_lines Comment.txt /*comment.utils.get_lines* +comment.utils.get_region Comment.txt /*comment.utils.get_region* +comment.utils.is_commented Comment.txt /*comment.utils.is_commented* +comment.utils.parse_cstr Comment.txt /*comment.utils.parse_cstr* +comment.utils.uncommenter Comment.txt /*comment.utils.uncommenter* +comment.utils.unwrap_cstr Comment.txt /*comment.utils.unwrap_cstr* +gb Comment.txt /*gb* +gb[count]{motion} Comment.txt /*gb[count]{motion}* +gbc Comment.txt /*gbc* +gc Comment.txt /*gc* +gcA Comment.txt /*gcA* +gcO Comment.txt /*gcO* +gc[count]{motion} Comment.txt /*gc[count]{motion}* +gcc Comment.txt /*gcc* +gco Comment.txt /*gco* diff --git a/config/neovim/store/lazy-plugins/conform.nvim/doc/tags b/config/neovim/store/lazy-plugins/conform.nvim/doc/tags new file mode 100644 index 00000000..a4ee580d --- /dev/null +++ b/config/neovim/store/lazy-plugins/conform.nvim/doc/tags @@ -0,0 +1,14 @@ +Conform conform.txt /*Conform* +conform conform.txt /*conform* +conform-api conform.txt /*conform-api* +conform-contents conform.txt /*conform-contents* +conform-formatters conform.txt /*conform-formatters* +conform-options conform.txt /*conform-options* +conform.format conform.txt /*conform.format* +conform.get_formatter_info conform.txt /*conform.get_formatter_info* +conform.list_all_formatters conform.txt /*conform.list_all_formatters* +conform.list_formatters conform.txt /*conform.list_formatters* +conform.nvim conform.txt /*conform.nvim* +conform.setup conform.txt /*conform.setup* +conform.txt conform.txt /*conform.txt* +conform.will_fallback_lsp conform.txt /*conform.will_fallback_lsp* diff --git a/config/neovim/store/lazy-plugins/flash.nvim/doc/tags b/config/neovim/store/lazy-plugins/flash.nvim/doc/tags new file mode 100644 index 00000000..177a8591 --- /dev/null +++ b/config/neovim/store/lazy-plugins/flash.nvim/doc/tags @@ -0,0 +1,12 @@ +flash.nvim-flash.nvim flash.nvim.txt /*flash.nvim-flash.nvim* +flash.nvim-flash.nvim-alternatives flash.nvim.txt /*flash.nvim-flash.nvim-alternatives* +flash.nvim-flash.nvim-api flash.nvim.txt /*flash.nvim-flash.nvim-api* +flash.nvim-flash.nvim-configuration flash.nvim.txt /*flash.nvim-flash.nvim-configuration* +flash.nvim-flash.nvim-examples flash.nvim.txt /*flash.nvim-flash.nvim-examples* +flash.nvim-flash.nvim-features flash.nvim.txt /*flash.nvim-flash.nvim-features* +flash.nvim-flash.nvim-highlights flash.nvim.txt /*flash.nvim-flash.nvim-highlights* +flash.nvim-flash.nvim-installation flash.nvim.txt /*flash.nvim-flash.nvim-installation* +flash.nvim-flash.nvim-requirements flash.nvim.txt /*flash.nvim-flash.nvim-requirements* +flash.nvim-flash.nvim-usage flash.nvim.txt /*flash.nvim-flash.nvim-usage* +flash.nvim-table-of-contents flash.nvim.txt /*flash.nvim-table-of-contents* +flash.nvim.txt flash.nvim.txt /*flash.nvim.txt* diff --git a/config/neovim/store/lazy-plugins/git-messenger.vim/doc/tags b/config/neovim/store/lazy-plugins/git-messenger.vim/doc/tags new file mode 100644 index 00000000..5a23b27b --- /dev/null +++ b/config/neovim/store/lazy-plugins/git-messenger.vim/doc/tags @@ -0,0 +1,41 @@ +:GitMessenger git-messenger.txt /*:GitMessenger* +:GitMessengerClose git-messenger.txt /*:GitMessengerClose* +(git-messenger) git-messenger.txt /*(git-messenger)* +(git-messenger-close) git-messenger.txt /*(git-messenger-close)* +(git-messenger-into-popup) git-messenger.txt /*(git-messenger-into-popup)* +(git-messenger-scroll-down-1) git-messenger.txt /*(git-messenger-scroll-down-1)* +(git-messenger-scroll-down-half) git-messenger.txt /*(git-messenger-scroll-down-half)* +(git-messenger-scroll-down-page) git-messenger.txt /*(git-messenger-scroll-down-page)* +(git-messenger-scroll-up-1) git-messenger.txt /*(git-messenger-scroll-up-1)* +(git-messenger-scroll-up-half) git-messenger.txt /*(git-messenger-scroll-up-half)* +(git-messenger-scroll-up-page) git-messenger.txt /*(git-messenger-scroll-up-page)* +g:git_messenger_always_into_popup git-messenger.txt /*g:git_messenger_always_into_popup* +g:git_messenger_close_on_cursor_moved git-messenger.txt /*g:git_messenger_close_on_cursor_moved* +g:git_messenger_conceal_word_diff_marker git-messenger.txt /*g:git_messenger_conceal_word_diff_marker* +g:git_messenger_date_format git-messenger.txt /*g:git_messenger_date_format* +g:git_messenger_extra_blame_args git-messenger.txt /*g:git_messenger_extra_blame_args* +g:git_messenger_floating_win_opts git-messenger.txt /*g:git_messenger_floating_win_opts* +g:git_messenger_git_command git-messenger.txt /*g:git_messenger_git_command* +g:git_messenger_include_diff git-messenger.txt /*g:git_messenger_include_diff* +g:git_messenger_into_popup_after_show git-messenger.txt /*g:git_messenger_into_popup_after_show* +g:git_messenger_max_popup_height git-messenger.txt /*g:git_messenger_max_popup_height* +g:git_messenger_max_popup_width git-messenger.txt /*g:git_messenger_max_popup_width* +g:git_messenger_no_default_mappings git-messenger.txt /*g:git_messenger_no_default_mappings* +g:git_messenger_popup_content_margins git-messenger.txt /*g:git_messenger_popup_content_margins* +g:git_messenger_preview_mods git-messenger.txt /*g:git_messenger_preview_mods* +git-messenger-commands git-messenger.txt /*git-messenger-commands* +git-messenger-contents git-messenger.txt /*git-messenger-contents* +git-messenger-health-check git-messenger.txt /*git-messenger-health-check* +git-messenger-highlights git-messenger.txt /*git-messenger-highlights* +git-messenger-install git-messenger.txt /*git-messenger-install* +git-messenger-introduction git-messenger.txt /*git-messenger-introduction* +git-messenger-known-issues git-messenger.txt /*git-messenger-known-issues* +git-messenger-license git-messenger.txt /*git-messenger-license* +git-messenger-mappings git-messenger.txt /*git-messenger-mappings* +git-messenger-popup-window-config git-messenger.txt /*git-messenger-popup-window-config* +git-messenger-repository-page git-messenger.txt /*git-messenger-repository-page* +git-messenger-screenshot git-messenger.txt /*git-messenger-screenshot* +git-messenger-variables git-messenger.txt /*git-messenger-variables* +git-messenger.txt git-messenger.txt /*git-messenger.txt* +git-messenger.vim git-messenger.txt /*git-messenger.vim* +gitmessengerpopup git-messenger.txt /*gitmessengerpopup* diff --git a/config/neovim/store/lazy-plugins/gitsigns.nvim/doc/gitsigns.txt b/config/neovim/store/lazy-plugins/gitsigns.nvim/doc/gitsigns.txt index 4393273a..abfc63e7 100644 --- a/config/neovim/store/lazy-plugins/gitsigns.nvim/doc/gitsigns.txt +++ b/config/neovim/store/lazy-plugins/gitsigns.nvim/doc/gitsigns.txt @@ -93,12 +93,9 @@ Note functions with the {async} attribute are run asynchronously and accept an optional {callback} argument. -setup({cfg}, {callback?}) *gitsigns.setup()* +setup({cfg}) *gitsigns.setup()* Setup and start Gitsigns. - Attributes: ~ - {async} - Parameters: ~ {cfg} (table|nil): Configuration for Gitsigns. See |gitsigns-usage| for more details. diff --git a/config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-23-rocks/gitsigns.nvim/scm-1/doc/gitsigns.txt b/config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-28-rocks/gitsigns.nvim/scm-1/doc/gitsigns.txt similarity index 99% rename from config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-23-rocks/gitsigns.nvim/scm-1/doc/gitsigns.txt rename to config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-28-rocks/gitsigns.nvim/scm-1/doc/gitsigns.txt index 4393273a..abfc63e7 100644 --- a/config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-23-rocks/gitsigns.nvim/scm-1/doc/gitsigns.txt +++ b/config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-28-rocks/gitsigns.nvim/scm-1/doc/gitsigns.txt @@ -93,12 +93,9 @@ Note functions with the {async} attribute are run asynchronously and accept an optional {callback} argument. -setup({cfg}, {callback?}) *gitsigns.setup()* +setup({cfg}) *gitsigns.setup()* Setup and start Gitsigns. - Attributes: ~ - {async} - Parameters: ~ {cfg} (table|nil): Configuration for Gitsigns. See |gitsigns-usage| for more details. diff --git a/config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-23-rocks/gitsigns.nvim/scm-1/gitsigns.nvim-scm-1.rockspec b/config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-28-rocks/gitsigns.nvim/scm-1/gitsigns.nvim-scm-1.rockspec similarity index 100% rename from config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-23-rocks/gitsigns.nvim/scm-1/gitsigns.nvim-scm-1.rockspec rename to config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-28-rocks/gitsigns.nvim/scm-1/gitsigns.nvim-scm-1.rockspec diff --git a/config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-23-rocks/gitsigns.nvim/scm-1/rock_manifest b/config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-28-rocks/gitsigns.nvim/scm-1/rock_manifest similarity index 89% rename from config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-23-rocks/gitsigns.nvim/scm-1/rock_manifest rename to config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-28-rocks/gitsigns.nvim/scm-1/rock_manifest index 694461c3..5fa19114 100644 --- a/config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-23-rocks/gitsigns.nvim/scm-1/rock_manifest +++ b/config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-28-rocks/gitsigns.nvim/scm-1/rock_manifest @@ -1,6 +1,6 @@ rock_manifest = { doc = { - ["gitsigns.txt"] = "b9579713a56199f1374b4e1b12578f42" + ["gitsigns.txt"] = "a329a90ab3b49a53ea44d986cbde6885" }, ["gitsigns.nvim-scm-1.rockspec"] = "a9b165d604ce401cfeea760a9366418d", lua = { @@ -25,9 +25,9 @@ rock_manifest = { ["diff_int.lua"] = "df447e56f11906998e81d5b94499e013", ["diffthis.lua"] = "eb4ff5d430d2c4081f1fa9651d2768f7", git = { - ["version.lua"] = "ab78b8d8a84dd92655e4847223362923" + ["version.lua"] = "068a582ed4565978eb1f6eb089a6fa6c" }, - ["git.lua"] = "082cec98968b0eca1f97f54cbd4ad880", + ["git.lua"] = "89ec79605c259e73ce8c19deb5b63194", ["highlight.lua"] = "1d197d8f0f6f69a6455ac220a6890d80", ["hunks.lua"] = "48fc2d8a9c89815e3c0521b1bb0788e9", ["manager.lua"] = "af94331f013ed04d175e3c2b2d21c42b", @@ -44,6 +44,6 @@ rock_manifest = { ["util.lua"] = "e4c4d677e3ad296adee833318a5c5845", ["watcher.lua"] = "ffcf36424ae17548bdc629cc2de3fcaa" }, - ["gitsigns.lua"] = "f423758eba3dfcca59f5a0710b58463f" + ["gitsigns.lua"] = "48654d8ca2059edb2b3a0bdd09f871e1" } } diff --git a/config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-23-rocks/manifest b/config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-28-rocks/manifest similarity index 100% rename from config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-23-rocks/manifest rename to config/neovim/store/lazy-plugins/gitsigns.nvim/gitsigns.nvim-scm-1-unstable-2024-05-28-rocks/manifest diff --git a/config/neovim/store/lazy-plugins/gitsigns.nvim/lua/gitsigns.lua b/config/neovim/store/lazy-plugins/gitsigns.nvim/lua/gitsigns.lua index 9823593f..3573b42d 100644 --- a/config/neovim/store/lazy-plugins/gitsigns.nvim/lua/gitsigns.lua +++ b/config/neovim/store/lazy-plugins/gitsigns.nvim/lua/gitsigns.lua @@ -12,10 +12,31 @@ local M = {} local cwd_watcher ---@type uv.uv_fs_event_t? --- @async -local function update_cwd_head() - if not uv.cwd() then +--- @return string gitdir +--- @return string head +local function get_gitdir_and_head() + local cwd = assert(uv.cwd()) + + -- Look in the cache first + for _, bcache in pairs(require('gitsigns.cache').cache) do + local repo = bcache.git_obj.repo + if repo.toplevel == cwd then + return repo.gitdir, repo.abbrev_head + end + end + + local info = require('gitsigns.git').get_repo_info(cwd) + + return info.gitdir, info.abbrev_head +end + +local update_cwd_head = async.create(function() + local cwd = uv.cwd() + + if not cwd then return end + local paths = vim.fs.find('.git', { limit = 1, upward = true, @@ -26,36 +47,7 @@ local function update_cwd_head() return end - if cwd_watcher then - cwd_watcher:stop() - else - cwd_watcher = assert(uv.new_fs_event()) - end - - local cwd = assert(uv.cwd()) - --- @type string, string - local gitdir, head - - local gs_cache = require('gitsigns.cache') - - -- Look in the cache first - for _, bcache in pairs(gs_cache.cache) do - local repo = bcache.git_obj.repo - if repo.toplevel == cwd then - head = repo.abbrev_head - gitdir = repo.gitdir - break - end - end - - local git = require('gitsigns.git') - - if not head or not gitdir then - local info = git.get_repo_info(cwd) - gitdir = info.gitdir - head = info.abbrev_head - end - + local gitdir, head = get_gitdir_and_head() async.scheduler() api.nvim_exec_autocmds('User', { @@ -71,6 +63,12 @@ local function update_cwd_head() local towatch = gitdir .. '/HEAD' + if cwd_watcher then + cwd_watcher:stop() + else + cwd_watcher = assert(uv.new_fs_event()) + end + if cwd_watcher:getpath() == towatch then -- Already watching return @@ -81,6 +79,7 @@ local function update_cwd_head() local update_head = debounce_trailing( 100, async.create(function() + local git = require('gitsigns.git') local new_head = git.get_repo_info(cwd).abbrev_head async.scheduler() vim.g.gitsigns_head = new_head @@ -102,7 +101,7 @@ local function update_cwd_head() update_head() end) ) -end +end) local function setup_cli() api.nvim_create_user_command('Gitsigns', function(params) @@ -128,8 +127,6 @@ local function setup_attach() return end - async.scheduler() - local attach_autocmd_disabled = false api.nvim_create_autocmd({ 'BufRead', 'BufNewFile', 'BufWritePost' }, { @@ -165,13 +162,11 @@ local function setup_attach() end end ---- @async local function setup_cwd_head() - async.scheduler() - update_cwd_head() - local debounce = require('gitsigns.debounce').debounce_trailing - local update_cwd_head_debounced = debounce(100, async.create(update_cwd_head)) + local update_cwd_head_debounced = debounce(100, update_cwd_head) + + update_cwd_head_debounced() -- Need to debounce in case some plugin changes the cwd too often -- (like vim-grepper) @@ -185,12 +180,9 @@ end --- Setup and start Gitsigns. --- ---- Attributes: ~ ---- {async} ---- --- @param cfg table|nil Configuration for Gitsigns. --- See |gitsigns-usage| for more details. -M.setup = async.create(1, function(cfg) +function M.setup(cfg) gs_config.build(cfg) if vim.fn.executable('git') == 0 then @@ -200,16 +192,12 @@ M.setup = async.create(1, function(cfg) api.nvim_create_augroup('gitsigns', {}) - if vim.fn.has('nvim-0.9') == 0 then - require('gitsigns.git.version').check() - end - setup_debug() setup_cli() require('gitsigns.highlight').setup() setup_attach() setup_cwd_head() -end) +end return setmetatable(M, { __index = function(_, f) diff --git a/config/neovim/store/lazy-plugins/gitsigns.nvim/lua/gitsigns/git.lua b/config/neovim/store/lazy-plugins/gitsigns.nvim/lua/gitsigns/git.lua index d506132e..34687d18 100644 --- a/config/neovim/store/lazy-plugins/gitsigns.nvim/lua/gitsigns/git.lua +++ b/config/neovim/store/lazy-plugins/gitsigns.nvim/lua/gitsigns/git.lua @@ -518,7 +518,12 @@ function Obj:file_info_tree(file, silent) return {} end - local info, relpath = unpack(vim.split(results[1], '\t')) + local info_line = results[1] + if not info_line then + return {} + end + + local info, relpath = unpack(vim.split(info_line, '\t')) local mode_bits, objtype, object_name = unpack(vim.split(info, '%s+')) assert(objtype == 'blob') diff --git a/config/neovim/store/lazy-plugins/gitsigns.nvim/lua/gitsigns/git/version.lua b/config/neovim/store/lazy-plugins/gitsigns.nvim/lua/gitsigns/git/version.lua index fedcc954..92f9c8ba 100644 --- a/config/neovim/store/lazy-plugins/gitsigns.nvim/lua/gitsigns/git/version.lua +++ b/config/neovim/store/lazy-plugins/gitsigns.nvim/lua/gitsigns/git/version.lua @@ -34,6 +34,7 @@ local function parse_version(version) return ret end +--- @async local function set_version() local version = gs_config.config._git_version if version ~= 'auto' then @@ -70,6 +71,7 @@ local function set_version() M.version = parse_version(parts[3]) end +--- @async --- Usage: check_version{2,3} --- @param version {[1]: integer, [2]:integer, [3]:integer}? --- @return boolean diff --git a/config/neovim/store/lazy-plugins/gitsigns.nvim/rock_manifest b/config/neovim/store/lazy-plugins/gitsigns.nvim/rock_manifest index 694461c3..5fa19114 100644 --- a/config/neovim/store/lazy-plugins/gitsigns.nvim/rock_manifest +++ b/config/neovim/store/lazy-plugins/gitsigns.nvim/rock_manifest @@ -1,6 +1,6 @@ rock_manifest = { doc = { - ["gitsigns.txt"] = "b9579713a56199f1374b4e1b12578f42" + ["gitsigns.txt"] = "a329a90ab3b49a53ea44d986cbde6885" }, ["gitsigns.nvim-scm-1.rockspec"] = "a9b165d604ce401cfeea760a9366418d", lua = { @@ -25,9 +25,9 @@ rock_manifest = { ["diff_int.lua"] = "df447e56f11906998e81d5b94499e013", ["diffthis.lua"] = "eb4ff5d430d2c4081f1fa9651d2768f7", git = { - ["version.lua"] = "ab78b8d8a84dd92655e4847223362923" + ["version.lua"] = "068a582ed4565978eb1f6eb089a6fa6c" }, - ["git.lua"] = "082cec98968b0eca1f97f54cbd4ad880", + ["git.lua"] = "89ec79605c259e73ce8c19deb5b63194", ["highlight.lua"] = "1d197d8f0f6f69a6455ac220a6890d80", ["hunks.lua"] = "48fc2d8a9c89815e3c0521b1bb0788e9", ["manager.lua"] = "af94331f013ed04d175e3c2b2d21c42b", @@ -44,6 +44,6 @@ rock_manifest = { ["util.lua"] = "e4c4d677e3ad296adee833318a5c5845", ["watcher.lua"] = "ffcf36424ae17548bdc629cc2de3fcaa" }, - ["gitsigns.lua"] = "f423758eba3dfcca59f5a0710b58463f" + ["gitsigns.lua"] = "48654d8ca2059edb2b3a0bdd09f871e1" } } diff --git a/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/lua/plug_2.lua b/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/lua/plug_2.lua deleted file mode 100644 index c886720a..00000000 --- a/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/lua/plug_2.lua +++ /dev/null @@ -1 +0,0 @@ -return { 'plugin_2/lua/plug_2.lua' } diff --git a/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/plugin/plug_2.lua b/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/plugin/plug_2.lua deleted file mode 100644 index 4deb1555..00000000 --- a/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/plugin/plug_2.lua +++ /dev/null @@ -1,2 +0,0 @@ -_G.plugin_log = _G.plugin_log or {} -table.insert(_G.plugin_log, 'plugin/plug_2.lua') diff --git a/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/3.1.8-1/doc/haskell-tools.txt b/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-26-rocks/haskell-tools.nvim/3.1.8-1/doc/haskell-tools.txt similarity index 100% rename from config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/3.1.8-1/doc/haskell-tools.txt rename to config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-26-rocks/haskell-tools.nvim/3.1.8-1/doc/haskell-tools.txt diff --git a/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/3.1.8-1/ftplugin/cabal.lua b/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-26-rocks/haskell-tools.nvim/3.1.8-1/ftplugin/cabal.lua similarity index 100% rename from config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/3.1.8-1/ftplugin/cabal.lua rename to config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-26-rocks/haskell-tools.nvim/3.1.8-1/ftplugin/cabal.lua diff --git a/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/3.1.8-1/ftplugin/cabalproject.lua b/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-26-rocks/haskell-tools.nvim/3.1.8-1/ftplugin/cabalproject.lua similarity index 100% rename from config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/3.1.8-1/ftplugin/cabalproject.lua rename to config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-26-rocks/haskell-tools.nvim/3.1.8-1/ftplugin/cabalproject.lua diff --git a/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/3.1.8-1/ftplugin/haskell.lua b/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-26-rocks/haskell-tools.nvim/3.1.8-1/ftplugin/haskell.lua similarity index 100% rename from config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/3.1.8-1/ftplugin/haskell.lua rename to config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-26-rocks/haskell-tools.nvim/3.1.8-1/ftplugin/haskell.lua diff --git a/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/3.1.8-1/ftplugin/lhaskell.lua b/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-26-rocks/haskell-tools.nvim/3.1.8-1/ftplugin/lhaskell.lua similarity index 100% rename from config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/3.1.8-1/ftplugin/lhaskell.lua rename to config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-26-rocks/haskell-tools.nvim/3.1.8-1/ftplugin/lhaskell.lua diff --git a/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/3.1.8-1/haskell-tools.nvim-3.1.8-1.rockspec b/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-26-rocks/haskell-tools.nvim/3.1.8-1/haskell-tools.nvim-3.1.8-1.rockspec similarity index 100% rename from config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/3.1.8-1/haskell-tools.nvim-3.1.8-1.rockspec rename to config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-26-rocks/haskell-tools.nvim/3.1.8-1/haskell-tools.nvim-3.1.8-1.rockspec diff --git a/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/3.1.8-1/rock_manifest b/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-26-rocks/haskell-tools.nvim/3.1.8-1/rock_manifest similarity index 100% rename from config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/haskell-tools.nvim/3.1.8-1/rock_manifest rename to config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-26-rocks/haskell-tools.nvim/3.1.8-1/rock_manifest diff --git a/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/manifest b/config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-26-rocks/manifest similarity index 100% rename from config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-20-rocks/manifest rename to config/neovim/store/lazy-plugins/haskell-tools.nvim/haskell-tools.nvim-3.1.8-1-unstable-2024-05-26-rocks/manifest diff --git a/config/neovim/store/lazy-plugins/lualine.nvim/doc/tags b/config/neovim/store/lazy-plugins/lualine.nvim/doc/tags new file mode 100644 index 00000000..e872e64d --- /dev/null +++ b/config/neovim/store/lazy-plugins/lualine.nvim/doc/tags @@ -0,0 +1,30 @@ +lualine-Available-components lualine.txt /*lualine-Available-components* +lualine-Available-extensions lualine.txt /*lualine-Available-extensions* +lualine-Available-options lualine.txt /*lualine-Available-options* +lualine-Buffers lualine.txt /*lualine-Buffers* +lualine-Component-specific-options lualine.txt /*lualine-Component-specific-options* +lualine-Custom-components lualine.txt /*lualine-Custom-components* +lualine-Custom-extensions lualine.txt /*lualine-Custom-extensions* +lualine-Customizing-themes lualine.txt /*lualine-Customizing-themes* +lualine-Default-configuration lualine.txt /*lualine-Default-configuration* +lualine-Disabling-separators lualine.txt /*lualine-Disabling-separators* +lualine-General-component-options lualine.txt /*lualine-General-component-options* +lualine-Global-options lualine.txt /*lualine-Global-options* +lualine-Tabline-as-statusline lualine.txt /*lualine-Tabline-as-statusline* +lualine-Tabs lualine.txt /*lualine-Tabs* +lualine-buffers-component-options lualine.txt /*lualine-buffers-component-options* +lualine-contributing lualine.txt /*lualine-contributing* +lualine-datetime-component-options lualine.txt /*lualine-datetime-component-options* +lualine-diagnostics-component-options lualine.txt /*lualine-diagnostics-component-options* +lualine-diff-component-options lualine.txt /*lualine-diff-component-options* +lualine-fileformat-component-options lualine.txt /*lualine-fileformat-component-options* +lualine-filename-component-options lualine.txt /*lualine-filename-component-options* +lualine-filetype-component-options lualine.txt /*lualine-filetype-component-options* +lualine-installation lualine.txt /*lualine-installation* +lualine-lualine.nvim lualine.txt /*lualine-lualine.nvim* +lualine-searchcount-component-options lualine.txt /*lualine-searchcount-component-options* +lualine-table-of-contents lualine.txt /*lualine-table-of-contents* +lualine-tabs-component-options lualine.txt /*lualine-tabs-component-options* +lualine-usage-and-customization lualine.txt /*lualine-usage-and-customization* +lualine-windows-component-options lualine.txt /*lualine-windows-component-options* +lualine.txt lualine.txt /*lualine.txt* diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/.codecov.yml b/config/neovim/store/lazy-plugins/neo-tree.nvim/.codecov.yml new file mode 100644 index 00000000..7c4fa592 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/.codecov.yml @@ -0,0 +1,10 @@ +coverage: + status: + project: + default: + informational: true + only_pulls: true + patch: + default: + informational: true + only_pulls: true diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/.github/ISSUE_TEMPLATE/bug_report.yml b/config/neovim/store/lazy-plugins/neo-tree.nvim/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..510fba3a --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,109 @@ +name: Bug Report +description: File a bug / issue. +title: "BUG: " +labels: [bug] +body: + - type: markdown + attributes: + value: | + **Before** reporting an issue, make sure to read [`:h neo-tree.txt`](https://github.com/nvim-neo-tree/neo-tree.nvim/blob/v2.x/doc/neo-tree.txt) and search [existing issues](https://github.com/nvim-neo-tree/neo-tree.nvim/issues). Usage questions such as ***"How do I...?"*** belong in [Discussions](https://github.com/nvim-neo-tree/neo-tree.nvim/discussions) and will be closed. + - type: checkboxes + attributes: + label: Did you check docs and existing issues? + description: Make sure you checked all of the below before submitting an issue + options: + - label: I have read all the docs. + required: true + - label: I have searched the existing issues. + required: true + - label: I have searched the existing discussions. + required: true + - type: input + attributes: + label: "Neovim Version (nvim -v)" + placeholder: "0.8.0 commit db1b0ee3b30f" + validations: + required: true + - type: input + attributes: + label: "Operating System / Version" + placeholder: "MacOS 11.5" + validations: + required: true + - type: textarea + attributes: + label: Describe the Bug + description: A clear and concise description of what the bug is. Please include any related errors you see in Neovim. + validations: + required: true + - type: textarea + attributes: + label: Screenshots, Traceback + description: Screenshot and traceback if exists. Not required. + validations: + required: false + - type: textarea + attributes: + label: Steps to Reproduce + description: Steps to reproduce the behavior. Describe with the exact commands and keypresses. + placeholder: | + 1. + 2. + 3. + validations: + required: true + - type: textarea + attributes: + label: Expected Behavior + description: A concise description of what you expected to happen. + validations: + required: true + - type: textarea + attributes: + label: Your Configuration + description: Minimal `init.lua` to reproduce this issue. Save as `repro.lua` and run with `nvim -u repro.lua` + value: | + -- DO NOT change the paths and don't remove the colorscheme + local root = vim.fn.fnamemodify("./.repro", ":p") + + -- set stdpaths to use .repro + for _, name in ipairs({ "config", "data", "state", "cache" }) do + vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name + end + + -- bootstrap lazy + local lazypath = root .. "/plugins/lazy.nvim" + if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, }) + end + vim.opt.runtimepath:prepend(lazypath) + + -- install plugins + local plugins = { + "folke/tokyonight.nvim", + -- add any other plugins here + } + + local neotree_config = { + "nvim-neo-tree/neo-tree.nvim", + dependencies = { "MunifTanjim/nui.nvim", "nvim-tree/nvim-web-devicons", "nvim-lua/plenary.nvim" }, + cmd = { "Neotree" }, + keys = { + { "e", "Neotree" }, -- change or remove this line if relevant. + }, + opts = { + -- Your config here + -- ... + }, + } + + table.insert(plugins, neotree_config) + require("lazy").setup(plugins, { + root = root .. "/plugins", + }) + + vim.cmd.colorscheme("tokyonight") + -- add anything else here + render: Lua + validations: + required: true diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/.github/ISSUE_TEMPLATE/feature_request.yml b/config/neovim/store/lazy-plugins/neo-tree.nvim/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 00000000..47ea5046 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,36 @@ +name: Feature Request +description: Suggest a new feature. +title: "FEATURE: " +labels: [enhancement] +body: + - type: checkboxes + attributes: + label: Did you check the docs? + description: Make sure you read all the docs before submitting a feature request. + options: + - label: I have read all the docs. + required: true + - type: textarea + validations: + required: true + attributes: + label: Is your feature request related to a problem? Please describe. + description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + - type: textarea + validations: + required: true + attributes: + label: Describe the solution you'd like. + description: A clear and concise description of what you want to happen. + - type: textarea + validations: + required: false + attributes: + label: Describe alternatives you've considered. + description: A clear and concise description of any alternative solutions or features you've considered. + - type: textarea + validations: + required: false + attributes: + label: Additional Context + description: Add any other context or screenshots about the feature request here. diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/.github/workflows/ci.yml b/config/neovim/store/lazy-plugins/neo-tree.nvim/.github/workflows/ci.yml new file mode 100644 index 00000000..c67cb4d0 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/.github/workflows/ci.yml @@ -0,0 +1,73 @@ +name: CI +on: + push: + branches: + - main + - v1.x + - v2.x + - v3.x + pull_request: + +jobs: + stylua-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + + - name: Check formatting + uses: JohnnyMorganz/stylua-action@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: v0.16.0 + args: --color always --check -g '!**/defaults.lua' lua/ + + plenary-tests: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - run: date +%F > todays-date + - name: Restore cache for today's nightly. + uses: actions/cache@v2 + with: + path: build + key: ${{ runner.os }}-appimage-${{ hashFiles('todays-date') }} + + - name: Prepare + run: | + test -d build || { + mkdir -p build + wget https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage + chmod +x nvim.appimage + mv nvim.appimage ./build/nvim + } + + # - name: Get Luver Cache Key + # id: luver-cache-key + # env: + # CI_RUNNER_OS: ${{ runner.os }} + # run: | + # echo "::set-output name=value::${CI_RUNNER_OS}-luver-v1-$(date -u +%Y-%m-%d)" + # shell: bash + # - name: Setup Luver Cache + # uses: actions/cache@v2 + # with: + # path: ~/.local/share/luver + # key: ${{ steps.luver-cache-key.outputs.value }} + + # - name: Setup Lua + # uses: MunifTanjim/luver-action@v1 + # with: + # default: 5.1.5 + # lua_versions: 5.1.5 + # luarocks_versions: 5.1.5:3.8.0 + # - name: Setup luacov + # run: | + # luarocks install luacov + + - name: Run tests + run: | + export PATH="${PWD}/build/:${PATH}" + ./scripts/test.sh + + # - name: Upload coverage to Codecov + # uses: codecov/codecov-action@v2 diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/.github/workflows/luarocks.yml b/config/neovim/store/lazy-plugins/neo-tree.nvim/.github/workflows/luarocks.yml new file mode 100644 index 00000000..5cf48a8f --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/.github/workflows/luarocks.yml @@ -0,0 +1,29 @@ +--- +name: Push to Luarocks + +on: + push: + tags: + - '*' + workflow_dispatch: + pull_request: # Will test the luarocks installation on PR, without uploading + +jobs: + luarocks-upload: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Required to count the commits + - name: Get Version + run: echo "LUAROCKS_VERSION=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV + - name: LuaRocks Upload + uses: nvim-neorocks/luarocks-tag-release@v5 + env: + LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} + with: + version: ${{ env.LUAROCKS_VERSION }} + dependencies: | + plenary.nvim + nvim-web-devicons + nui.nvim diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/.github/workflows/protect_release_branches.yml b/config/neovim/store/lazy-plugins/neo-tree.nvim/.github/workflows/protect_release_branches.yml new file mode 100644 index 00000000..8613a714 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/.github/workflows/protect_release_branches.yml @@ -0,0 +1,29 @@ +# This is a basic workflow to help you get started with Actions + +name: No PRs to Release Branches + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the v1.x branch + pull_request: + types: [opened, edited, ready_for_review] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + check_target: + # The type of runner that the job will run on + runs-on: ubuntu-latest + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Runs a single command using the runners shell + - name: Fail when targeting v2 + run: | + target=${{ github.base_ref }} + echo "Target is: $target" + if [[ $target == "v2.x" ]]; then + echo "PRs must target main" + exit 1 + else + exit 0 + fi diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/.gitignore b/config/neovim/store/lazy-plugins/neo-tree.nvim/.gitignore new file mode 100644 index 00000000..6bfe3810 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/.gitignore @@ -0,0 +1,47 @@ +# Compiled Lua sources +luac.out + +# luarocks build files +*.src.rock +*.zip +*.tar.gz + +# Object files +*.o +*.os +*.ko +*.obj +*.elf + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo +*.def +*.exp + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Vim tag files +tags + +# Others +.testcache +luacov.*.out diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/.luacov b/config/neovim/store/lazy-plugins/neo-tree.nvim/.luacov new file mode 100644 index 00000000..400ec013 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/.luacov @@ -0,0 +1,3 @@ +include = { + "lua%/neo%-tree", +} diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/.luarc.json b/config/neovim/store/lazy-plugins/neo-tree.nvim/.luarc.json new file mode 100644 index 00000000..c2d33c20 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/.luarc.json @@ -0,0 +1,3 @@ +{ + "diagnostics.globals": ["vim"] +} diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/.stylua.toml b/config/neovim/store/lazy-plugins/neo-tree.nvim/.stylua.toml new file mode 100644 index 00000000..609d7739 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/.stylua.toml @@ -0,0 +1,5 @@ +column_width = 100 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/.styluaignore b/config/neovim/store/lazy-plugins/neo-tree.nvim/.styluaignore new file mode 100644 index 00000000..42ee1635 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/.styluaignore @@ -0,0 +1 @@ +**/defaults.lua diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/CONTRIBUTING.md b/config/neovim/store/lazy-plugins/neo-tree.nvim/CONTRIBUTING.md new file mode 100644 index 00000000..5c043c7a --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/CONTRIBUTING.md @@ -0,0 +1,62 @@ +# Contributing to Neo-tree + +Contributions are welcome! To keep everything clean and tidy, please follow the +guidelines below. + +## Code Style + +This is open for debate, but here is the current style choices being observed: + +- snake_case for all variables and functions +- unless it is a class, then use PascalCase +- other OOP things, like method names should use camelCase +- BUT we don't currently have any OOP parts and I don't think we want any + +I prefer `local name = function()` over `local function name()`, just to be +consistent with the `M.name = function()` exports. + +### StyLua + +We use (StyLua)[https://github.com/JohnnyMorganz/StyLua] to enforce consistency +in code. You should install it on your local machine. PRs will be checked with +this tool. + +## Commit Messages + +We use **semantic**, aka **conventional** commit messages. The official guide +can be found here: https://www.conventionalcommits.org/en/v1.0.0/ + +You can also just take a look at the commit history to get the idea. The +optional scope for this project would usually be the source, i.e. +`feat(filesystem): add awesome feature that does xyz`. + +## Branching + +The default branch is set to `main` and all Pull Requests should target this +branch. After a short testing period, it will be merged to the current release +branch. + +This project requires a **linear history**. I don't trust merge commits. +This means you will have to rebase your branch on main before the pull request +can be merged. This can get a bit annoying in a busy repository, but I think it +is worth the effort. + +## Documentation + +All new features should be documented in the commit they were added in. The +current strategy is to maintain: + +- Config Options: added to [defaults](lua/neo-tree/defaults.lua) and described + in comments. This is the bare minimum documentation for an option. +- The README contains "back of the box" high level overview of features. It is + meant for people trying to decide if they want to install this plugin or not. + It should include references to the help file for more information: + `:h neo-tree-setup` +- Whether something should be mentioned in the README or just in the help file + is a completely subjective judement call that is made on a case by case basis + based on how many people are likely to be interested in that information. +- The vim help file [doc/neo-tree.txt](doc/neo-tree.txt) is the definitive + reference and should contain all information needed to configure and use the + plugin. +- OUR DOCUMENTATION IS NOT GOOD ENOUGH! Consider the current level of documentation + the bare minumum and not the ideal. More documentation would be greatly appreciated. diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/Dockerfile b/config/neovim/store/lazy-plugins/neo-tree.nvim/Dockerfile new file mode 100644 index 00000000..9ac4c08f --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/Dockerfile @@ -0,0 +1,19 @@ +FROM ubuntu:22.04 + +RUN apt update +# install neovim dependencies +RUN apt install -y git ninja-build gettext libtool libtool-bin autoconf \ + automake cmake g++ pkg-config unzip curl doxygen + +# install neovim +RUN git clone https://github.com/neovim/neovim +RUN cd neovim && make CMAKE_BUILD_TYPE=RelWithDebInfo && make install + +# install required plugins +ARG PLUG_DIR="root/.local/share/nvim/site/pack/packer/start" +RUN git clone https://github.com/nvim-lua/plenary.nvim $PLUG_DIR/plenary.nvim +RUN git clone https://github.com/MunifTanjim/nui.nvim $PLUG_DIR/nui.nvim +RUN git clone https://github.com/nvim-tree/nvim-web-devicons.git $PLUG_DIR/nvim-web-devicons +COPY . $PLUG_DIR/neo-tree.nvim + +WORKDIR $PLUG_DIR/neo-tree.nvim diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/LICENSE b/config/neovim/store/lazy-plugins/neo-tree.nvim/LICENSE new file mode 100644 index 00000000..74eaaf88 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2021 cseickel (https://github.com/cseickel) and nvim-neo-tree +maintainers. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/Makefile b/config/neovim/store/lazy-plugins/neo-tree.nvim/Makefile new file mode 100644 index 00000000..58d92916 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/Makefile @@ -0,0 +1,12 @@ +.PHONY: test +test: + nvim --headless --noplugin -u tests/mininit.lua -c "lua require('plenary.test_harness').test_directory('tests/neo-tree/', {minimal_init='tests/mininit.lua',sequential=true})" + +.PHONY: test-docker +test-docker: + docker build -t neo-tree . + docker run --rm neo-tree make test + +.PHONY: format +format: + stylua --glob '*.lua' --glob '!defaults.lua' . diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/README.md b/config/neovim/store/lazy-plugins/neo-tree.nvim/README.md new file mode 100644 index 00000000..d93515a8 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/README.md @@ -0,0 +1,856 @@ +# Neo-tree.nvim + +Neo-tree is a Neovim plugin to browse the file system and other tree like +structures in whatever style suits you, including sidebars, floating windows, +netrw split style, or all of them at once! + +### Neo-tree filesystem as Sidebar: + +This screenshot shows Neo-tree opened in the traditional sidebar layout: + +![Neo-tree file system sidebar](https://github.com/nvim-neo-tree/resources/blob/main/images/Neo-tree-with-right-aligned-symbols.png) + +### Neo-tree filesystem Netrw Style + +The below screenshot shows Neo-tree opened "netrw style" (`:Neotree position=current`). When opened in this way, +there is more room so the extra detail columns can be shown. This screenshot also shows how the contents can be +sorted on any column. In this example, we are sorted on "Size" descending: + +![Neo-tree file system +details](https://github.com/nvim-neo-tree/resources/blob/main/images/Neo-tree-with-file-details-and-sort.png) + +### Breaking Changes BAD :bomb: :imp: + +The biggest and most important feature of Neo-tree is that we will never +knowingly push a breaking change and interrupt your day. Bugs happen, but +breaking changes can always be avoided. When breaking changes are needed, there +will be a new branch that you can opt into, when it is a good time for you. + +See [What is a Breaking Change?](#what-is-a-breaking-change) for details. + +See [Changelog 3.0](https://github.com/nvim-neo-tree/neo-tree.nvim/wiki/Changelog#30) +for breaking changes and deprecations in 3.0. + + +### User Experience GOOD :slightly_smiling_face: :thumbsup: + +Aside from being polite about breaking changes, Neo-tree is also focused on the +little details of user experience. Everything should work exactly as you would +expect a sidebar to work without all of the glitchy behavior that is normally +accepted in (neo)vim sidebars. I can't stand glitchy behavior, and neither +should you! + +- Neo-tree won't let other buffers take over its window. +- Neo-tree won't leave its window scrolled to the last line when there is + plenty of room to display the whole tree. +- Neo-tree does not need to be manually refreshed (set `use_libuv_file_watcher=true`) +- Neo-tree can intelligently follow the current file (set `follow_current_file.enabled=true`) +- Neo-tree is thoughtful about maintaining or setting focus on the right node +- Neo-tree windows in different tabs are completely separate +- `respect_gitignore` actually works! + +Neo-tree is smooth, efficient, stable, and pays attention to the little details. +If you find anything janky, wanky, broken, or unintuitive, please open an issue +so we can fix it. + + +## Minimal Quickstart + +#### Minimal Example for Lazy: +```lua +{ + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information + } +} +``` + +#### Minimal Example for Packer: +```lua +use { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + requires = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information + } + } +``` + +After installing, run: +``` +:Neotree +``` + +Press `?` in the Neo-tree window to view the list of mappings. + + +## Quickstart + +#### Longer Example for Packer: + +```lua +use { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + requires = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information + { + 's1n7ax/nvim-window-picker', + version = '2.*', + config = function() + require 'window-picker'.setup({ + filter_rules = { + include_current_win = false, + autoselect_one = true, + -- filter using buffer options + bo = { + -- if the file type is one of following, the window will be ignored + filetype = { 'neo-tree', "neo-tree-popup", "notify" }, + -- if the buffer type is one of following, the window will be ignored + buftype = { 'terminal', "quickfix" }, + }, + }, + }) + end, + }, + }, + config = function () + -- If you want icons for diagnostic errors, you'll need to define them somewhere: + vim.fn.sign_define("DiagnosticSignError", + {text = " ", texthl = "DiagnosticSignError"}) + vim.fn.sign_define("DiagnosticSignWarn", + {text = " ", texthl = "DiagnosticSignWarn"}) + vim.fn.sign_define("DiagnosticSignInfo", + {text = " ", texthl = "DiagnosticSignInfo"}) + vim.fn.sign_define("DiagnosticSignHint", + {text = "󰌵", texthl = "DiagnosticSignHint"}) + + require("neo-tree").setup({ + close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab + popup_border_style = "rounded", + enable_git_status = true, + enable_diagnostics = true, + open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes + sort_case_insensitive = false, -- used when sorting files and directories in the tree + sort_function = nil , -- use a custom function for sorting files and directories in the tree + -- sort_function = function (a,b) + -- if a.type == b.type then + -- return a.path > b.path + -- else + -- return a.type > b.type + -- end + -- end , -- this sorts files and directories descendantly + default_component_configs = { + container = { + enable_character_fade = true + }, + indent = { + indent_size = 2, + padding = 1, -- extra padding on left hand side + -- indent guides + with_markers = true, + indent_marker = "│", + last_indent_marker = "└", + highlight = "NeoTreeIndentMarker", + -- expander config, needed for nesting files + with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders + expander_collapsed = "", + expander_expanded = "", + expander_highlight = "NeoTreeExpander", + }, + icon = { + folder_closed = "", + folder_open = "", + folder_empty = "󰜌", + -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there + -- then these will never be used. + default = "*", + highlight = "NeoTreeFileIcon" + }, + modified = { + symbol = "[+]", + highlight = "NeoTreeModified", + }, + name = { + trailing_slash = false, + use_git_status_colors = true, + highlight = "NeoTreeFileName", + }, + git_status = { + symbols = { + -- Change type + added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name + modified = "", -- or "", but this is redundant info if you use git_status_colors on the name + deleted = "✖",-- this can only be used in the git_status source + renamed = "󰁕",-- this can only be used in the git_status source + -- Status type + untracked = "", + ignored = "", + unstaged = "󰄱", + staged = "", + conflict = "", + } + }, + -- If you don't want to use these columns, you can set `enabled = false` for each of them individually + file_size = { + enabled = true, + required_width = 64, -- min width of window required to show this column + }, + type = { + enabled = true, + required_width = 122, -- min width of window required to show this column + }, + last_modified = { + enabled = true, + required_width = 88, -- min width of window required to show this column + }, + created = { + enabled = true, + required_width = 110, -- min width of window required to show this column + }, + symlink_target = { + enabled = false, + }, + }, + -- A list of functions, each representing a global custom command + -- that will be available in all sources (if not overridden in `opts[source_name].commands`) + -- see `:h neo-tree-custom-commands-global` + commands = {}, + window = { + position = "left", + width = 40, + mapping_options = { + noremap = true, + nowait = true, + }, + mappings = { + [""] = { + "toggle_node", + nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use + }, + ["<2-LeftMouse>"] = "open", + [""] = "open", + [""] = "cancel", -- close preview or floating neo-tree window + ["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } }, + -- Read `# Preview Mode` for more information + ["l"] = "focus_preview", + ["S"] = "open_split", + ["s"] = "open_vsplit", + -- ["S"] = "split_with_window_picker", + -- ["s"] = "vsplit_with_window_picker", + ["t"] = "open_tabnew", + -- [""] = "open_drop", + -- ["t"] = "open_tab_drop", + ["w"] = "open_with_window_picker", + --["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing + ["C"] = "close_node", + -- ['C'] = 'close_all_subnodes', + ["z"] = "close_all_nodes", + --["Z"] = "expand_all_nodes", + ["a"] = { + "add", + -- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details + -- some commands may take optional config options, see `:h neo-tree-mappings` for details + config = { + show_path = "none" -- "none", "relative", "absolute" + } + }, + ["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion. + ["d"] = "delete", + ["r"] = "rename", + ["y"] = "copy_to_clipboard", + ["x"] = "cut_to_clipboard", + ["p"] = "paste_from_clipboard", + ["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add": + -- ["c"] = { + -- "copy", + -- config = { + -- show_path = "none" -- "none", "relative", "absolute" + -- } + --} + ["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add". + ["q"] = "close_window", + ["R"] = "refresh", + ["?"] = "show_help", + ["<"] = "prev_source", + [">"] = "next_source", + ["i"] = "show_file_details", + } + }, + nesting_rules = {}, + filesystem = { + filtered_items = { + visible = false, -- when true, they will just be displayed differently than normal items + hide_dotfiles = true, + hide_gitignored = true, + hide_hidden = true, -- only works on Windows for hidden files/directories + hide_by_name = { + --"node_modules" + }, + hide_by_pattern = { -- uses glob style patterns + --"*.meta", + --"*/src/*/tsconfig.json", + }, + always_show = { -- remains visible even if other settings would normally hide it + --".gitignored", + }, + never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show + --".DS_Store", + --"thumbs.db" + }, + never_show_by_pattern = { -- uses glob style patterns + --".null-ls_*", + }, + }, + follow_current_file = { + enabled = false, -- This will find and focus the file in the active buffer every time + -- -- the current file is changed while the tree is open. + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + }, + group_empty_dirs = false, -- when true, empty folders will be grouped together + hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree + -- in whatever position is specified in window.position + -- "open_current", -- netrw disabled, opening a directory opens within the + -- window like netrw would, regardless of window.position + -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs + use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes + -- instead of relying on nvim autocmd events. + window = { + mappings = { + [""] = "navigate_up", + ["."] = "set_root", + ["H"] = "toggle_hidden", + ["/"] = "fuzzy_finder", + ["D"] = "fuzzy_finder_directory", + ["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm + -- ["D"] = "fuzzy_sorter_directory", + ["f"] = "filter_on_submit", + [""] = "clear_filter", + ["[g"] = "prev_git_modified", + ["]g"] = "next_git_modified", + ["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }}, + ["oc"] = { "order_by_created", nowait = false }, + ["od"] = { "order_by_diagnostics", nowait = false }, + ["og"] = { "order_by_git_status", nowait = false }, + ["om"] = { "order_by_modified", nowait = false }, + ["on"] = { "order_by_name", nowait = false }, + ["os"] = { "order_by_size", nowait = false }, + ["ot"] = { "order_by_type", nowait = false }, + -- [''] = function(state) ... end, + }, + fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode + [""] = "move_cursor_down", + [""] = "move_cursor_down", + [""] = "move_cursor_up", + [""] = "move_cursor_up", + -- [''] = function(state, scroll_padding) ... end, + }, + }, + + commands = {} -- Add a custom command or override a global one using the same function name + }, + buffers = { + follow_current_file = { + enabled = true, -- This will find and focus the file in the active buffer every time + -- -- the current file is changed while the tree is open. + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + }, + group_empty_dirs = true, -- when true, empty folders will be grouped together + show_unloaded = true, + window = { + mappings = { + ["bd"] = "buffer_delete", + [""] = "navigate_up", + ["."] = "set_root", + ["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }}, + ["oc"] = { "order_by_created", nowait = false }, + ["od"] = { "order_by_diagnostics", nowait = false }, + ["om"] = { "order_by_modified", nowait = false }, + ["on"] = { "order_by_name", nowait = false }, + ["os"] = { "order_by_size", nowait = false }, + ["ot"] = { "order_by_type", nowait = false }, + } + }, + }, + git_status = { + window = { + position = "float", + mappings = { + ["A"] = "git_add_all", + ["gu"] = "git_unstage_file", + ["ga"] = "git_add_file", + ["gr"] = "git_revert_file", + ["gc"] = "git_commit", + ["gp"] = "git_push", + ["gg"] = "git_commit_and_push", + ["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }}, + ["oc"] = { "order_by_created", nowait = false }, + ["od"] = { "order_by_diagnostics", nowait = false }, + ["om"] = { "order_by_modified", nowait = false }, + ["on"] = { "order_by_name", nowait = false }, + ["os"] = { "order_by_size", nowait = false }, + ["ot"] = { "order_by_type", nowait = false }, + } + } + } + }) + + vim.cmd([[nnoremap \ :Neotree reveal]]) + end +} +``` + +_The above configuration is not everything that can be changed, it's just the +parts you might want to change first._ + + +See `:h neo-tree` for full documentation. You can also preview that online at +[doc/neo-tree.txt](doc/neo-tree.txt), although it's best viewed within vim. + + +To see all of the default config options with commentary, you can view it online +at [lua/neo-tree/defaults.lua](lua/neo-tree/defaults.lua). You can also paste it +into a buffer after installing Neo-tree by running: + +``` +:lua require("neo-tree").paste_default_config() +``` + +## The `:Neotree` Command + +The single `:Neotree` command accepts a range of arguments that give you full +control over the details of what and where it will show. For example, the following +command will open a file browser on the right hand side, "revealing" the currently +active file: + +``` +:Neotree filesystem reveal right +``` + +Arguments can be specified as either a key=value pair or just as the value. The +key=value form is more verbose but may help with clarity. For example, the command +above can also be specified as: + +``` +:Neotree source=filesystem reveal=true position=right +``` + +All arguments are optional and can be specified in any order. If you issue the command +without any arguments, it will use default values for everything. For example: + +``` +:Neotree +``` + +will open the filesystem source on the left hand side and focus it, if you are using +the default config. + +### Tab Completion + +Neotree supports tab completion for all arguments. Once a given argument has a value, +it will stop suggesting those completions. It will also offer completions for paths. +The simplest way to disambiguate a path from another type of argument is to start +them with `/` or `./`. + +### Arguments + +Here is the full list of arguments you can use: + +#### `action` +What to do. Can be one of: + +| Option | Description | +|--------|-------------| +| focus | Show and/or switch focus to the specified Neotree window. DEFAULT | +| show | Show the window, but keep focus on your current window. | +| close | Close the window(s) specified. Can be combined with "position" and/or "source" to specify which window(s) to close. | + +#### `source` +What to show. Can be one of: + +| Option | Description | +|--------|-------------| +| filesystem | Show a file browser. DEFAULT | +| buffers | Show a list of currently open buffers. | +| git_status | Show the output of `git status` in a tree layout. | +| last | Equivalent to the last source used | + +#### `position` +Where to show it, can be one of: + +| Option | Description | +|---------|-------------| +| left | Open as left hand sidebar. DEFAULT | +| right | Open as right hand sidebar. | +| top | Open as top window. | +| bottom | Open as bottom window. | +| float | Open as floating window. | +| current | Open within the current window, like netrw or vinegar would. | + +#### `toggle` +This is a boolean flag. Adding this means that the window will be closed if it +is already open. + +#### `dir` +The directory to set as the root/cwd of the specified window. If you include a +directory as one of the arguments, it will be assumed to be this option, you +don't need the full dir=/path. You may use any value that can be passed to the +'expand' function, such as `%:p:h:h` to specify two directories up from the +current file. For example: + +``` +:Neotree ./relative/path +:Neotree /home/user/relative/path +:Neotree dir=/home/user/relative/path +:Neotree position=current dir=relative/path +``` + +#### `git_base` +The base that is used to calculate the git status for each dir/file. +By default it uses `HEAD`, so it shows all changes that are not yet committed. +You can for example work on a feature branch, and set it to `main`. It will +show all changes that happened on the feature branch and main since you +branched off. + +Any git ref, commit, tag, or sha will work. + +``` +:Neotree main +:Neotree v1.0 +:Neotree git_base=8fe34be +:Neotree git_base=HEAD +``` + +#### `reveal` +This is a boolean flag. Adding this will make Neotree automatically find and +focus the current file when it opens. + +#### `reveal_file` +A path to a file to reveal. This supersedes the "reveal" flag so there is no +need to specify both. Use this if you want to reveal something other than the +current file. If you include a path to a file as one of the arguments, it will +be assumed to be this option. Like "dir", you can pass any value that can be +passed to the 'expand' function. For example: + +``` +:Neotree reveal_file=/home/user/my/file.text +:Neotree position=current dir=%:p:h:h reveal_file=%:p +:Neotree current %:p:h:h %:p +``` + +One neat trick you can do with this is to open a Neotree window which is +focused on the file under the cursor using the `` keyword: + +``` +nnoremap gd :Neotree float reveal_file= reveal_force_cwd +``` + +#### `reveal_force_cwd` +This is a boolean flag. Normally, if you use one of the reveal options and the +given file is not within the current working directory, you will be asked if you +want to change the current working directory. If you include this flag, it will +automatically change the directory without prompting. This option implies +"reveal", so you do not need to specify both. + +#### `selector` +This is a boolean flag. When you specifically set this to false (`selector=false`) +neo-tree will disable the [source selector](#source-selector) for that neo-tree +instance. Otherwise, the source selector will depend on what you specified in +the configuration (`config.source_selector.{winbar,statusline}`). + +See `:h neo-tree-commands` for details and a full listing of available arguments. + +### File Nesting + +See `:h neo-tree-file-nesting` for more details about file nesting. + + +### Netrw Hijack + +``` +:edit . +:[v]split . +``` + +If `"filesystem.window.position"` is set to `"current"`, or if you have specified +`filesystem.hijack_netrw_behavior = "open_current"`, then any command +that would open a directory will open neo-tree in the specified window. + + +## Sources + +Neo-tree is built on the idea of supporting various sources. Sources are +basically interface implementations whose job it is to provide a list of +hierarchical items to be rendered, along with commands that are appropriate to +those items. + +### filesystem +The default source is `filesystem`, which displays your files and folders. This +is the default source in commands when none is specified. + +This source can be used to: +- Browse the filesystem +- Control the current working directory of nvim +- Add/Copy/Delete/Move/Rename files and directories +- Search the filesystem +- Monitor git status and lsp diagnostics for the current working directory + +### buffers +![Neo-tree buffers](https://github.com/nvim-neo-tree/resources/raw/main/images/Neo-tree-buffers.png) + +Another available source is `buffers`, which displays your open buffers. This is +the same list you would see from `:ls`. To show with the `buffers` list, use: + +``` +:Neotree buffers +``` + +### git_status +This view take the results of the `git status` command and display them in a +tree. It includes commands for adding, unstaging, reverting, and committing. + +The screenshot below shows the result of `:Neotree float git_status` while the +filesystem is open in a sidebar: + +![Neo-tree git_status](https://github.com/nvim-neo-tree/resources/raw/main/images/Neo-tree-git_status.png) + +You can specify a different git base here as well. But be aware that it is not +possible to unstage / revert a file that is already committed. + +``` +:Neotree float git_status git_base=main +``` + +### document_symbols + +![Neo-tree document_symbols](https://github.com/nvim-neo-tree/resources/raw/main/images/neo-tree-document-symbols.png) +The document_symbols source lists the symbols in the current document obtained +by the LSP request "textDocument/documentSymbols". It currently supports the +following features: +- [x] UI: + - [x] Display all symbols in the current file with symbol kinds + - [x] Symbols nesting + - [x] Configurable kinds' name and icon + - [x] Auto-refresh symbol list + - [x] Follow cursor +- [ ] Commands + - [x] Jump to symbols, open symbol in split,... (`open_split` and friends) + - [x] Rename symbols (`rename`) + - [x] Preview symbol (`preview` and friends) + - [ ] Hover docs + - [ ] Call hierarchy +- [x] LSP + - [x] LSP Support + - [x] LSP server selection (ignore, allow_only, use first, use all, etc.) +- [ ] CoC Support + +See #879 for the tracking issue of these features. + +This source is currently experimental, so in order to use it, you need to first +add `"document_symbols"` to `config.sources` and open it with the command +``` +:Neotree document_symbols +``` + +### External Sources + +There are more sources available as extensions that are managed outside of this repository. See the +[wiki](https://github.com/nvim-neo-tree/neo-tree.nvim/wiki/External-Sources) for more information. + +### Source Selector + +![Neo-tree source selector](https://github.com/nvim-neo-tree/resources/raw/main/images/Neo-tree-source-selector.png) + +You can enable a clickable source selector in either the winbar (requires neovim 0.8+) or the statusline. +To do so, set one of these options to `true`: + +```lua + require("neo-tree").setup({ + source_selector = { + winbar = false, + statusline = false + } + }) +``` + +There are many configuration options to change the style of these tabs. +See [lua/neo-tree/defaults.lua](lua/neo-tree/defaults.lua) for details. + +### Preview Mode + +`:h neo-tree-preview-mode` + +Preview mode will temporarily show whatever file the cursor is on without +switching focus from the Neo-tree window. By default, files will be previewed +in a new floating window. This can also be configured to automatically choose +an existing split by configuring the command like this: + +```lua +require("neo-tree").setup({ + window = { + mappings = { + ["P"] = { "toggle_preview", config = { use_float = false, use_image_nvim = true } }, + } + } +}) +``` + +Anything that causes Neo-tree to lose focus will end preview mode. When +`use_float = false`, the window that was taken over by preview mode will revert +back to whatever was shown in that window before preview mode began. + +If you want to work with the floating preview mode window in autocmds or other +custom code, the window will have the `neo-tree-preview` filetype. + +When preview mode is not using floats, the window will have the window local +variable `neo_tree_preview` set to `1` to indicate that it is being used as a +preview window. You can refer to this in statusline and winbar configs to mark a +window as being used as a preview. + +#### Image Support in Preview Mode + +If you have [3rd/image.nvim](https://github.com/3rd/image.nvim) installed, preview +mode supports image rendering by default using kitty graphics protocol or ueberzug +([Video](https://user-images.githubusercontent.com/41065736/277180763-b7152637-f310-43a5-b8c3-4bcba135629d.mp4)). +However, if you do not want this feature, you can disable it by changing the option +`use_image_nvim = false` in the mappings config mentioned above. + +## Configuration and Customization + +This is designed to be flexible. The way that is achieved is by making +everything a function, or a string that identifies a built-in function. All of the +built-in functions can be replaced with your own implementation, or you can +add new ones. + +Each node in the tree is created from the renderer specified for the given node +type, and each renderer is a list of component configs to be rendered in order. +Each component is a function, either built-in or specified in your config. Those +functions simply return the text and highlight group for the component. + +Additionally, there is an events system that you can hook into. If you want to +show some new data point related to your files, gather it in the +`before_render` event, create a component to display it, and reference that +component in the renderer for the `file` and/or `directory` type. + +Details on how to configure everything is in the help file at `:h +neo-tree-configuration` or online at +[neo-tree.txt](https://github.com/nvim-neo-tree/neo-tree.nvim/blob/main/doc/neo-tree.txt) + +Recipes for customizations can be found on the [wiki](https://github.com/nvim-neo-tree/neo-tree.nvim/wiki/Recipes). Recipes include +things like adding a component to show the +[Harpoon](https://github.com/ThePrimeagen/harpoon) index for files, or +responding to the `"file_opened"` event to auto clear the search when you open a +file. + + +## Why? + +There are many tree plugins for (neo)vim, so why make another one? Well, I +wanted something that was: + +1. Easy to maintain and enhance. +2. Stable. +3. Easy to customize. + +### Easy to maintain and enhance + +This plugin is designed to grow and be flexible. This is accomplished by making +the code as decoupled and functional as possible. Hopefully new contributors +will find it easy to work with. + +One big difference between this plugin and the ones that came before it, which +is also what finally pushed me over the edge into making a new plugin, is that +we now have libraries to build upon that did not exist when other tree plugins +were created. Most notably, [nui.nvim](https://github.com/MunifTanjim/nui.nvim) +and [plenary.nvm](https://github.com/nvim-lua/plenary.nvim). Building upon +shared libraries will go a long way in making neo-tree easy to maintain. + +### Stable + +This project will have releases and release tags that follow a simplified +Semantic Versioning scheme. The quickstart instructions will always refer to +the latest stable major version. Following the **main** branch is for +contributors and those that always want bleeding edge. There will be branches +for **v1.x**, **v2.x**, etc which will receive updates after a short testing +period in **main**. You should be safe to follow those branches and be sure +your tree won't break in an update. There will also be tags for each release +pushed to those branches named **v1.1**, **v1.2**, etc. If stability is +critical to you, or a bug accidentally make it into **v1.x**, you can use those +tags instead. It's possible we may backport bug fixes to those tags, but no +garauntees on that. + +There will never be a breaking change within a major version (1.x, 2.x, etc.) If +a breaking change is needed, there will be depracation warnings in the prior +major version, and the breaking change will happen in the next major version. + +### Easy to Customize + +Neo-tree follows in the spirit of plugins like +[lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) and +[nvim-cokeline](https://github.com/noib3/nvim-cokeline). Everything will be +configurable and take either strings, tables, or functions. You can take sane +defaults or build your tree items from scratch. There should be the ability to +add any features you can think of through existing hooks in the setup function. + +## What is a Breaking Change? + +As of v1.30, a breaking change is defined as anything that _changes_ existing: + +- vim commands (`:Neotree`) +- configuration options that are passed into the `setup()` function +- `NeoTree*` highlight groups +- lua functions exported in the following modules that are not prefixed with `_`: + * `neo-tree` + * `neo-tree.events` + * `neo-tree.sources.manager` + * `neo-tree.sources.*` (init.lua files) + * `neo-tree.sources.*.commands` + * `neo-tree.ui.renderer` + * `neo-tree.utils` + +If there are other functions you would like to use that are not yet considered +part of the public API, please open an issue so we can discuss it. + +## Contributions + +Contributions are encouraged. Please see [CONTRIBUTING](CONTRIBUTING.md) for more details. + +## Acknowledgements + +### Maintainers + +First and foremost, this project is a community endeavor and would not survive without the constant stream of features +and bug fixes that comes from that community. There have been many valued contributors, but a few have stepped up to +become maintainers that generously donate their time to guide the project, help out others, and manage the issues. The +current list of maintainers are: + +(in alphabetical order) + +- @cseickel +- @miversen33 +- @nhat-vo +- @pysan3 + +### Other Projects + +This project relies upon these two excellent libraries: +- [nui.nvim](https://github.com/MunifTanjim/nui.nvim) for all UI components, including the tree! +- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim) for backend utilities, such as scanning the filesystem. + +The design is heavily inspired by these excellent plugins: +- [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) +- [nvim-cokeline](https://github.com/noib3/nvim-cokeline) + +Everything I know about writing a tree control in lua, I learned from: +- [nvim-tree.lua](https://github.com/nvim-tree/nvim-tree.lua) diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/doc/neo-tree.txt b/config/neovim/store/lazy-plugins/neo-tree.nvim/doc/neo-tree.txt new file mode 100644 index 00000000..be49813b --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/doc/neo-tree.txt @@ -0,0 +1,1895 @@ +*neo-tree.txt* Plugin to browse the file system and other tree like structures + +CONTENTS *neo-tree* +Introduction ................ |neo-tree-introduction| +Commands .................... |neo-tree-commands| +Mappings .................... |neo-tree-mappings| + Help ...................... |neo-tree-help| + Navigation ................ |neo-tree-navigation| + View Changes .............. |neo-tree-view-changes| + File Actions .............. |neo-tree-file-actions| + Filter .................... |neo-tree-filter| + Custom Mappings ........... |neo-tree-custom-mappings| + Custom Commands ........... |neo-tree-custom-commands| +Configuration ............... |neo-tree-configuration| + Setup ..................... |neo-tree-setup| + Source Selector ........... |neo-tree-source-selector| + Filtered Items ............ |neo-tree-filtered-items| + Preview Mode .............. |neo-tree-preview-mode| + Hijack Netrw Behavior ..... |neo-tree-netrw-hijack| + Component Configs ......... |neo-tree-component-configs| + Git Status ................ |neo-tree-git-status| + Diagnostics ............... |neo-tree-diagnostics| + Indent markers ............ |neo-tree-indent-markers| + Expanders ................. |neo-tree-expanders| + File nesting .............. |neo-tree-file-nesting| + Highlights ................ |neo-tree-highlights| + Events .................... |neo-tree-events| + Components and Renderers .. |neo-tree-renderers| + Buffer Variables .......... |neo-tree-buffer-variables| + Popups .................... |neo-tree-popups| +Other Sources ............... |neo-tree-sources| + Buffers ................... |neo-tree-buffers| + Git Status ................ |neo-tree-git-status-source| + Document Symbols .......... |neo-tree-document-symbols| + + +INTRODUCTION *neo-tree-introduction* + +Neo-tree is a plugin for nvim that can display tree structures in a sidebar, +floating window, or in a split. The current version includes a filesystem +browser, a buffer list, and a git status view. + +If you want to use this in splits like |netrw| instead of as a sidebar or +floating window, use the *Split commands, such as |NeoTreeRevealInSplit|. You +may use both styles at the same time if you want. + + +COMMANDS *:Neotree* *neo-tree-commands* + +Neo-tree does not define any default keybindings for nvim. The suggested +keybindings are: + + nnoremap / :Neotree toggle current reveal_force_cwd + nnoremap | :Neotree reveal + nnoremap gd :Neotree float reveal_file= reveal_force_cwd + nnoremap b :Neotree toggle show buffers right + nnoremap s :Neotree float git_status + +The single |:Neotree| command accepts a range of arguments that give you full +control over the details of what and where it will show. Arguments can be +specified as either a key=value pair or just as the value. The key=value form +is more verbose but may help with clarity. For example, the "buffers" command +above can also be specified as: +>vim + :Neotree action=show source=buffers position=right toggle=true +< +These arguments can be specified in any order. Here is the full list of +arguments you can use: + +action~ +What to do. Can be one of: + + focus : Show and/or switch focus to the specified Neotree window. DEFAULT + show : Show the window, but keep focus on your current window. + close : Close the window(s) specified. Can be combined with "position" + and/or "source" to specify which window(s) to close. + +source~ +What to show. Can be one of: + + filesystem : Show a file browser. DEFAULT + buffers : Show a list of currently open buffers. + git_status : Show the output of `git status` in a tree layout. + +position~ +Where to show it, can be one of: + + left : Open as left hand sidebar. DEFAULT + right : Open as right hand sidebar. + float : Open as floating window. + current : Open within the current window, like netrw or vinegar would. + +toggle~ +This is a boolean flag. Adding this means that the window will be closed if it +is already open. + +dir~ +The directory to set as the root/cwd of the specified window. If you include a +directory as one of the arguments, it will be assumed to be this option, you +don't need the full dir=/path. You may use any value that can be passed to the +'expand' function, such as `%:p:h:h` to specify two directories up from the +current file. + +git_base~ +The base that is used to calculate the git status for each dir/file. +By default it uses `HEAD`, so it shows all changes that are not yet committed. +You can for example work on a feature branch, and set it to `main`. It will +show all changes that happened on the feature branch and main since you +branched off. + +Any git ref, commit, tag, or sha will work. + +reveal~ +This is a boolean flag. Adding this will make Neotree automatically find and +focus the current file when it opens. + +reveal_path~ +A path to a file to reveal. This supersedes the "reveal" flag so there is no +need to specify both. Use this if you want to reveal something other than the +current file. If you include a path to a file as one of the arguments, it will +be assumed to be this option. Like "dir", you can pass any value that can be +passed to the 'expand' function. + +reveal_force_cwd~ +This is a boolean flag. Normally, if you use one of the reveal options and the +given file is not within the current working directory, you will be asked if you +want to change the current working directory. If you include this flag, it will +automatically change the directory without prompting. This option implies +"reveal", so you do not need to specify both. + +selector~ +This is a boolean flag. When you specifically set this to false (`selector=false`) +neo-tree will disable the |neo-tree-source-selector| for that neo-tree +instance. Otherwise, the source selector will depend on what you specified in +the configuration (`config.source_selector.{winbar,statusline}`). + +CALLING_FROM_LUA + +You can call Neotree commands from your Lua scripts as follows: + +>lua + require('neo-tree.command').execute({ ... }) +< + +For example, you could use the following keymap to make the `-` key reveal the +current file, or if in an unsaved file, the current working directory. + +>lua + vim.keymap.set('n', '-', function() + local reveal_file = vim.fn.expand('%:p') + if (reveal_file == '') then + reveal_file = vim.fn.getcwd() + else + local f = io.open(reveal_file, "r") + if (f) then + f.close(f) + else + reveal_file = vim.fn.getcwd() + end + end + require('neo-tree.command').execute({ + action = "focus", -- OPTIONAL, this is the default value + source = "filesystem", -- OPTIONAL, this is the default value + position = "left", -- OPTIONAL, this is the default value + reveal_file = reveal_file, -- path to file or folder to reveal + reveal_force_cwd = true, -- change cwd without asking if needed + }) + end, + { desc = "Open neo-tree at current file or working directory" } + ); +< + +=============================================================================== +MAPPINGS ~ +=============================================================================== + *neo-tree-mappings* + +HELP *neo-tree-help* + +? = show_help: Shows a popup window with all of the mappings for the current + Neotree window. Pressing one of those keys will close the help + screen and execute the chosen command in the original Neotree + window. NOTE that selecting a line in the help window and + pressing enter will not execute that command, it will just + execute whatever the enter key is mapped to. + + +NAVIGATION *neo-tree-navigation* + +Within the neo-tree window, for the filesystem source, the following mappings +are defined by default. All built-in commands are listed here but some are not +mapped by default. See |neo-tree-custom-commands| for details on how to use them +in a custom mapping. + +Note: The "selected" item is the line the cursor is currently on. + +< = prev_source: Switches to the previous source. + +> = next_source: Switches to the next source. + + = navigate_up: Moves the root directory up one level. + +. = set_root: Changes the root directory to the currently + selected folder. + + = toggle_node Expand or collapse a node with children, which + may be a directory or a nested file. + +<2-LeftMouse> = open: Expand or collapse a folder. If a file is selected, + open it in the window closest to the tree. + + = open: Same as above. + +C = close_node: Close node if it is open, else close it's parent. + +z = close_all_nodes: Close all nodes in the tree. + + close_all_subnodes: Same as "close_node", but also recursively collapse + all subnodes, similar to "close_all_nodes" + + expand_all_nodes: Expand all directory nodes in the tree recursively. + +P = toggle_preview: Toggles "preview mode", see |neo-tree-preview-mode| + +l = focus_preview: Focus the active preview window + + = scroll_preview: Scrolls preview window down (without focusing it) + see |neo-tree-preview-mode| for params + + = scroll_preview: Scrolls preview window up (without focusing it) + see |neo-tree-preview-mode| for params + + = revert_preview: Ends "preview_mode" if it is enabled, and reverts + any preview windows to what was being shown before + preview mode began. + +S = open_split: Same as open, but opens in a new horizontal split. + +s = open_vsplit: Same as open, but opens in a vertical split. + + open_rightbelow_vs: Same as open_vsplit, but opens in a right window + of the vertical split. + + open_leftabove_vs: Same as open_vsplit, but opens in a left window + of the vertical split. + +t = open_tabnew: Same as open, but opens in a new tab. + + open_drop: Same as open, but opens with the |:drop| command. + + open_tab_drop: Same as open, but opens in a new tab with the + |:drop| command with the |:tab| modifier. + +w = open_with_window_picker: Uses the `window-picker` plugin to select a window + to open the selected node in. Requires that + https://github.com/s1n7ax/nvim-window-picker + be installed. + + split_with_window_picker: Same as `open_with_window_picker` but opens split + in selected node instead. + + vsplit_with_window_picker: Same as `open_with_window_picker` but opens + vertical split in selected node instead. + +[g = prev_git_modified: Jump to the previous file reported by `git status` + that is within the current working directory. + This will loop around if you are on the last one. + +]g = next_git_modified: Jump to the next file reported by `git status` + that is within the current working directory. + This will loop around if you are on the last one. + + +FILE ACTIONS *neo-tree-file-actions* +a = add: Create a new file OR directory. Add a `/` to the + end of the name to make a directory. This command + supports an optional `config.show_path` option + which controls what portion of the path is shown + in the prompt. The choices for this option are: + + `"none"`: which is the default. + `"relative"`: shows the portion which is relative + to the current root of the tree. + `"absolute"`: is the full path to the current + directory. + + The file path also supports BASH style brace + expansion. sequence style ("{00..05..2}") as well + as nested braces. Here are some examples how this + expansion works. + + "x{a..e..2}" : "xa", "xc", "xe" + "file.txt{,.bak}" : "file.txt", "file.txt.bak" + "./{a,b}/{00..02}.lua" : "./a/00.lua", "./a/01.lua", + "./a/02.lua", "./b/00.lua", + "./b/01.lua", "./b/02.lua" + +A = add_directory: Create a new directory, in this mode it does not + need to end with a `/`. The path also supports + BASH style brace expansion as explained in `add` + command. Also accepts `config.show_path` options + +d = delete: Delete the selected file or directory. + Supports visual selection.~ + +i = show_file_details Show file details in popup window, such as size + and last modified date. + +r = rename: Rename the selected file or directory. + +y = copy_to_clipboard: Mark file to be copied. + Supports visual selection.~ + +x = cut_to_clipboard: Mark file to be cut (moved). + Supports visual selection.~ + +p = paste_from_clipboard: Copy/move each marked file to the selected folder. + +c = copy: Copy the selected file or directory. + Also accepts the optional `config.show_path` option + like the add file action. + +m = move: Move the selected file or directory. + Also accepts the optional `config.show_path` option + like the add file action. + + +VIEW CHANGES *neo-tree-view-changes* +H = toggle_hidden: Toggle whether hidden (filtered items) are shown or not. + +R = refresh: Rescan the filesystem and redraw the tree. Changes made + within nvim should be detected automatically, but this is + useful for changes made elsewhere. + +o = order_by... Show help menu for order by choices. + +oc = ...created: Sort the tree by created date. + +od = ...diagnostics: Sort by diagnostic severity. + +og = ...git_status: Sort by git status. + +om = ...modified: Sort by last modified date. + +on = ...name: Sort by name (default sort). + +os = ...size: Sort by size. + +ot = ...type: Sort by type. + + +FILTER *neo-tree-filter* + +NOTE: All of the below commands are affected by the `find_by_full_path_words` +option: +>lua + require("neo-tree").setup({ + filesystem = { + find_by_full_path_words = false, + } + }) +< +`false` means it only searches the tail of a path and is the default. +`true` will change the filter into a full path search with space as an implicit +`".*"`, so `fi init` will match: `./sources/filesystem/init.lua` + + +/ = fuzzy_finder: Filter the tree recursively, searching for + files and folders that contain the specified term as + you type. This will use fd if it is installed, or + find, or which if you are on Windows. + + As of v1.28, this acts like a fuzzy finder, + meaning that pressing up/down while the filter + window is open will move the cursor up and down in + the tree, and pressing `` will open that + item and clear the filter. Any other method of + closing the filter window will also clear the + filter. + +D = fuzzy_finder_directory: Like fuzzy_finder above, but only shows directories. + Pressing on a directory will clear the + search and set the focus on that directory. + Requires `fd` or `find` to be installed~ + +# = fuzzy_sorter: Sort the tree recursively based on fzy algorithm, + showing top score files. Space separated keywords + are treated as `and` which will be useful to narrow + down as you type. The file list is taken from fd + and other programs mentioned in `fuzzy_finder`. + `fuzzy_sorter_directory` can be used to show list + of directories instead. + +f = filter_on_submit: Same as above, but does not search until you hit + enter. Useful if filter_as_you_type is too slow. + Also useful if you want to leave the tree + filtered. + + = clear_filter: Removes the filter. + +PREVIEW MODE *neo-tree-preview-mode* + +Preview mode will temporarily show whatever file the cursor is on without +switching focus from the Neo-tree window. By default, files will be previewed +in a new floating window. This can also be configured to automatically choose +an existing split by configuring the command like this: + +>lua + require("neo-tree").setup({ + window = { + mappings = { + ["P"] = { "toggle_preview", config = { use_float = false, use_image_nvim = true } }, + ["l"] = "focus_preview", + [""] = { "scroll_preview", config = {direction = 10} }, + [""] = { "scroll_preview", config = {direction = -10} }, + } + } + }) +< +Anything that causes Neo-tree to lose focus will end preview mode. When +`use_float = false`, the window that was taken over by preview mode will revert +back to whatever was shown in that window before preview mode began. + +If you want to work with the floating preview mode window in autocmds or other +custom code, the window will have the `neo-tree-preview` filetype. + +When preview mode is not using floats, the window will have the window local +variable `neo_tree_preview` set to `1` to indicate that it is being used as a +preview window. You can refer to this in statusline and winbar configs to mark a +window as being used as a preview. + +If you have [3rd/image.nvim](https://github.com/3rd/image.nvim) installed, preview +mode supports image rendering by default using kitty graphics protocol or ueberzug. +However, if you do not want this feature, you can disable it by changing the option +`use_image_nvim = false` in the mappings config mentioned above. + +CUSTOM MAPPINGS *neo-tree-custom-mappings* + +If you want to change the mappings, you can do so in two places. Mappings +defined in `window.mappings` apply to all sources, and mappings defined at the +source level, such as `filesystem.window.mappings` will override and extend +those global mappings for that particular source. + +For example: +>lua + require("neo-tree").setup({ + window = { + mappings = { + ["A"] = "command_a", + ["i"] = { + function(state) + local node = state.tree:get_node() + print(node.path) + end, + desc = "print path", + }, + } + }, + filesystem = { + window = { + mappings = { + ["A"] = "command_b" + } + } + } + }) +< +The above config will map `A` to command_a for all sources except for +filesystem, which will use command_b instead. + +The desc is used to display in the help popup. + +If you don't want to use *any* default mappings, you can set +`use_default_mappings = false` in your config. + +If you want to remove one or more particular default mappings, you can map +the sequence to `none` or `noop`. For example, if you don’t wish to use +fuzzy finder (default mapping `/`), but instead rely on Neovim’s built-in +search functionality, you can do that like so this: + +>lua + require("neo-tree").setup({ + filesystem = { + window = { + mappings = { + -- disable fuzzy finder + ["/"] = "noop" + } + } + } + }) +< + +NOTE: Not all commands work for all sources. If it is defined in the source +section in the default config instead of at the root level, that means it is +specific to that source and will not work for others. + + +CUSTOM MAPPINGS WITH VISUAL MODE *neo-tree-custom-mappings-visual* + +If you want to create a mapping that supports visual mode, the way to do that +is to add a second command where the name is the same as the normal mode +command, but with `_visual` added to the end. Any mapping for this command will +then work in either normal or visual mode. + +The `_visual` version of the command will be called with a second argument +which is a list of the nodes that were selected when the command was called. + +For example, this is how the built-in `delete` command is defined: + +>lua + M.delete = function(state, callback) + local tree = state.tree + local node = tree:get_node() + fs_actions.delete_node(node.path, callback) + end + + M.delete_visual = function(state, selected_nodes, callback) + local paths_to_delete = {} + for _, node_to_delete in pairs(selected_nodes) do + table.insert(paths_to_delete, node_to_delete.path) + end + fs_actions.delete_nodes(paths_to_delete, callback) + end +< + +CUSTOM MAPPINGS WITH ARGUMENTS *neo-tree-custom-mappings-args* + +If you want to include options for your mappings, such as `nowait`, you can +set this for all mappings using the `mapping_options` key, or on individual +mappings by specifying them as a table that consists of the command and any +options you want to use. If both are specified, the mapping merges with and +overrides the global `mapping_options` + +The command can be either the string name of a built-in command, or a +function, and is specified either as the first element in the table or by +assigning it to the `command` key: +>lua + require("neo-tree").setup({ + filesystem = { + window = { + mapping_options = { + noremap = true, + nowait = false, + }, + mappings = { + ["?"] = { + function(state) + local node = state.tree:get_node() + print(node.name) + end, + desc = "print name", + nowait = true + }, + ["i"] = { + command = function(state) + local node = state.tree:get_node() + print(node.name) + end, + desc = "print name", + nowait = true, + }, + ["o"] = { + command = "open", + nowait = true + }, + ["O"] = { + "open", + nowait = true + }, + } + } + } + }) +< +See |:map-arguments| for possible values to include. "buffer" and "nnoremap" +are enabled by default. + +CUSTOM MAPPINGS WITH CONFIG *neo-tree-custom-mappings-config* + +Some mappings may accept an optional `config` table to control it's behavior. +When that is the case, the command is specified using the table syntax, and +the config options are in a table bound to the `config` key: +>lua + require("neo-tree").setup({ + filesystem = { + window = { + mappings = { + ["a"] = { + "add", + nowait = true + config = { + show_path = "none" -- "none", "relative", "absolute" + } + }, + } + } + } + }) +< +When the `config` key is used, it is added to the `state` argument that is +passed to the command function: +>lua + M.add = function(state, callback) + local show_path = state.config.show_path + ... +< + +CUSTOM COMMANDS *neo-tree-custom-commands* + +If you want to define your own command, you have two options: + 1. You can define (or override) a command in the `commands` section of the + config for each source, then reference that by name in a mapping. + 2. You can map directly to a function and skip defining a command. + +You probably want #2: +>lua + require("neo-tree").setup({ + filesystem = { + window = { + mappings = { + ["?"] = function(state) + local node = state.tree:get_node() + print(node.name) + end + } + } + } + }) +< +..or +>lua + local print_me = function(state) + local node = state.tree:get_node() + print(node.name) + end + + require("neo-tree").setup({ + filesystem = { + window = { + mappings = { + ["?"] = print_me + } + } + } + }) +< +...but if you want #1, here is how that works: + +>lua + require("neo-tree").setup({ + filesystem = { + commands = { + print_me = function(state) + local node = state.tree:get_node() + print(node.name) + end + }, + mappings = { + ["?"] = "print_me" + } + } + }) +< + +GLOBAL CUSTOM COMMANDS *neo-tree-custom-commands-global* + +You can also have global custom commands that will be added to all available +sources. If you need it you can then override it in a specific source. +>lua + require("neo-tree").setup({ + commands = { + hello = function() -- define a global "hello world" function + print("Hello world") + end + }, + + window = { + mappings = { + [""] = "hello" + -- define a global mapping to call 'hello' in every source + } + }, + + filesystem = { + commands = { + -- override implementation of the 'hello' action in filesystem source + hello = function() + print("Hello inside filesystem") + end + } + } + }) +< +Now when pressing `` in 'buffers' or 'git_status' it will print "Hello world", +but in 'filesystem' it will print "Hello inside filesystem". + + +================================================================================ +CONFIGURATION ~ +================================================================================ + *neo-tree-configuration* +Neo-tree is highly configurable and you should be able to make it do whatever +you want without having to change the internal code. Here are the ways you can +customize it: + +By setting config options in the |neo-tree-setup| function. This is for very +common items and is how you would configure most lua plugins. You can also +change the look by configuring the appropriate highlight groups, see +|neo-tree-highlights|. + +By creating custom mappings (see |neo-tree-mappings|). You can of course just +change what keys are mapped to which built-in functions, but you can also map +keys to a custom function and do whatever you want. See the wiki for some +examples: https://github.com/nvim-neo-tree/neo-tree.nvim/wiki/Recipes#commands + +By hooking into |neo-tree-events|. You can do things like always clear the +search after opening a file, or define a custom file opener to choose what +window will be used, or respond to file events like renames and moves. + +By configuring, rearranging, adding, or removing |neo-tree-renderers| for each +node type. The renderer is a list of components, such as "icon" and "name", +which determines how each node displayed. Use them as lego pieces to build what +you want to see. + +By adding or replacing |neo-tree-components|. Components are the functions +called by the renderers, and they return the text and highlight group to be +displayed. If you want to gather extra data just once per render to be used by a +custom component, you can do so in the "before_render" event (see +|neo-tree-events|), set that data on the `state` object, and reference it in the +component. See the wiki for some examples of custom components: +https://github.com/nvim-neo-tree/neo-tree.nvim/wiki/Recipes#components + + +SETUP *neo-tree-setup* + +To override the defaults or add new functionality, call the setup() function +with your overrides. For example, to add your own mappings in 'lua': + +>lua + require("neo-tree").setup({ + filesystem = { + window = { + mappings = { + [""] = "refresh", + ["o"] = "open", + } + } + } + }) +< + +NOTE: The mappings you define will be merged with the default mappings. If you +wish to remove a default mapping without overriding it with your own function, +assign it the the string "none". This will cause it to be skipped and allow any +existing global mappings to work. + +NOTE: SOME OPTIONS ARE ONLY DOCUMENTED IN THE DEFAULT CONFIG!~ +Run `:lua require("neo-tree").paste_default_config()` to dump the fully +commented default config in your current file. Even if you don't want to use +that config as your starting point, you still may want to dump it to a blank +lua file just to read it as documentation. + + +SOURCE SELECTOR *neo-tree-source-selector* + +You can enable a clickable source selector in either the winbar +(requires neovim 0.8+) or the statusline. To do so, set one of these options +to `true`: + +>lua + requires("neo-tree").setup({ + source_selector = { + winbar = false, + statusline = false + } + }) +< + +The configuration options for source selector are all placed inside +`source_selector` table. Below are the options with their default values and +type notations. + +>lua + requires("neo-tree").setup({ + source_selector = { + winbar = false, -- toggle to show selector on winbar + statusline = false, -- toggle to show selector on statusline + show_scrolled_off_parent_node = false, -- boolean + sources = { -- table + { + source = "filesystem", -- string + display_name = " 󰉓 Files " -- string | nil + }, + { + source = "buffers", -- string + display_name = " 󰈚 Buffers " -- string | nil + }, + { + source = "git_status", -- string + display_name = " 󰊢 Git " -- string | nil + }, + }, + content_layout = "start", -- string + tabs_layout = "equal", -- string + truncation_character = "…", -- string + tabs_min_width = nil, -- int | nil + tabs_max_width = nil, -- int | nil + padding = 0, -- int | { left: int, right: int } + separator = { left = "▏", right= "▕" }, -- string | { left: string, right: string, override: string | nil } + separator_active = nil, -- string | { left: string, right: string, override: string | nil } | nil + show_separator_on_edge = false, -- boolean + highlight_tab = "NeoTreeTabInactive", -- string + highlight_tab_active = "NeoTreeTabActive", -- string + highlight_background = "NeoTreeTabInactive", -- string + highlight_separator = "NeoTreeTabSeparatorInactive", -- string + highlight_separator_active = "NeoTreeTabSeparatorActive", -- string + }, + }) +< + +Keywords: > + + ┃/ a \/ b \/ c \ ┃ <- edge of window + ^ ^^ ^^ ^ separators + left separator right separator +< + +Configuration Options: +When `show_scrolled_off_parent_node` is `true`, tabs are replaced with the parent +path of the top visible node when scrolled down. + +`sources` is a table to configure the contents of the bar. Previously known +as `tab_labels`. Sources should be a table of tables. Each table inside +`sources` must contain a `source` key, which will refer to the "name" of the +source to add to the bar. A second optional `display_name` key can be +provided to modify how you wish that source to appear in the bar. It is +safe to add sources that do not exist, they will simply be omitted from +the bar if they cannot be found. +NOTE: If `source_selector` is enabled (via `winbar=true` or `statusline=true`) +then the `default_source` will be updated to be the first entry of +`sources`. + +`content_layout` defines how the labels are placed inside a tab. This only takes +effect when the tab width is greater than the length of label i.e. +`tabs_layout = "equal", "focus"` or when `tabs_min_width` is large enough. +Following options are available. + 'start' : left aligned / 󰓩 bufname \/.. + 'end' : right aligned / 󰓩 bufname \/... + 'center' : centered with equal padding / 󰓩 bufname \/... + +`tabs_layout` defines how the tabs are aligned inside the window when there is +more than enough space. The following options are available. `active` will +expand the focused tab as much as possible. Bars denote the edge of window. + 'start' : left aligned ┃/ ~ \/ ~ \/ ~ \ ┃ + 'end' : right aligned ┃ / ~ \/ ~ \/ ~ \┃ + 'center' : centered with equal padding ┃ / ~ \/ ~ \/ ~ \ ┃ + 'equal' : expand all tabs equally to fit the window width ┃/ ~ \/ ~ \/ ~ \┃ + 'active' : expand the focused tab to fit the window width ┃/ focused tab \/ ~ \/ ~ \┃ + +`padding` defines the global padding of the source selector. It can be an +integer or a table with keys `left` and `right`. Setting `padding = 2` is +exactly the same as `{ left = 2, right = 2 }` + +`separator` and `separator_active` take string or table to define the separators +surrounding non-active and active tab respectively. When `separator_active` is +`nil`, it falls back to `separator`. They require three keys `left`, `right`, +and `override` which define how the separators of neighboring tabs are merged +together. The following four options are available for `override`. The examples +show the result of `{ left = "/", right = "\", override = ... }` + 'nil' : never merged / ~ \/ ~ \/ ~ \... + '"right"' : all merged to the right / ~ \ ~ \ ~ \... + '"left"' : all merged to the left / ~ / ~ / ~ /... + '"active"' : merged towards the active tab / ~ / focused tab \ ~ \... +When set to string such as "┃", it is equivalent to +`{ left = "┃", right = "┃", override = "active" }`. + +`show_separator_on_edge` takes a boolean value where `false` (default) hides the +separators on the far left / right. Especially useful when left and right +separator are the same. + 'true' : ┃/ ~ \/ ~ \/ ~ \┃ + 'false' : ┃ ~ \/ ~ \/ ~ ┃ + + +CURRENT WORKING DIRECTORY *neo-tree-cwd* + +By default, Neo-tree will maintain a two-way binding between the cwd of nvim and +the root of the tree. Changing the root in Neo-tree will change the working +directory of nvim and vice versa. + +In the case of a sidebar, this will be synced with the tab working directory +(|tcd|). If you open it in the "current" position, aka netrw style, it will sync +with the window local working directory (|lcd|). + +These defaults can be changed by setting the following options: + +>lua + require("neo-tree").setup({ + filesystem = { + bind_to_cwd = true, -- true creates a 2-way binding between vim's cwd and neo-tree's root + cwd_target = { + sidebar = "tab", -- sidebar is when position = left or right + current = "window" -- current is when position = current + }, + } + }) +< + +In addition to `"tab"` and `"window"`, you can also set the target to `"global"` +for either option, which is the same as using the |cd| command. Setting the target +to `"none"` will prevent neo-tree from setting vim's cwd for that position. + + +FILTERED ITEMS *neo-tree-filtered-items* + +The `filesystem` source has a `filtered_items` section in it's config that +allows you to specify what files and folders should be hidden. By default, any +item identified by these filters will not be visible, but that visibility can +be toggled on and off with a command. Each type of filter has a corresponding +highlight group which will be applied when they are visible, see +|neo-tree-highlights| for details. The following options are available: + +>lua + require("neo-tree").setup({ + filesystem = { + filtered_items = { + visible = false, -- when true, they will just be displayed differently than normal items + hide_dotfiles = true, + hide_gitignored = true, + hide_hidden = true, -- only works on Windows for hidden files/directories + hide_by_name = { + ".DS_Store", + "thumbs.db", + --"node_modules", + }, + hide_by_pattern = { + --"*.meta", + --"*/src/*/tsconfig.json", + }, + always_show = { -- remains visible even if other settings would normally hide it + --".gitignored", + }, + never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show + --".DS_Store", + --"thumbs.db", + }, + never_show_by_pattern = { -- uses glob style patterns + --".null-ls_*", + }, + }, + } + }) +< + +The `visible` option just defines the default value. This value is toggled by +the "toggle_hidden" command, which is mapped to H by default. + +The `hide_dotfiles` option just hides anything that starts with `. `(period). + +The `hide_gitignored` option will query git for the files and folders being +shown, and hide those that are marked as ignored. + +The `hide_hidden` option only will work on Windows using the Windows logic +that determines if a file or directory is hidden. + +The `hide_by_name` option is a list of file/folder names that should be +hidden. This is an exact match. + +The `hide_by_pattern` option uses glob syntax, which is converted to lua +patterns. No guarantees on how it handles advanced patterns. + +The `always_show` option is a list of file/folder names that will always be +visible, even if other settings would normally hide it. This section takes +precedence over all other options except for `never_show`. + +The `never_show` option is the same as `hide_by_name`, except that those items +will remain hidden even if you toggle `visible` to true. This section takes +precedence over the others. + +The `never_show_by_pattern` option is the same as `hide_by_pattern`, except that +those items will remain hidden even if you toggle `visible` to true. This +section takes precedence over the others. + + +NETRW HIJACK BEHAVIOR *neo-tree-netrw-hijack* + +Neo-tree can and does hijack Netrw by default. This is configurable and can be +disabled if you use Netrw, or have other plugins that use Netrw functionality. +This can be controlled by setting the `filesystem.hijack_netrw_behavior` option +to one of: + +disabled Netrw left alone, neo-tree does not handle opening dirs. + +open_default (default) Netrw disabled, opening a directory opens neo-tree + in whatever position is specified in `window.position`. + +open_current Netrw disabled, opening a directory opens within the + window like netrw would, regardless of `window.position`. + +>lua + require("neo-tree").setup({ + filesystem = { + hijack_netrw_behavior = "open_default", + -- "open_current", + -- "disabled", + }) +< + + + + +COMPONENT CONFIGS *neo-tree-component-configs* + +The visual display of a node is made up of a series of components rendered in a +certain order and with certain configuration options. See |neo-tree-components| +for a deeper dive into customizing this aspect. If you wish to configure those +components in a universal way, the best place to do that is in the +`default_component_configs` section of the config. + +For example, to configure indent markers, you can apply your settings in each renderer +for each source, or just do it once in the default_component_configs section: + +>lua + require("neo-tree").setup({ + default_component_configs = { + indent = { + with_markers = true, + indent_marker = "│", + last_indent_marker = "└", + indent_size = 2, + }, + }, + }) +< +See |neo-tree-indent-markers| for more details. + +The default config has more examples of component configuration, use +|NeoTreePasteConfig| to view that default config. + + +GIT STATUS *neo-tree-git-status* + +By default, Neo-tree will attempt to get the git status for files in the +current directory. It will use this information to add markers to the right of +your files, and will set the highlight groups of files and directories. + +To disable this feature entirely, set `enable_git_status = false` in your +config when calling the setup function. To just disable colors on file or +directory names, you can set `use_git_status_colors = false` in the `name` +component of your renderer(s). + +Starting with 2.0, this will display symbols by default. The default symbols +will require a nerd font to be installed. To change these symbols, you can set +the following properties: +>lua + require("neo-tree").setup({ + default_component_configs = { + git_status = { + symbols = { + -- Change type + added = "✚", + deleted = "✖", + modified = "", + renamed = "󰁕", + -- Status type + untracked = "", + ignored = "", + unstaged = "󰄱", + staged = "", + conflict = "", + } + } + } + }) +< +To change the color of these symbols, you can edit the corresponding highlight +groups: + + NeoTreeGitAdded + NeoTreeGitConflict + NeoTreeGitDeleted + NeoTreeGitIgnored + NeoTreeGitModified + NeoTreeGitUntracked + +If you'd like to disable certain symbols, you can set them to an empty string. +For example, it is actually redundant to show the change type if you use the +default behavior of highlighting the file name according to the change type. +The following config will remove those change type symbols: +>lua + require("neo-tree").setup({ + default_component_configs = { + git_status = { + symbols = { + -- Change type + added = "", + deleted = "", + modified = "", + renamed = "", + -- Status type + untracked = "", + ignored = "", + unstaged = "󰄱", + staged = "", + conflict = "", + } + } + } + }) +< + +To revert to the previous behavior of passing the git status through as-is +with codes like `[M ]` for changed/unstaged, and `[ M]` for changed/staged, +you can set the `symbols` property to nil or false: +>lua + require("neo-tree").setup({ + default_component_configs = { + git_status = { + symbols = false + } + } + }) +< +See also: |neo-tree-git-status-source| + + +DIAGNOSTICS *neo-tree-diagnostics* + +By default, Neo-tree will display diagnostic symbols next to files. It will +display the highest severity level for files, and errors only for directories. +If you want to use symbols instead of "E", "W", "I", and H", you'll need to +define those somewhere in your nvim configuration. Here is an example: + +>lua + vim.fn.sign_define("DiagnosticSignError", + {text = " ", texthl = "DiagnosticSignError"}) + vim.fn.sign_define("DiagnosticSignWarn", + {text = " ", texthl = "DiagnosticSignWarn"}) + vim.fn.sign_define("DiagnosticSignInfo", + {text = " ", texthl = "DiagnosticSignInfo"}) + vim.fn.sign_define("DiagnosticSignHint", + {text = "󰌵", texthl = "DiagnosticSignHint"}) +< + +Alternatively, you can also specify the signs and/or highlights in the +neo-tree setup call like this: + +>lua + require("neo-tree").setup({ + default_component_configs = { + diagnostics = { + symbols = { + hint = "H", + info = "I", + warn = "!", + error = "X", + }, + highlights = { + hint = "DiagnosticSignHint", + info = "DiagnosticSignInfo", + warn = "DiagnosticSignWarn", + error = "DiagnosticSignError", + }, + }, + } + }) +> +Anything not specified in the `default_component_configs` will fallback to the +`sign_define` method. + +To disable this feature entirely, set `enable_diagnostics = false` in your +config when calling the setup function. + + +INDENT MARKERS *neo-tree-indent-markers* + +By default, indent markers (aka indent guides) are enabled. In Neo-tree +indent is a component, so to edit indent markers, you can configure the +`indent` component: + +...at the global level: +>lua + require("neo-tree").setup({ + default_component_configs = { + indent = { + with_markers = true, + indent_marker = "│", + last_indent_marker = "└", + indent_size = 2, + }, + }, + }) +< + +...or in each renderer: +>lua + require("neo-tree").setup({ + filesystem = { + renderers = { + directory = { + { + "indent", + with_markers = true, + indent_marker = "│", + last_indent_marker = "└", + indent_size = 2, + }, + -- other components + }, + file = { + { + "indent", + with_markers = true, + indent_marker = "│", + last_indent_marker = "└", + indent_size = 2, + }, + -- other components + }, + } + } + }) +< + +You also can change the marker characters. To do this, you need change +`indent_marker` and `last_indent_marker` settings. + +To change highlight of indent markers, you need configure `NeoTreeIndentMarker` +highlight group. By default, it refers to `Normal` highlight. + + +EXPANDERS *neo-tree-expanders* +Is hightly recommended enable if file nesting is enabled (this is the default +behavior if `with_expanders` is nil). The config can be done inside the `indent` +component: +>lua + require("neo-tree").setup({ + default_component_configs = { + indent = { + with_expanders = true, + expander_collapsed = "", + expander_expanded = "", + expander_highlight = "NeoTreeExpander", + }, + }, + }) +< + +FILE NESTING *neo-tree-file-nesting* + +By default, file nesting is disabled since the `nesting_rules` table is empty. +To enable this feature, fill in the `nesting_rules` table with the following +structure to match files based on their extensions: +>lua + require("neo-tree").setup({ + nesting_rules = { + ["js"] = { "js.map" }, + } + }) +< +This will render: +> + FILENAME.js + FILENAME.js.map + +A more advanced usage are rules with patterns. Those can be mixed with file +extension based rules. In this case the rule key is not evaluated but a +pattern which is defined in a subkey. The pattern is a Lua pattern and can +have captures which can be used for file matching via globs. +If the matching should be case insensitive, add an option ignore_case to the +config: +>lua + require("neo-tree").setup({ + nesting_rules = { + ["package.json"] = { + pattern = "^package%.json$", -- <-- Lua pattern + files = { "package-lock.json", "yarn*" } -- <-- glob pattern + }, + ["go"] = { + pattern = "(.*)%.go$", -- <-- Lua pattern with capture + files = { "%1_test.go" }, -- <-- glob pattern with capture + }, + ["js-extended"] = { + pattern = "(.+)%.js$", + files = { "%1.js.map", "%1.min.js", "%1.d.ts" }, + }, + ["docker"] = { + pattern = "^dockerfile$", + ignore_case = true, + files = { ".dockerignore", "docker-compose.*", "dockerfile*" }, + } + } + }) +< +This will render: +> + FILENAME.js + FILENAME.js.map + FILENAME.min.js + FILENAME.d.ts + + FILENAME.go + FILENAME_test.go + + package.json + package-lock.json + yarn.lock + + Dockerfile + .dockerignore + docker-compose.yml +< + +The default mapping to expand/collapse nested files is . + + +HIGHLIGHTS *neo-tree-highlights* + +The following highlight groups are defined by this plugin. If you set any of +these yourself before the plugin loads, it will not be touched. If they do not +exist, they will be created. + +NeoTreeBufferNumber The buffer number shown in the buffers source. +NeoTreeCursorLine |hl-CursorLine| override in Neo-tree window. +NeoTreeDimText Greyed out text used in various places. +NeoTreeDirectoryIcon Directory icon. +NeoTreeDirectoryName Directory name. +NeoTreeDotfile Used for icons and names when dotfiles are filtered. +NeoTreeFileIcon File icon, when not overridden by devicons. +NeoTreeFileName File name, when not overwritten by another status. +NeoTreeFileNameOpened File name when the file is open. Not used yet. +NeoTreeFilterTerm The filter term, as displayed in the root node. +NeoTreeFloatBorder The border for pop-up windows. +NeoTreeFloatTitle Used for the title text of pop-ups when the border-style + is set to another style than "NC". This is derived + from NeoTreeFloatBorder. +NeoTreeTitleBar Used for the title bar of pop-ups, when the border-style + is set to "NC". This is derived from NeoTreeFloatBorder. +NeoTreeGitAdded File name when the git status is added. +NeoTreeGitConflict File name when the git status is conflict. +NeoTreeGitDeleted File name when the git status is deleted. +NeoTreeGitIgnored File name when the git status is ignored. +NeoTreeGitModified File name when the git status is modified. +NeoTreeGitUnstaged Used for git unstaged symbol. +NeoTreeGitUntracked File name when the git status is untracked. +NeoTreeGitStaged Used for git staged symbol. +NeoTreeHiddenByName Used for icons and names when `hide_by_name` is used. +NeoTreeIndentMarker The style of indentation markers (guides). By default, + the "Normal" highlight is used. +NeoTreeExpander Used for collapsed/expanded icons. +NeoTreeNormal |hl-Normal| override in Neo-tree window. +NeoTreeNormalNC |hl-NormalNC| override in Neo-tree window. +NeoTreeSignColumn |hl-SignColumn| override in Neo-tree window. +NeoTreeStats Used for "stat" columns like size, last modified, etc. +NeoTreeStatsHeader Used for the header (top line) of the above columns. +NeoTreeStatusLine |hl-StatusLine| override in Neo-tree window. +NeoTreeStatusLineNC |hl-StatusLineNC| override in Neo-tree window. +NeoTreeVertSplit |hl-VertSplit| override in Neo-tree window. +NeoTreeWinSeparator |hl-WinSeparator| override in Neo-tree window. +NeoTreeEndOfBuffer |hl-EndOfBuffer| override in Neo-tree window. +NeoTreeRootName The name of the root node. +NeoTreeSymbolicLinkTarget Symbolic link target. +NeoTreeTitleBar Used for the title bar of pop-ups, when the border-style + is set to "NC". This is derived from NeoTreeFloatBorder. +NeoTreeWindowsHidden Used for icons and names that are hidden on Windows. + + +EVENTS *neo-tree-events* + +Events are one way to customize the behavior of Neo-tree. You can add event +handlers to your config in the `event_handlers` section, which should be a list +of objects in the form: + +>lua + { + event = "event_name", + handler = function(arg) + -- do something, the value of arg varies by event. + end, + id = "optional unique id, only meaningful if you want to unsubscribe later" + } +< + +The following events are available: + +"before_render"~ +Fired after items have been collected from the source but before drawing the +nodes of the tree. This is the best place to gather additional data to be used +by components. The argument passed is the state of the source, which is also +passed to components and commands down the line. + +"after_render"~ +Fired after the tree has been rendered. The argument passed is the state of the +source, which is also passed to components and commands down the line. + +"file_added"~ +Fired after a file (or folder) has been created, either by using the "add" +command or by copy and paste. The arg is the full path to the new file. + +"file_deleted"~ +Fired after a file (or folder) has been deleted. The arg is the full path to the +deleted file. + +"file_moved"~ +Fired after a file (or folder) has been moved. The arg is a table containing +`source` and `destination` properties. + +"file_open_requested"~ +Fired just before a file is opened. The arg is a table containing the `state` +of the source being used, the `path` of the file to be opened, and `open_cmd`, +which is the open command that was requested. `open_cmd` will be either |edit|, +|split|, |vsplit|, |tabnew|. This function should return a table with a property called +`handled` which is true if the file open operation was handled, or false if it +was not. If `{ handled = true }` is not returned, the file will be opened using +the built-in logic. + +"file_opened"~ +Fired after a file has been opened. You might use this to auto-close the window +or clear the filter. The arg is the path of the file opened. + +"file_renamed"~ +Fired after a file (or folder) has been renamed. The arg is an table containing +`source` and `destination` properties. + +"neo_tree_buffer_enter"~ +Fired after entering a neo-tree buffer. It is also right after neo-tree applies +it's own settings, so it's the ideal place to apply any local settings you would +like to have. + +"neo_tree_buffer_leave"~ +Fired after a neo-tree buffer was exited. Technically it fires when entering a +buffer that is not neo-tree, when the last buffer enter event was neo-tree. + +"neo_tree_popup_buffer_enter"~ +Fired after entering a neo-tree popup buffer. This includes things such as file +rename prompts and filter inputs. It runs right after neo-tree applies it's own +settings, so it's the ideal place to apply any local settings you would like to +have. + +"neo_tree_popup_buffer_leave"~ +Fired after leaving a neo-tree popup buffer. + +"neo_tree_popup_input_ready"~ +Fired after NuiInput is ready. Use this event to default to normal mode etc. +This is fired inside a vim.schedule. + +>lua + { + event = "neo_tree_popup_input_ready", + handler = function() + -- enter input popup with normal mode by default. + vim.cmd("stopinsert") + end, + }, + { + event = "neo_tree_popup_input_ready", + ---@param args { bufnr: integer, winid: integer } + handler = function(args) + -- map to enter normal mode (by default closes prompt) + -- don't forget `opts.buffer` to specify the buffer of the popup. + vim.keymap.set("i", "", vim.cmd.stopinsert, { noremap = true, buffer = args.bufnr }) + end, + } +< + +"neo_tree_window_before_open"~ +Fired before opening a new Neo-tree window. Called with the following arg: + *neo-tree-window-event-args* +The event argument for all window events is a table with the following keys: + `winid` = the |winid| of the window being opened or closed. + `tabid` = id of the tab that the window is in. + `tabnr` = (deprecated) number of the tab that the window is in. + `source` = the name of the source that is in the window, such as "filesystem". + `position` = the position of the window, i.e. "left", "bottom", "right". + +"neo_tree_window_after_open"~ +Fired after opening a new Neo-tree window. Called with +|neo-tree-window-event-args|. + +"neo_tree_window_before_close"~ +Fired before closing a Neo-tree window. Called with +|neo-tree-window-event-args|. + +"neo_tree_window_after_close"~ +Fired after closing a Neo-tree window. Called with +|neo-tree-window-event-args|. + +NOTE: The following events are used internally and not intended for end user +usage. You can use them if you want, but beware that they may be debounced, and +the details of how frequently they are fired and what events are dropped will be +changed without warning. + +"vim_diagnostic_changed"~ +Fired on the |DiagnosticChanged| autocmd event. The arg is a table with one +property: `diagnostics_lookup`, which is a table where the keys are file names +and the values are tables with diagnostic counts by severity level. + +"vim_buffer_changed"~ +Fired on the following autocmd events: |BufDelete|, |BufWritePost|, +|BufFilePost|, |BufNew| + +"vim_buffer_enter"~ +Fired on the following autocmd events: |BufEnter|, |BufWinEnter| + +"vim_dir_changed"~ +Fired on the |DirChanged| autocmd event + +"vim_win_enter"~ +Fired on the |WinEnter| autocmd event + +"vim_colorscheme"~ +Fired on the |ColorScheme| autocmd event + + +You can also define your own with: +> +>lua + require("neo-tree.events.queue").define_event(event_name, { + setup = , + seed = , + teardown = , + debounce_frequency = , + once = , + cancelled = + }) +< + +The setup function is run the first time the event is subscribed to. For an +autocmd event, this would define the vim autocmd to connect it to fire_event(). + +The `seed` function is run at the beginning of every event firing. The diagnostics +event uses this to collect the diagnostic information and pass it to all +subscribers. + +The `teardown` function is used when the last subscriber unsubscribes, and cleans +up. This is like Dispose in other languages. + +`debounce_frequency` is the minimum number of milliseconds between each invocation +of the event. The first event is guaranteed to fire, as well as the last one, but +in between events may be dropped if this is set to a number greater than zero. + +`once` means to only fire this event handler once then mark it as `cancelled`. + +`cancelled` means that this event handler will be skipped in all future event +fires, and will be discarded on the next cleanup of the queue. + + +COMPONENTS AND RENDERERS *neo-tree-renderers* + +A renderer is just a list of component configs, to be rendered in order to +create a line in the tree. Each renderer is for a specific node type, such as +`directory` or `file`. To view the available built-in components and their +configs for each source, look at the default config by pasting it with +>vim + :lua require("neo-tree").paste_default_config() +< +or view it online at: +https://github.com/nvim-neo-tree/neo-tree.nvim/blob/v3.x/lua/neo-tree/defaults.lua + +A default `renderers` config is specified at the root level and will be used +by each source unless another renderer is defined. If you just want to +rearrange or remove components, you can do so by changing these `renderers` +configs. + + *neo-tree-components* +A component is a function that returns a single text object: +>lua + { + text = "Node A", + highlight = "Normal" + } +< + +... or a list of text objects: +>lua + { + { + text = "Node Name", + highlight = "Directory" + }, + { + text = "[", + highlight = "Comment" + }, + { + text = "I'm Special!", + highlight = "SpecialChar" + }, + text = "[", + highlight = "Comment" + } + } +< + +The only reason to return a list of objects is to use multiple highlight groups. +These components and renderers are defined per source by passing them in the +setup. If you define a component with the same name of a built-in component, it +will replace that built-in component. Otherwise it will be added to the existing +set of components. + +CONTAINER *neo-tree-container* + +One unique component that deserves some explanation is the `container` +component. This component allows you to create more complex layouts where +components can overlap, have a specific size, or be right aligned. A container +has the following properties: + +width~ +Width can be specified as a number, meaning actual number of characters, a +string containing a percentage such as `"100%"`, or the special string +`"fit_content"`. The percentage value means percentage of remaining space in +the window. If a window is 40 columns wide, and the rendered content for the +node so far equals 15 characters, then 100% would evaluate to 25 characters. + +The `"fit_content"` value means that it will be the width of the largest +layer. See `zindex` for details about layers. + +If the current position is "current", meaning it is being displayed in a split +instead of as a sidebar, the available width will be calculated as the longest +node name + indent + 8 characters. This is to prevent right aligned components +from being too far away from the node name. + +min_width / max_width~ +This constrains the value of width, useful when the `width` is set to a +percentage or `"fit_content"`. + +content~ +This is a list of components that will be arranged by this container. + +Each component in the content list can use these additional properties: + + zindex~ + All components with the same zindex will be rendered together in the same + layer, one after the other. Higher zindex value are rendered on top of other + layers, hiding whatever is beneath them. For example, if a component with a + zindex of 10 produces this: +> + "abcdefg" +< + and another component width a zindex of 20 produces this: +> + "1234" +< + then the result will be: +> + "1234efg" +< + + align~ + If align is right, then it will be pushed to the right edge of the available + space. This makes the most sense when the container width is set to a number + or `"100%"`. Components that are right aligned will automatically overlap left + aligned components with the same zindex if there is not enough space. + + Continuing with the example from above, if there was a `"right"` aligned + component with a zindex of 20 that outputs: +> + "**"" +< + Then the result when a container has a width of 12 would be: +> + "1234efg **" +< + but if the width was 8 then the result would be: +> + "1234ef**" +< + +Example~ + +This example container has the name on the left hand side, and the +diagnostics and git status aligned to the right hand side of the window. The +diagnostics and git_status will always be shown, and the name will be clipped if +there is not enough space: +>lua + { + "container", + width = "100%", + right_padding = 1, + content = { + { + "name", + use_git_status_colors = true, + zindex = 10 + }, + { "diagnostics", zindex = 20, align = "right" }, + { "git_status", zindex = 20, align = "right" }, + }, + } +< + + +CUSTOM COMPONENTS + +Each component function is called with the following args: + `config` The config object defined in the renderer. This is how a component + can be made to be configurable. This is useful if you want different behavior + in a directory renderer vs a file renderer. The config is a combination of any + options specified in the default_component_configs + (|neo-tree-default-component-configs|), which can be overridden by settings + specified within each renderer config. + + `node` The NuiNode object for this node. The properties can vary by source, but + each one will generally have at least id and name properties. + + `state` This is the state of the plugin. This object is persistent for the + life of the source, with one state object per source per tab. the entirety of + all state and source level configuration is in this one object. Aside from + configuration, it can also hold anything you may want to set in a + "before_render" event. + +For example, here is the simplest possible component: + +>lua + require("neo-tree").setup({ + filesystem = { + components = { + + name = function(config, node) + return { + text = node.name, + highlight = "NeoTreeFileName" + } + end + + } + } + }) +< + +For a more complete example, here is the actual built-in `name` component, which +is much more dynamic and configurable: + +>lua + require("neo-tree").setup({ + filesystem = { + components = { + + name = function(config, node, state) + local highlight = config.highlight or highlights.FILE_NAME + if node.type == "directory" then + highlight = highlights.DIRECTORY_NAME + end + if node:get_depth() == 1 then + highlight = highlights.ROOT_NAME + else + if config.use_git_status_colors == nil or config.use_git_status_colors then + local git_status = state.components.git_status({}, node, state) + if git_status and git_status.highlight then + highlight = git_status.highlight + end + end + end + return { + text = node.name, + highlight = highlight, + } + end + + } + } + }) +< + + +BUFFER VARIABLES *neo-tree-buffer-variables* + +Neo-tree sets certain buffer options and variables that you may use in custom +code or integrations if you need it. The |filetype| of the main window is +`neo-tree`. The buffer will also have these local variables set: + +`winid` The window handle of the window that it was created in. +`tabid` The id of the tab that it was created in. +`tabnr` (deprecated) The number of the tab that it was created in. +`source` The name of the source that created it, i.e. filesystem, buffers, etc. + +Please note that if the buffer is displayed in another window or tab, it's +behavior is unpredictable. It is meant to be locked to it's original location, +which is why those variables are recorded. + + +POPUPS *neo-tree-popups* + +Popups will be created with a |filetype| of `neo-tree-popup`. You can use this +as the target for autocmds or to exclude them from being acted upon by other +plugins. + +They can also be configured by setting the `popup_border_style` in your config, +and the colors of that border are controlled by the `NeoTreeFloatBorder` +highlight group. If you you use the special `NC` option for +`popup_border_style`, the title bar of that popup uses the `NeoTreeTitleBar` +highlight group. + + +================================================================================ +OTHER SOURCES ~ +================================================================================ + *neo-tree-sources* + +Neo-tree supports other sources beside the filesystem source which is used by +default. The rest of the sources follow the same pattern as the filesystem +sources described above. The following sections will give an overview of each +source and describe the options that are unique to those sources. + + +BUFFERS *neo-tree-buffers* + +The buffers source shows all open buffers. This is the same list that |ls| would +show. This view adds one component, which is the buffer number, shown to the +right of the file name by default. + +If you use sessions, your previously loaded buffers may be saved as part of +the session, but they will be unloaded at first. If you want to see these +unloaded buffers, set `show_unloaded = true` in your `buffers` config. +Otherwise, you will only see the buffers that have been opened since starting +nvim. + +As a list of files, this source shares most of the commands with the filesystem +source, with the exception of filtering. Some of these commands make less +sense to use here, as things like adding new files won't be visible until you +open them by some other means. One command that is unique to this view is +`buffer_delete`, which issues |:bdelete| on the selected buffer. This is mapped +to `bd` by default. + + +GIT STATUS *neo-tree-git-status-source* + +The git_status view shows the output of the `git status` command in the tree. +Unlike the other sources, this will always show the project root of the +current working directory. If the working tree is clean, this view will be +empty. + +This view has most file commands except for "add", plus the following git +specific commands: +>lua + ["A"] = "git_add_all", + ["ga"] = "git_add_file", + ["gu"] = "git_unstage_file", + ["gr"] = "git_revert_file", + ["gc"] = "git_commit" + ["gp"] = "git_push", + ["gg"] = "git_commit_and_push", +< + +DOCUMENT SYMBOLS *neo-tree-document-symbols* + +The document_symbols source lists the symbols in the current document obtained +by the LSP request "textDocument/documentSymbols". + +Its configuration includes the following options: + +follow_cursor~ +If set to `true`, will automatically focus on the symbol under the cursor. + +kinds~ +A table specifying how LSP kinds should be rendered. Each entry should map the +LSP kind name to an icon and a highlight group, for example + `Class = { icon = "󰌗", hl = "Include" }` + +custom_kinds~ +A table mapping the LSP kind id (an integer) to the LSP kind name that is used +for `kinds`, for example + `[252] = 'TypeAlias'` + +For the list of kinds (id and name), please refer to +https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentSymbol + +client_filters~ +This option could be used to set which LSP server is used to obtain the document +symbols. This accepts one of the following values + + `"first"`: use the first LSP server that provides the feature + `"all"`: use all LSP server that provides the feature + `{ fn = function(name), allow_only = table, ignore = table }` where + `fn`: a function that returns `true` if the server `name` should be used + `allow_only`: use only servers from this list + `ignore`: exclude all servers from this list + NOTE: `fn` preceeds `allow_only` preceeds `ignore` + +For example: (NOTE: here only `fn` will be taken into account) +>lua + { + fn = function(name) return name ~= "null-ls" end, + allow_only = { "clangd", "lua_ls" }, + ignore = { "pyright" }, + } +< +Currently, this source supports the following commands: +>lua + ["o"] = "jump_to_symbol", + ["r"] = "rename", + ["P"] = "preview", (and related commands) + ["s"] = "split", (and related commands) +< +vim:tw=80:ts=2:et:ft=help: diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/doc/tags b/config/neovim/store/lazy-plugins/neo-tree.nvim/doc/tags new file mode 100644 index 00000000..223cd51d --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/doc/tags @@ -0,0 +1,43 @@ +:Neotree neo-tree.txt /*:Neotree* +any neo-tree.txt /*any* +neo-tree neo-tree.txt /*neo-tree* +neo-tree-buffer-variables neo-tree.txt /*neo-tree-buffer-variables* +neo-tree-buffers neo-tree.txt /*neo-tree-buffers* +neo-tree-commands neo-tree.txt /*neo-tree-commands* +neo-tree-component-configs neo-tree.txt /*neo-tree-component-configs* +neo-tree-components neo-tree.txt /*neo-tree-components* +neo-tree-configuration neo-tree.txt /*neo-tree-configuration* +neo-tree-container neo-tree.txt /*neo-tree-container* +neo-tree-custom-commands neo-tree.txt /*neo-tree-custom-commands* +neo-tree-custom-commands-global neo-tree.txt /*neo-tree-custom-commands-global* +neo-tree-custom-mappings neo-tree.txt /*neo-tree-custom-mappings* +neo-tree-custom-mappings-args neo-tree.txt /*neo-tree-custom-mappings-args* +neo-tree-custom-mappings-config neo-tree.txt /*neo-tree-custom-mappings-config* +neo-tree-custom-mappings-visual neo-tree.txt /*neo-tree-custom-mappings-visual* +neo-tree-cwd neo-tree.txt /*neo-tree-cwd* +neo-tree-diagnostics neo-tree.txt /*neo-tree-diagnostics* +neo-tree-document-symbols neo-tree.txt /*neo-tree-document-symbols* +neo-tree-events neo-tree.txt /*neo-tree-events* +neo-tree-expanders neo-tree.txt /*neo-tree-expanders* +neo-tree-file-actions neo-tree.txt /*neo-tree-file-actions* +neo-tree-file-nesting neo-tree.txt /*neo-tree-file-nesting* +neo-tree-filter neo-tree.txt /*neo-tree-filter* +neo-tree-filtered-items neo-tree.txt /*neo-tree-filtered-items* +neo-tree-git-status neo-tree.txt /*neo-tree-git-status* +neo-tree-git-status-source neo-tree.txt /*neo-tree-git-status-source* +neo-tree-help neo-tree.txt /*neo-tree-help* +neo-tree-highlights neo-tree.txt /*neo-tree-highlights* +neo-tree-indent-markers neo-tree.txt /*neo-tree-indent-markers* +neo-tree-introduction neo-tree.txt /*neo-tree-introduction* +neo-tree-mappings neo-tree.txt /*neo-tree-mappings* +neo-tree-navigation neo-tree.txt /*neo-tree-navigation* +neo-tree-netrw-hijack neo-tree.txt /*neo-tree-netrw-hijack* +neo-tree-popups neo-tree.txt /*neo-tree-popups* +neo-tree-preview-mode neo-tree.txt /*neo-tree-preview-mode* +neo-tree-renderers neo-tree.txt /*neo-tree-renderers* +neo-tree-setup neo-tree.txt /*neo-tree-setup* +neo-tree-source-selector neo-tree.txt /*neo-tree-source-selector* +neo-tree-sources neo-tree.txt /*neo-tree-sources* +neo-tree-view-changes neo-tree.txt /*neo-tree-view-changes* +neo-tree-window-event-args neo-tree.txt /*neo-tree-window-event-args* +neo-tree.txt neo-tree.txt /*neo-tree.txt* diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree.lua new file mode 100644 index 00000000..f3decadd --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree.lua @@ -0,0 +1,89 @@ +local vim = vim +local utils = require("neo-tree.utils") +local log = require("neo-tree.log") +local M = {} + +-- DEPRECATED: to be removed in a future release, use this instead: +-- ``` +-- require("neo-tree.command").execute({ action = "close" }) +-- ``` +M.close_all = function() + require("neo-tree.command").execute({ action = "close" }) +end + +M.ensure_config = function() + if not M.config then + M.setup({ log_to_file = false }, true) + end +end + +M.get_prior_window = function(ignore_filetypes, ignore_winfixbuf) + ignore_filetypes = ignore_filetypes or {} + local ignore = utils.list_to_dict(ignore_filetypes) + ignore["neo-tree"] = true + + local tabid = vim.api.nvim_get_current_tabpage() + local wins = utils.get_value(M, "config.prior_windows", {}, true)[tabid] + if wins == nil then + return -1 + end + local win_index = #wins + while win_index > 0 do + local last_win = wins[win_index] + if type(last_win) == "number" then + local success, is_valid = pcall(vim.api.nvim_win_is_valid, last_win) + if success and is_valid and not (ignore_winfixbuf and utils.is_winfixbuf(last_win)) then + local buf = vim.api.nvim_win_get_buf(last_win) + local ft = vim.api.nvim_buf_get_option(buf, "filetype") + local bt = vim.api.nvim_buf_get_option(buf, "buftype") or "normal" + if ignore[ft] ~= true and ignore[bt] ~= true then + return last_win + end + end + end + win_index = win_index - 1 + end + return -1 +end + +M.paste_default_config = function() + local base_path = debug.getinfo(utils.truthy).source:match("@(.*)/utils/init.lua$") + local config_path = base_path .. utils.path_separator .. "defaults.lua" + local lines = vim.fn.readfile(config_path) + if lines == nil then + error("Could not read neo-tree.defaults") + end + + -- read up to the end of the config, jut to omit the final return + local config = {} + for _, line in ipairs(lines) do + table.insert(config, line) + if line == "}" then + break + end + end + + vim.api.nvim_put(config, "l", true, false) + vim.schedule(function() + vim.cmd("normal! `[v`]=") + end) +end + +M.set_log_level = function(level) + log.set_level(level) +end + +M.setup = function(config, is_auto_config) + M.config = require("neo-tree.setup").merge_config(config, is_auto_config) + local netrw = require("neo-tree.setup.netrw") + if not is_auto_config and netrw.get_hijack_netrw_behavior() ~= "disabled" then + vim.cmd("silent! autocmd! FileExplorer *") + netrw.hijack() + end +end + +M.show_logs = function() + vim.cmd("tabnew " .. log.outfile) +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/collections.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/collections.lua new file mode 100644 index 00000000..899f438c --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/collections.lua @@ -0,0 +1,127 @@ +local log = require("neo-tree.log") + +local Node = {} +function Node:new(value) + local props = { prev = nil, next = nil, value = value } + setmetatable(props, self) + self.__index = self + return props +end + +local LinkedList = {} +function LinkedList:new() + local props = { head = nil, tail = nil, size = 0 } + setmetatable(props, self) + self.__index = self + return props +end + +function LinkedList:add_node(node) + if self.head == nil then + self.head = node + self.tail = node + else + self.tail.next = node + node.prev = self.tail + self.tail = node + end + self.size = self.size + 1 + return node +end + +function LinkedList:remove_node(node) + if node.prev ~= nil then + node.prev.next = node.next + end + if node.next ~= nil then + node.next.prev = node.prev + end + if self.head == node then + self.head = node.next + end + if self.tail == node then + self.tail = node.prev + end + self.size = self.size - 1 + node.prev = nil + node.next = nil + node.value = nil +end + +-- First in Last Out +local Queue = {} +function Queue:new() + local props = { _list = LinkedList:new() } + setmetatable(props, self) + self.__index = self + return props +end + +---Add an element to the end of the queue. +---@param value any The value to add. +function Queue:add(value) + self._list:add_node(Node:new(value)) +end + +---Iterates over the entire list, running func(value) on each element. +---If func returns true, the element is removed from the list. +---@param func function The function to run on each element. +function Queue:for_each(func) + local node = self._list.head + while node ~= nil do + local result = func(node.value) + local node_is_next = false + if result then + if type(result) == "boolean" then + local node_to_remove = node + node = node.next + node_is_next = true + self._list:remove_node(node_to_remove) + elseif type(result) == "table" then + if type(result.handled) == "boolean" and result.handled == true then + log.trace( + "Handler ", + node.value.id, + " for " + .. node.value.event + .. " returned handled = true, skipping the rest of the queue." + ) + return result + end + end + end + if not node_is_next then + node = node.next + end + end +end + +function Queue:is_empty() + return self._list.size == 0 +end + +function Queue:remove_by_id(id) + local current = self._list.head + while current ~= nil do + local is_match = false + local item = current.value + if item ~= nil then + local item_id = item.id or item + if item_id == id then + is_match = true + end + end + if is_match then + local next = current.next + self._list:remove_node(current) + current = next + else + current = current.next + end + end +end + +return { + Queue = Queue, + LinkedList = LinkedList, +} diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/command/completion.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/command/completion.lua new file mode 100644 index 00000000..5405719d --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/command/completion.lua @@ -0,0 +1,122 @@ +local parser = require("neo-tree.command.parser") +local utils = require("neo-tree.utils") + +local M = { + show_key_value_completions = true, +} + +local get_path_completions = function(key_prefix, base_path) + key_prefix = key_prefix or "" + local completions = {} + local expanded = parser.resolve_path(base_path) + local path_completions = vim.fn.glob(expanded .. "*", false, true) + for _, completion in ipairs(path_completions) do + if expanded ~= base_path then + -- we need to recreate the relative path from the aboluste path + -- first strip trailing slashes to normalize + if expanded:sub(-1) == utils.path_separator then + expanded = expanded:sub(1, -2) + end + if base_path:sub(-1) == utils.path_separator then + base_path = base_path:sub(1, -2) + end + -- now put just the current completion onto the base_path being used + completion = base_path .. string.sub(completion, #expanded + 1) + end + table.insert(completions, key_prefix .. completion) + end + + return table.concat(completions, "\n") +end + +local get_ref_completions = function(key_prefix) + key_prefix = key_prefix or "" + local completions = { key_prefix .. "HEAD" } + local ok, refs = utils.execute_command("git show-ref") + if not ok then + return "" + end + for _, ref in ipairs(refs) do + local _, i = ref:find("refs%/%a+%/") + if i then + table.insert(completions, key_prefix .. ref:sub(i + 1)) + end + end + + return table.concat(completions, "\n") +end + +M.complete_args = function(argLead, cmdLine) + local candidates = {} + local existing = utils.split(cmdLine, " ") + local parsed = parser.parse(existing, false) + + local eq = string.find(argLead, "=") + if eq == nil then + if M.show_key_value_completions then + -- may be the start of a new key=value pair + for _, key in ipairs(parser.list_args) do + key = tostring(key) + if key:find(argLead, 1, true) and not parsed[key] then + table.insert(candidates, key .. "=") + end + end + + for _, key in ipairs(parser.path_args) do + key = tostring(key) + if key:find(argLead, 1, true) and not parsed[key] then + table.insert(candidates, key .. "=./") + end + end + + for _, key in ipairs(parser.ref_args) do + key = tostring(key) + if key:find(argLead, 1, true) and not parsed[key] then + table.insert(candidates, key .. "=") + end + end + end + else + -- continuation of a key=value pair + local key = string.sub(argLead, 1, eq - 1) + local value = string.sub(argLead, eq + 1) + local arg_type = parser.arg_type_lookup[key] + if arg_type == parser.PATH then + return get_path_completions(key .. "=", value) + elseif arg_type == parser.REF then + return get_ref_completions(key .. "=") + elseif arg_type == parser.LIST then + local valid_values = parser.arguments[key].values + if valid_values and not parsed[key] then + for _, vv in ipairs(valid_values) do + if vv:find(value) then + table.insert(candidates, key .. "=" .. vv) + end + end + end + end + end + + -- may be a value without a key + for value, key in pairs(parser.reverse_lookup) do + value = tostring(value) + local key_already_used = false + if parser.arg_type_lookup[key] == parser.LIST then + key_already_used = type(parsed[key]) ~= "nil" + else + key_already_used = type(parsed[value]) ~= "nil" + end + + if not key_already_used and value:find(argLead, 1, true) then + table.insert(candidates, value) + end + end + + if #candidates == 0 then + -- default to path completion + return get_path_completions(nil, argLead) .. "\n" .. get_ref_completions(nil) + end + return table.concat(candidates, "\n") +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/command/init.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/command/init.lua new file mode 100644 index 00000000..a2e7b6b5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/command/init.lua @@ -0,0 +1,236 @@ +local parser = require("neo-tree.command.parser") +local log = require("neo-tree.log") +local manager = require("neo-tree.sources.manager") +local utils = require("neo-tree.utils") +local renderer = require("neo-tree.ui.renderer") +local inputs = require("neo-tree.ui.inputs") +local completion = require("neo-tree.command.completion") +local do_show_or_focus, handle_reveal + +local M = { + complete_args = completion.complete_args, +} + +-- Store the last source used for `M.execute` +M._last = { + source = nil, + position = nil, +} + +---Executes a Neo-tree action from outside of a Neo-tree window, +---such as show, hide, navigate, etc. +---@param args table The action to execute. The table can have the following keys: +--- action = string The action to execute, can be one of: +--- "close", +--- "focus", <-- default value +--- "show", +--- source = string The source to use for this action. This will default +--- to the default_source specified in the user's config. +--- Can be one of: +--- "filesystem", +--- "buffers", +--- "git_status", +-- "migrations" +--- position = string The position this action will affect. This will default +--- to the the last used position or the position specified +--- in the user's config for the given source. Can be one of: +--- "left", +--- "right", +--- "float", +--- "current" +--- toggle = boolean Whether to toggle the visibility of the Neo-tree window. +--- reveal = boolean Whether to reveal the current file in the Neo-tree window. +--- reveal_file = string The specific file to reveal. +--- dir = string The root directory to set. +--- git_base = string The git base used for diff +M.execute = function(args) + local nt = require("neo-tree") + nt.ensure_config() + + if args.source == "migrations" then + require("neo-tree.setup.deprecations").show_migrations() + return + end + + args.action = args.action or "focus" + + -- handle close action, which can specify a source and/or position + if args.action == "close" then + if args.source then + manager.close(args.source, args.position) + else + manager.close_all(args.position) + end + return + end + + -- The rest of the actions require a source + args.source = args.source or nt.config.default_source + + -- Handle source=last + if args.source == "last" then + args.source = M._last.source or nt.config.default_source + + -- Restore last position if it was not specified + if args.position == nil then + args.position = M._last.position + end + + -- Prevent the default source from being set to "last" + if args.source == "last" then + args.source = nt.config.sources[1] + end + end + M._last.source = args.source + M._last.position = args.position + + -- If position=current was requested, but we are currently in a neo-tree window, + -- then we need to override that. + if args.position == "current" and vim.bo.filetype == "neo-tree" then + local position = vim.api.nvim_buf_get_var(0, "neo_tree_position") + if position then + args.position = position + end + end + + -- Now get the correct state + local state + local requested_position = args.position or nt.config[args.source].window.position + if requested_position == "current" then + local winid = vim.api.nvim_get_current_win() + state = manager.get_state(args.source, nil, winid) + else + state = manager.get_state(args.source, nil, nil) + end + + -- Next handle toggle, the rest is irrelevant if there is a window to toggle + if args.toggle then + if renderer.close(state) then + -- It was open, and now it's not. + return + end + end + + -- Handle position override + local default_position = nt.config[args.source].window.position + local current_position = state.current_position or default_position + local position_changed = false + if args.position then + state.current_position = args.position + position_changed = args.position ~= current_position + end + + -- Handle setting directory if requested + local path_changed = false + if utils.truthy(args.dir) then + -- Root paths on Windows have 3 characters ("C:\") + local root_len = vim.fn.has("win32") == 1 and 3 or 1 + if #args.dir > root_len and args.dir:sub(-1) == utils.path_separator then + args.dir = args.dir:sub(1, -2) + end + path_changed = state.path ~= args.dir + else + args.dir = state.path + end + + -- Handle setting git ref + local git_base_changed = state.git_base ~= args.git_base + if utils.truthy(args.git_base) then + state.git_base = args.git_base + end + + -- Handle source selector option + state.enable_source_selector = args.selector + + -- Handle reveal logic + args.reveal = args.reveal or args.reveal_force_cwd + local do_reveal = utils.truthy(args.reveal_file) + if args.reveal and not do_reveal then + args.reveal_file = manager.get_path_to_reveal() + do_reveal = utils.truthy(args.reveal_file) + end + + -- All set, now show or focus the window + local force_navigate = path_changed or do_reveal or git_base_changed or state.dirty + --if position_changed and args.position ~= "current" and current_position ~= "current" then + -- manager.close(args.source) + --end + if do_reveal then + args.reveal_file = utils.normalize_path(args.reveal_file) + handle_reveal(args, state) + else + do_show_or_focus(args, state, force_navigate) + end +end + +---Parses and executes the command line. Use execute(args) instead. +---@param ... string Argument as strings. +M._command = function(...) + local args = parser.parse({ ... }, true) + M.execute(args) +end + +do_show_or_focus = function(args, state, force_navigate) + local window_exists = renderer.window_exists(state) + local function close_other_sources() + if not window_exists then + -- Clear the space in case another source is already open + local target_position = args.position or state.current_position or state.window.position + if target_position ~= "current" then + manager.close_all(target_position) + end + end + end + + if args.action == "show" then + -- "show" means show the window without focusing it + if window_exists and not force_navigate then + -- There's nothing to do here, we are already at the target state + return + end + -- close_other_sources() + local current_win = vim.api.nvim_get_current_win() + manager.navigate(state, args.dir, args.reveal_file, function() + -- navigate changes the window to neo-tree, so just quickly hop back to the original window + vim.api.nvim_set_current_win(current_win) + end, false) + elseif args.action == "focus" then + -- "focus" mean open and jump to the window if closed, and just focus it if already opened + if window_exists then + vim.api.nvim_set_current_win(state.winid) + end + if force_navigate or not window_exists then + -- close_other_sources() + manager.navigate(state, args.dir, args.reveal_file, nil, false) + end + end +end + +handle_reveal = function(args, state) + -- Deal with cwd if we need to + local cwd = state.path + local path = args.reveal_file + if cwd == nil then + cwd = manager.get_cwd(state) + end + if args.reveal_force_cwd and not utils.is_subpath(cwd, path) then + args.dir, _ = utils.split_path(path) + do_show_or_focus(args, state, true) + return + elseif not utils.is_subpath(cwd, path) then + -- force was not specified, so we need to ask the user + cwd, _ = utils.split_path(path) + inputs.confirm("File not in cwd. Change cwd to " .. cwd .. "?", function(response) + if response == true then + args.dir = cwd + else + args.reveal_file = nil + end + do_show_or_focus(args, state, true) + end) + return + else + do_show_or_focus(args, state, true) + end +end +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/command/parser.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/command/parser.lua new file mode 100644 index 00000000..9b3229f2 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/command/parser.lua @@ -0,0 +1,180 @@ +local utils = require("neo-tree.utils") + +local M = { + FLAG = "", + LIST = "", + PATH = "", + REF = "", +} + +M.setup = function(all_source_names) + local source_names = utils.table_copy(all_source_names) + table.insert(source_names, "migrations") + + -- A special source referring to the last used source. + table.insert(source_names, "last") + + -- For lists, the first value is the default value. + local arguments = { + action = { + type = M.LIST, + values = { + "close", + "focus", + "show", + }, + }, + position = { + type = M.LIST, + values = { + "left", + "right", + "top", + "bottom", + "float", + "current", + }, + }, + source = { + type = M.LIST, + values = source_names, + }, + dir = { type = M.PATH, stat_type = "directory" }, + reveal_file = { type = M.PATH, stat_type = "file" }, + git_base = { type = M.REF }, + toggle = { type = M.FLAG }, + reveal = { type = M.FLAG }, + reveal_force_cwd = { type = M.FLAG }, + selector = { type = M.FLAG }, + } + + local arg_type_lookup = {} + local list_args = {} + local path_args = {} + local ref_args = {} + local flag_args = {} + local reverse_lookup = {} + for name, def in pairs(arguments) do + arg_type_lookup[name] = def.type + if def.type == M.LIST then + table.insert(list_args, name) + for _, vv in ipairs(def.values) do + reverse_lookup[tostring(vv)] = name + end + elseif def.type == M.PATH then + table.insert(path_args, name) + elseif def.type == M.FLAG then + table.insert(flag_args, name) + reverse_lookup[name] = M.FLAG + elseif def.type == M.REF then + table.insert(ref_args, name) + else + error("Unknown type: " .. def.type) + end + end + + M.arguments = arguments + M.list_args = list_args + M.path_args = path_args + M.ref_args = ref_args + M.flag_args = flag_args + M.arg_type_lookup = arg_type_lookup + M.reverse_lookup = reverse_lookup +end + +M.resolve_path = function(path, validate_type) + path = vim.fs.normalize(path) + local expanded = vim.fn.expand(path) + local abs_path = vim.fn.fnamemodify(expanded, ":p") + if validate_type then + local stat = vim.loop.fs_stat(abs_path) + if stat.type ~= validate_type then + error("Invalid path: " .. path .. " is not a " .. validate_type) + end + end + return abs_path +end + +M.verify_git_ref = function(ref) + local ok, _ = utils.execute_command("git rev-parse --verify " .. ref) + return ok +end + +local parse_arg = function(result, arg) + if type(arg) == "string" then + local eq = arg:find("=") + if eq then + local key = arg:sub(1, eq - 1) + local value = arg:sub(eq + 1) + local def = M.arguments[key] + if not def.type then + error("Invalid argument: " .. arg) + end + + if def.type == M.PATH then + result[key] = M.resolve_path(value, def.stat_type) + elseif def.type == M.FLAG then + if value == "true" then + result[key] = true + elseif value == "false" then + result[key] = false + else + error("Invalid value for " .. key .. ": " .. value) + end + elseif def.type == M.REF then + if not M.verify_git_ref(value) then + error("Invalid value for " .. key .. ": " .. value) + end + result[key] = value + else + result[key] = value + end + else + local value = arg + local key = M.reverse_lookup[value] + if key == nil then + -- maybe it's a git ref + if M.verify_git_ref(value) then + result["git_base"] = value + return + end + -- maybe it's a path + local path = M.resolve_path(value) + local stat = vim.loop.fs_stat(path) + if stat then + if stat.type == "directory" then + result["dir"] = path + elseif stat.type == "file" then + result["reveal_file"] = path + end + else + error("Invalid argument: " .. arg) + end + elseif key == M.FLAG then + result[value] = true + else + result[key] = value + end + end + end +end + +M.parse = function(args, strict_checking) + require("neo-tree").ensure_config() + local result = {} + + if type(args) == "string" then + args = utils.split(args, " ") + end + -- read args from user + for _, arg in ipairs(args) do + local success, err = pcall(parse_arg, result, arg) + if strict_checking and not success then + error(err) + end + end + + return result +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/defaults.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/defaults.lua new file mode 100644 index 00000000..733dcc07 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/defaults.lua @@ -0,0 +1,683 @@ +local config = { + -- If a user has a sources list it will replace this one. + -- Only sources listed here will be loaded. + -- You can also add an external source by adding it's name to this list. + -- The name used here must be the same name you would use in a require() call. + sources = { + "filesystem", + "buffers", + "git_status", + -- "document_symbols", + }, + add_blank_line_at_top = false, -- Add a blank line at the top of the tree. + auto_clean_after_session_restore = false, -- Automatically clean up broken neo-tree buffers saved in sessions + close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab + default_source = "filesystem", -- you can choose a specific source `last` here which indicates the last used source + enable_diagnostics = true, + enable_git_status = true, + enable_modified_markers = true, -- Show markers for files with unsaved changes. + enable_opened_markers = true, -- Enable tracking of opened files. Required for `components.name.highlight_opened_files` + enable_refresh_on_write = true, -- Refresh the tree when a file is written. Only used if `use_libuv_file_watcher` is false. + enable_cursor_hijack = false, -- If enabled neotree will keep the cursor on the first letter of the filename when moving in the tree. + git_status_async = true, + -- These options are for people with VERY large git repos + git_status_async_options = { + batch_size = 1000, -- how many lines of git status results to process at a time + batch_delay = 10, -- delay in ms between batches. Spreads out the workload to let other processes run. + max_lines = 10000, -- How many lines of git status results to process. Anything after this will be dropped. + -- Anything before this will be used. The last items to be processed are the untracked files. + }, + hide_root_node = false, -- Hide the root node. + retain_hidden_root_indent = false, -- IF the root node is hidden, keep the indentation anyhow. + -- This is needed if you use expanders because they render in the indent. + log_level = "info", -- "trace", "debug", "info", "warn", "error", "fatal" + log_to_file = false, -- true, false, "/path/to/file.log", use :NeoTreeLogs to show the file + open_files_in_last_window = true, -- false = open files in top left window + open_files_do_not_replace_types = { "terminal", "Trouble", "qf", "edgy" }, -- when opening files, do not use windows containing these filetypes or buftypes + -- popup_border_style is for input and confirmation dialogs. + -- Configurtaion of floating window is done in the individual source sections. + -- "NC" is a special style that works well with NormalNC set + popup_border_style = "NC", -- "double", "none", "rounded", "shadow", "single" or "solid" + resize_timer_interval = 500, -- in ms, needed for containers to redraw right aligned and faded content + -- set to -1 to disable the resize timer entirely + -- -- NOTE: this will speed up to 50 ms for 1 second following a resize + sort_case_insensitive = false, -- used when sorting files and directories in the tree + sort_function = nil , -- uses a custom function for sorting files and directories in the tree + use_popups_for_input = true, -- If false, inputs will use vim.ui.input() instead of custom floats. + use_default_mappings = true, + -- source_selector provides clickable tabs to switch between sources. + source_selector = { + winbar = false, -- toggle to show selector on winbar + statusline = false, -- toggle to show selector on statusline + show_scrolled_off_parent_node = false, -- this will replace the tabs with the parent path + -- of the top visible node when scrolled down. + sources = { + { source = "filesystem" }, + { source = "buffers" }, + { source = "git_status" }, + }, + content_layout = "start", -- only with `tabs_layout` = "equal", "focus" + -- start : |/ 󰓩 bufname \/... + -- end : |/ 󰓩 bufname \/... + -- center : |/ 󰓩 bufname \/... + tabs_layout = "equal", -- start, end, center, equal, focus + -- start : |/ a \/ b \/ c \ | + -- end : | / a \/ b \/ c \| + -- center : | / a \/ b \/ c \ | + -- equal : |/ a \/ b \/ c \| + -- active : |/ focused tab \/ b \/ c \| + truncation_character = "…", -- character to use when truncating the tab label + tabs_min_width = nil, -- nil | int: if int padding is added based on `content_layout` + tabs_max_width = nil, -- this will truncate text even if `text_trunc_to_fit = false` + padding = 0, -- can be int or table + -- padding = { left = 2, right = 0 }, + -- separator = "▕", -- can be string or table, see below + separator = { left = "▏", right= "▕" }, + -- separator = { left = "/", right = "\\", override = nil }, -- |/ a \/ b \/ c \... + -- separator = { left = "/", right = "\\", override = "right" }, -- |/ a \ b \ c \... + -- separator = { left = "/", right = "\\", override = "left" }, -- |/ a / b / c /... + -- separator = { left = "/", right = "\\", override = "active" },-- |/ a / b:active \ c \... + -- separator = "|", -- || a | b | c |... + separator_active = nil, -- set separators around the active tab. nil falls back to `source_selector.separator` + show_separator_on_edge = false, + -- true : |/ a \/ b \/ c \| + -- false : | a \/ b \/ c | + highlight_tab = "NeoTreeTabInactive", + highlight_tab_active = "NeoTreeTabActive", + highlight_background = "NeoTreeTabInactive", + highlight_separator = "NeoTreeTabSeparatorInactive", + highlight_separator_active = "NeoTreeTabSeparatorActive", + }, + -- + --event_handlers = { + -- { + -- event = "before_render", + -- handler = function (state) + -- -- add something to the state that can be used by custom components + -- end + -- }, + -- { + -- event = "file_opened", + -- handler = function(file_path) + -- --auto close + -- require("neo-tree.command").execute({ action = "close" }) + -- end + -- }, + -- { + -- event = "file_opened", + -- handler = function(file_path) + -- --clear search after opening a file + -- require("neo-tree.sources.filesystem").reset_search() + -- end + -- }, + -- { + -- event = "file_renamed", + -- handler = function(args) + -- -- fix references to file + -- print(args.source, " renamed to ", args.destination) + -- end + -- }, + -- { + -- event = "file_moved", + -- handler = function(args) + -- -- fix references to file + -- print(args.source, " moved to ", args.destination) + -- end + -- }, + -- { + -- event = "neo_tree_buffer_enter", + -- handler = function() + -- vim.cmd 'highlight! Cursor blend=100' + -- end + -- }, + -- { + -- event = "neo_tree_buffer_leave", + -- handler = function() + -- vim.cmd 'highlight! Cursor guibg=#5f87af blend=0' + -- end + -- }, + -- { + -- event = "neo_tree_window_before_open", + -- handler = function(args) + -- print("neo_tree_window_before_open", vim.inspect(args)) + -- end + -- }, + -- { + -- event = "neo_tree_window_after_open", + -- handler = function(args) + -- vim.cmd("wincmd =") + -- end + -- }, + -- { + -- event = "neo_tree_window_before_close", + -- handler = function(args) + -- print("neo_tree_window_before_close", vim.inspect(args)) + -- end + -- }, + -- { + -- event = "neo_tree_window_after_close", + -- handler = function(args) + -- vim.cmd("wincmd =") + -- end + -- } + --}, + default_component_configs = { + container = { + enable_character_fade = true, + width = "100%", + right_padding = 0, + }, + --diagnostics = { + -- symbols = { + -- hint = "H", + -- info = "I", + -- warn = "!", + -- error = "X", + -- }, + -- highlights = { + -- hint = "DiagnosticSignHint", + -- info = "DiagnosticSignInfo", + -- warn = "DiagnosticSignWarn", + -- error = "DiagnosticSignError", + -- }, + --}, + indent = { + indent_size = 2, + padding = 1, + -- indent guides + with_markers = true, + indent_marker = "│", + last_indent_marker = "└", + highlight = "NeoTreeIndentMarker", + -- expander config, needed for nesting files + with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders + expander_collapsed = "", + expander_expanded = "", + expander_highlight = "NeoTreeExpander", + }, + icon = { + folder_closed = "", + folder_open = "", + folder_empty = "󰉖", + folder_empty_open = "󰷏", + -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there + -- then these will never be used. + default = "*", + highlight = "NeoTreeFileIcon" + }, + modified = { + symbol = "[+] ", + highlight = "NeoTreeModified", + }, + name = { + trailing_slash = false, + highlight_opened_files = false, -- Requires `enable_opened_markers = true`. + -- Take values in { false (no highlight), true (only loaded), + -- "all" (both loaded and unloaded)}. For more information, + -- see the `show_unloaded` config of the `buffers` source. + use_git_status_colors = true, + highlight = "NeoTreeFileName", + }, + git_status = { + symbols = { + -- Change type + added = "✚", -- NOTE: you can set any of these to an empty string to not show them + deleted = "✖", + modified = "", + renamed = "󰁕", + -- Status type + untracked = "", + ignored = "", + unstaged = "󰄱", + staged = "", + conflict = "", + }, + align = "right", + }, + -- If you don't want to use these columns, you can set `enabled = false` for each of them individually + file_size = { + enabled = true, + required_width = 64, -- min width of window required to show this column + }, + type = { + enabled = true, + required_width = 110, -- min width of window required to show this column + }, + last_modified = { + enabled = true, + required_width = 88, -- min width of window required to show this column + }, + created = { + enabled = false, + required_width = 120, -- min width of window required to show this column + }, + symlink_target = { + enabled = false, + }, + }, + renderers = { + directory = { + { "indent" }, + { "icon" }, + { "current_filter" }, + { + "container", + content = { + { "name", zindex = 10 }, + { + "symlink_target", + zindex = 10, + highlight = "NeoTreeSymbolicLinkTarget", + }, + { "clipboard", zindex = 10 }, + { "diagnostics", errors_only = true, zindex = 20, align = "right", hide_when_expanded = true }, + { "git_status", zindex = 10, align = "right", hide_when_expanded = true }, + { "file_size", zindex = 10, align = "right" }, + { "type", zindex = 10, align = "right" }, + { "last_modified", zindex = 10, align = "right" }, + { "created", zindex = 10, align = "right" }, + }, + }, + }, + file = { + { "indent" }, + { "icon" }, + { + "container", + content = { + { + "name", + zindex = 10 + }, + { + "symlink_target", + zindex = 10, + highlight = "NeoTreeSymbolicLinkTarget", + }, + { "clipboard", zindex = 10 }, + { "bufnr", zindex = 10 }, + { "modified", zindex = 20, align = "right" }, + { "diagnostics", zindex = 20, align = "right" }, + { "git_status", zindex = 10, align = "right" }, + { "file_size", zindex = 10, align = "right" }, + { "type", zindex = 10, align = "right" }, + { "last_modified", zindex = 10, align = "right" }, + { "created", zindex = 10, align = "right" }, + }, + }, + }, + message = { + { "indent", with_markers = false }, + { "name", highlight = "NeoTreeMessage" }, + }, + terminal = { + { "indent" }, + { "icon" }, + { "name" }, + { "bufnr" } + } + }, + nesting_rules = {}, + -- Global custom commands that will be available in all sources (if not overridden in `opts[source_name].commands`) + -- + -- You can then reference the custom command by adding a mapping to it: + -- globally -> `opts.window.mappings` + -- locally -> `opt[source_name].window.mappings` to make it source specific. + -- + -- commands = { | window { | filesystem { + -- hello = function() | mappings = { | commands = { + -- print("Hello world") | [""] = "hello" | hello = function() + -- end | } | print("Hello world in filesystem") + -- } | } | end + -- + -- see `:h neo-tree-custom-commands-global` + commands = {}, -- A list of functions + + window = { -- see https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/popup for + -- possible options. These can also be functions that return these options. + position = "left", -- left, right, top, bottom, float, current + width = 40, -- applies to left and right positions + height = 15, -- applies to top and bottom positions + auto_expand_width = false, -- expand the window when file exceeds the window width. does not work with position = "float" + popup = { -- settings that apply to float position only + size = { + height = "80%", + width = "50%", + }, + position = "50%", -- 50% means center it + -- you can also specify border here, if you want a different setting from + -- the global popup_border_style. + }, + same_level = false, -- Create and paste/move files/directories on the same level as the directory under cursor (as opposed to within the directory under cursor). + insert_as = "child", -- Affects how nodes get inserted into the tree during creation/pasting/moving of files if the node under the cursor is a directory: + -- "child": Insert nodes as children of the directory under cursor. + -- "sibling": Insert nodes as siblings of the directory under cursor. + -- Mappings for tree window. See `:h neo-tree-mappings` for a list of built-in commands. + -- You can also create your own commands by providing a function instead of a string. + mapping_options = { + noremap = true, + nowait = true, + }, + mappings = { + [""] = { + "toggle_node", + nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use + }, + ["<2-LeftMouse>"] = "open", + [""] = "open", + -- [""] = { "open", config = { expand_nested_files = true } }, -- expand nested file takes precedence + [""] = "cancel", -- close preview or floating neo-tree window + ["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = false } }, + [""] = { "scroll_preview", config = {direction = -10} }, + [""] = { "scroll_preview", config = {direction = 10} }, + ["l"] = "focus_preview", + ["S"] = "open_split", + -- ["S"] = "split_with_window_picker", + ["s"] = "open_vsplit", + -- ["sr"] = "open_rightbelow_vs", + -- ["sl"] = "open_leftabove_vs", + -- ["s"] = "vsplit_with_window_picker", + ["t"] = "open_tabnew", + -- [""] = "open_drop", + -- ["t"] = "open_tab_drop", + ["w"] = "open_with_window_picker", + ["C"] = "close_node", + ["z"] = "close_all_nodes", + --["Z"] = "expand_all_nodes", + ["R"] = "refresh", + ["a"] = { + "add", + -- some commands may take optional config options, see `:h neo-tree-mappings` for details + config = { + show_path = "none", -- "none", "relative", "absolute" + } + }, + ["A"] = "add_directory", -- also accepts the config.show_path and config.insert_as options. + ["d"] = "delete", + ["r"] = "rename", + ["y"] = "copy_to_clipboard", + ["x"] = "cut_to_clipboard", + ["p"] = "paste_from_clipboard", + ["c"] = "copy", -- takes text input for destination, also accepts the config.show_path and config.insert_as options + ["m"] = "move", -- takes text input for destination, also accepts the config.show_path and config.insert_as options + ["e"] = "toggle_auto_expand_width", + ["q"] = "close_window", + ["?"] = "show_help", + ["<"] = "prev_source", + [">"] = "next_source", + }, + }, + filesystem = { + window = { + mappings = { + ["H"] = "toggle_hidden", + ["/"] = "fuzzy_finder", + ["D"] = "fuzzy_finder_directory", + --["/"] = "filter_as_you_type", -- this was the default until v1.28 + ["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm + -- ["D"] = "fuzzy_sorter_directory", + ["f"] = "filter_on_submit", + [""] = "clear_filter", + [""] = "navigate_up", + ["."] = "set_root", + ["[g"] = "prev_git_modified", + ["]g"] = "next_git_modified", + ["i"] = "show_file_details", + ["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }}, + ["oc"] = { "order_by_created", nowait = false }, + ["od"] = { "order_by_diagnostics", nowait = false }, + ["og"] = { "order_by_git_status", nowait = false }, + ["om"] = { "order_by_modified", nowait = false }, + ["on"] = { "order_by_name", nowait = false }, + ["os"] = { "order_by_size", nowait = false }, + ["ot"] = { "order_by_type", nowait = false }, + }, + fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode + [""] = "move_cursor_down", + [""] = "move_cursor_down", + [""] = "move_cursor_up", + [""] = "move_cursor_up", + }, + }, + async_directory_scan = "auto", -- "auto" means refreshes are async, but it's synchronous when called from the Neotree commands. + -- "always" means directory scans are always async. + -- "never" means directory scans are never async. + scan_mode = "shallow", -- "shallow": Don't scan into directories to detect possible empty directory a priori + -- "deep": Scan into directories to detect empty or grouped empty directories a priori. + bind_to_cwd = true, -- true creates a 2-way binding between vim's cwd and neo-tree's root + cwd_target = { + sidebar = "tab", -- sidebar is when position = left or right + current = "window" -- current is when position = current + }, + check_gitignore_in_search = true, -- check gitignore status for files/directories when searching + -- setting this to false will speed up searches, but gitignored + -- items won't be marked if they are visible. + -- The renderer section provides the renderers that will be used to render the tree. + -- The first level is the node type. + -- For each node type, you can specify a list of components to render. + -- Components are rendered in the order they are specified. + -- The first field in each component is the name of the function to call. + -- The rest of the fields are passed to the function as the "config" argument. + filtered_items = { + visible = false, -- when true, they will just be displayed differently than normal items + force_visible_in_empty_folder = false, -- when true, hidden files will be shown if the root folder is otherwise empty + show_hidden_count = true, -- when true, the number of hidden items in each folder will be shown as the last entry + hide_dotfiles = true, + hide_gitignored = true, + hide_hidden = true, -- only works on Windows for hidden files/directories + hide_by_name = { + ".DS_Store", + "thumbs.db" + --"node_modules", + }, + hide_by_pattern = { -- uses glob style patterns + --"*.meta", + --"*/src/*/tsconfig.json" + }, + always_show = { -- remains visible even if other settings would normally hide it + --".gitignored", + }, + never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show + --".DS_Store", + --"thumbs.db" + }, + never_show_by_pattern = { -- uses glob style patterns + --".null-ls_*", + }, + }, + find_by_full_path_words = false, -- `false` means it only searches the tail of a path. + -- `true` will change the filter into a full path + -- search with space as an implicit ".*", so + -- `fi init` + -- will match: `./sources/filesystem/init.lua + --find_command = "fd", -- this is determined automatically, you probably don't need to set it + --find_args = { -- you can specify extra args to pass to the find command. + -- fd = { + -- "--exclude", ".git", + -- "--exclude", "node_modules" + -- } + --}, + ---- or use a function instead of list of strings + --find_args = function(cmd, path, search_term, args) + -- if cmd ~= "fd" then + -- return args + -- end + -- --maybe you want to force the filter to always include hidden files: + -- table.insert(args, "--hidden") + -- -- but no one ever wants to see .git files + -- table.insert(args, "--exclude") + -- table.insert(args, ".git") + -- -- or node_modules + -- table.insert(args, "--exclude") + -- table.insert(args, "node_modules") + -- --here is where it pays to use the function, you can exclude more for + -- --short search terms, or vary based on the directory + -- if string.len(search_term) < 4 and path == "/home/cseickel" then + -- table.insert(args, "--exclude") + -- table.insert(args, "Library") + -- end + -- return args + --end, + group_empty_dirs = false, -- when true, empty folders will be grouped together + search_limit = 50, -- max number of search results when using filters + follow_current_file = { + enabled = false, -- This will find and focus the file in the active buffer every time + -- -- the current file is changed while the tree is open. + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + }, + hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree + -- in whatever position is specified in window.position + -- "open_current",-- netrw disabled, opening a directory opens within the + -- window like netrw would, regardless of window.position + -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs + use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes + -- instead of relying on nvim autocmd events. + }, + buffers = { + bind_to_cwd = true, + follow_current_file = { + enabled = true, -- This will find and focus the file in the active buffer every time + -- -- the current file is changed while the tree is open. + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + }, + group_empty_dirs = true, -- when true, empty directories will be grouped together + show_unloaded = false, -- When working with sessions, for example, restored but unfocused buffers + -- are mark as "unloaded". Turn this on to view these unloaded buffer. + terminals_first = false, -- when true, terminals will be listed before file buffers + window = { + mappings = { + [""] = "navigate_up", + ["."] = "set_root", + ["bd"] = "buffer_delete", + ["i"] = "show_file_details", + ["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }}, + ["oc"] = { "order_by_created", nowait = false }, + ["od"] = { "order_by_diagnostics", nowait = false }, + ["om"] = { "order_by_modified", nowait = false }, + ["on"] = { "order_by_name", nowait = false }, + ["os"] = { "order_by_size", nowait = false }, + ["ot"] = { "order_by_type", nowait = false }, + }, + }, + }, + git_status = { + window = { + mappings = { + ["A"] = "git_add_all", + ["gu"] = "git_unstage_file", + ["ga"] = "git_add_file", + ["gr"] = "git_revert_file", + ["gc"] = "git_commit", + ["gp"] = "git_push", + ["gg"] = "git_commit_and_push", + ["i"] = "show_file_details", + ["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }}, + ["oc"] = { "order_by_created", nowait = false }, + ["od"] = { "order_by_diagnostics", nowait = false }, + ["om"] = { "order_by_modified", nowait = false }, + ["on"] = { "order_by_name", nowait = false }, + ["os"] = { "order_by_size", nowait = false }, + ["ot"] = { "order_by_type", nowait = false }, + }, + }, + }, + document_symbols = { + follow_cursor = false, + client_filters = "first", + renderers = { + root = { + {"indent"}, + {"icon", default="C" }, + {"name", zindex = 10}, + }, + symbol = { + {"indent", with_expanders = true}, + {"kind_icon", default="?" }, + {"container", + content = { + {"name", zindex = 10}, + {"kind_name", zindex = 20, align = "right"}, + } + } + }, + }, + window = { + mappings = { + [""] = "jump_to_symbol", + ["o"] = "jump_to_symbol", + ["A"] = "noop", -- also accepts the config.show_path and config.insert_as options. + ["d"] = "noop", + ["y"] = "noop", + ["x"] = "noop", + ["p"] = "noop", + ["c"] = "noop", + ["m"] = "noop", + ["a"] = "noop", + ["/"] = "filter", + ["f"] = "filter_on_submit", + }, + }, + custom_kinds = { + -- define custom kinds here (also remember to add icon and hl group to kinds) + -- ccls + -- [252] = 'TypeAlias', + -- [253] = 'Parameter', + -- [254] = 'StaticMethod', + -- [255] = 'Macro', + }, + kinds = { + Unknown = { icon = "?", hl = "" }, + Root = { icon = "", hl = "NeoTreeRootName" }, + File = { icon = "󰈙", hl = "Tag" }, + Module = { icon = "", hl = "Exception" }, + Namespace = { icon = "󰌗", hl = "Include" }, + Package = { icon = "󰏖", hl = "Label" }, + Class = { icon = "󰌗", hl = "Include" }, + Method = { icon = "", hl = "Function" }, + Property = { icon = "󰆧", hl = "@property" }, + Field = { icon = "", hl = "@field" }, + Constructor = { icon = "", hl = "@constructor" }, + Enum = { icon = "󰒻", hl = "@number" }, + Interface = { icon = "", hl = "Type" }, + Function = { icon = "󰊕", hl = "Function" }, + Variable = { icon = "", hl = "@variable" }, + Constant = { icon = "", hl = "Constant" }, + String = { icon = "󰀬", hl = "String" }, + Number = { icon = "󰎠", hl = "Number" }, + Boolean = { icon = "", hl = "Boolean" }, + Array = { icon = "󰅪", hl = "Type" }, + Object = { icon = "󰅩", hl = "Type" }, + Key = { icon = "󰌋", hl = "" }, + Null = { icon = "", hl = "Constant" }, + EnumMember = { icon = "", hl = "Number" }, + Struct = { icon = "󰌗", hl = "Type" }, + Event = { icon = "", hl = "Constant" }, + Operator = { icon = "󰆕", hl = "Operator" }, + TypeParameter = { icon = "󰊄", hl = "Type" }, + + -- ccls + -- TypeAlias = { icon = ' ', hl = 'Type' }, + -- Parameter = { icon = ' ', hl = '@parameter' }, + -- StaticMethod = { icon = '󰠄 ', hl = 'Function' }, + -- Macro = { icon = ' ', hl = 'Macro' }, + } + }, + example = { + renderers = { + custom = { + {"indent"}, + {"icon", default="C" }, + {"custom"}, + {"name"} + } + }, + window = { + mappings = { + [""] = "toggle_node", + [""] = "example_command", + ["d"] = "show_debug_info", + }, + }, + }, +} +return config diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/events/init.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/events/init.lua new file mode 100644 index 00000000..c9e66d8e --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/events/init.lua @@ -0,0 +1,95 @@ +local vim = vim +local q = require("neo-tree.events.queue") +local log = require("neo-tree.log") +local utils = require("neo-tree.utils") + +local M = { + -- Well known event names, you can make up your own + STATE_CREATED = "state_created", + BEFORE_RENDER = "before_render", + AFTER_RENDER = "after_render", + FILE_ADDED = "file_added", + FILE_DELETED = "file_deleted", + BEFORE_FILE_MOVE = "before_file_move", + FILE_MOVED = "file_moved", + FILE_OPEN_REQUESTED = "file_open_requested", + FILE_OPENED = "file_opened", + BEFORE_FILE_RENAME = "before_file_rename", + FILE_RENAMED = "file_renamed", + FS_EVENT = "fs_event", + GIT_EVENT = "git_event", + GIT_STATUS_CHANGED = "git_status_changed", + NEO_TREE_BUFFER_ENTER = "neo_tree_buffer_enter", + NEO_TREE_BUFFER_LEAVE = "neo_tree_buffer_leave", + NEO_TREE_LSP_UPDATE = "neo_tree_lsp_update", + NEO_TREE_POPUP_BUFFER_ENTER = "neo_tree_popup_buffer_enter", + NEO_TREE_POPUP_BUFFER_LEAVE = "neo_tree_popup_buffer_leave", + NEO_TREE_POPUP_INPUT_READY = "neo_tree_popup_input_ready", + NEO_TREE_WINDOW_AFTER_CLOSE = "neo_tree_window_after_close", + NEO_TREE_WINDOW_AFTER_OPEN = "neo_tree_window_after_open", + NEO_TREE_WINDOW_BEFORE_CLOSE = "neo_tree_window_before_close", + NEO_TREE_WINDOW_BEFORE_OPEN = "neo_tree_window_before_open", + VIM_AFTER_SESSION_LOAD = "vim_after_session_load", + VIM_BUFFER_ADDED = "vim_buffer_added", + VIM_BUFFER_CHANGED = "vim_buffer_changed", + VIM_BUFFER_DELETED = "vim_buffer_deleted", + VIM_BUFFER_ENTER = "vim_buffer_enter", + VIM_BUFFER_MODIFIED_SET = "vim_buffer_modified_set", + VIM_COLORSCHEME = "vim_colorscheme", + VIM_CURSOR_MOVED = "vim_cursor_moved", + VIM_DIAGNOSTIC_CHANGED = "vim_diagnostic_changed", + VIM_DIR_CHANGED = "vim_dir_changed", + VIM_INSERT_LEAVE = "vim_insert_leave", + VIM_LEAVE = "vim_leave", + VIM_LSP_REQUEST = "vim_lsp_request", + VIM_RESIZED = "vim_resized", + VIM_TAB_CLOSED = "vim_tab_closed", + VIM_TERMINAL_ENTER = "vim_terminal_enter", + VIM_TEXT_CHANGED_NORMAL = "vim_text_changed_normal", + VIM_WIN_CLOSED = "vim_win_closed", + VIM_WIN_ENTER = "vim_win_enter", +} + +M.define_autocmd_event = function(event_name, autocmds, debounce_frequency, seed_fn, nested) + local opts = { + setup = function() + local tpl = + ":lua require('neo-tree.events').fire_event('%s', { afile = vim.F.npcall(vim.fn.expand, '') or '' })" + local callback = string.format(tpl, event_name) + if nested then + callback = "++nested " .. callback + end + + local autocmd = table.concat(autocmds, ",") + if not vim.startswith(autocmd, "User") then + autocmd = autocmd .. " *" + end + local cmds = { + "augroup NeoTreeEvent_" .. event_name, + "autocmd " .. autocmd .. " " .. callback, + "augroup END", + } + log.trace("Registering autocmds: %s", table.concat(cmds, "\n")) + vim.cmd(table.concat(cmds, "\n")) + end, + seed = seed_fn, + teardown = function() + log.trace("Teardown autocmds for ", event_name) + vim.cmd(string.format("autocmd! NeoTreeEvent_%s", event_name)) + end, + debounce_frequency = debounce_frequency, + debounce_strategy = utils.debounce_strategy.CALL_LAST_ONLY, + } + log.debug("Defining autocmd event: %s", event_name) + q.define_event(event_name, opts) +end + +M.clear_all_events = q.clear_all_events +M.define_event = q.define_event +M.destroy_event = q.destroy_event +M.fire_event = q.fire_event + +M.subscribe = q.subscribe +M.unsubscribe = q.unsubscribe + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/events/queue.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/events/queue.lua new file mode 100644 index 00000000..6797213b --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/events/queue.lua @@ -0,0 +1,144 @@ +local utils = require("neo-tree.utils") +local log = require("neo-tree.log") +local Queue = require("neo-tree.collections").Queue + +local event_queues = {} +local event_definitions = {} +local M = {} + +local validate_event_handler = function(event_handler) + if type(event_handler) ~= "table" then + error("Event handler must be a table") + end + if type(event_handler.event) ~= "string" then + error("Event handler must have an event") + end + if type(event_handler.handler) ~= "function" then + error("Event handler must have a handler") + end +end + +M.clear_all_events = function() + for event_name, queue in pairs(event_queues) do + M.destroy_event(event_name) + end + event_queues = {} +end + +M.define_event = function(event_name, opts) + local existing = event_definitions[event_name] + if existing ~= nil then + error("Event already defined: " .. event_name) + end + event_definitions[event_name] = opts +end + +M.destroy_event = function(event_name) + local existing = event_definitions[event_name] + if existing == nil then + return false + end + if existing.setup_was_run and type(existing.teardown) == "function" then + local success, result = pcall(existing.teardown) + if not success then + error("Error in teardown for " .. event_name .. ": " .. result) + end + existing.setup_was_run = false + end + event_queues[event_name] = nil + return true +end + +local fire_event_internal = function(event, args) + local queue = event_queues[event] + if queue == nil then + return nil + end + --log.trace("Firing event: ", event, " with args: ", args) + + if queue:is_empty() then + --log.trace("Event queue is empty") + return nil + end + local seed = utils.get_value(event_definitions, event .. ".seed") + if seed ~= nil then + local success, result = pcall(seed, args) + if success and result then + log.trace("Seed for " .. event .. " returned: " .. tostring(result)) + elseif success then + log.trace("Seed for " .. event .. " returned falsy, cancelling event") + else + log.error("Error in seed function for " .. event .. ": " .. result) + end + end + + return queue:for_each(function(event_handler) + local remove_node = event_handler == nil or event_handler.cancelled + if not remove_node then + local success, result = pcall(event_handler.handler, args) + local id = event_handler.id or event_handler + if success then + log.trace("Handler ", id, " for " .. event .. " called successfully.") + else + log.error(string.format("Error in event handler for event %s[%s]: %s", event, id, result)) + end + if event_handler.once then + event_handler.cancelled = true + return true + end + return result + end + end) +end + +M.fire_event = function(event, args) + local freq = utils.get_value(event_definitions, event .. ".debounce_frequency", 0, true) + local strategy = utils.get_value(event_definitions, event .. ".debounce_strategy", 0, true) + log.trace("Firing event: ", event, " with args: ", args) + if freq > 0 then + utils.debounce("EVENT_FIRED: " .. event, function() + fire_event_internal(event, args or {}) + end, freq, strategy) + else + return fire_event_internal(event, args or {}) + end +end + +M.subscribe = function(event_handler) + validate_event_handler(event_handler) + + local queue = event_queues[event_handler.event] + if queue == nil then + log.debug("Creating queue for event: " .. event_handler.event) + queue = Queue:new() + local def = event_definitions[event_handler.event] + if def and type(def.setup) == "function" then + local success, result = pcall(def.setup) + if success then + def.setup_was_run = true + log.debug("Setup for event " .. event_handler.event .. " was run") + else + log.error("Error in setup for " .. event_handler.event .. ": " .. result) + end + end + event_queues[event_handler.event] = queue + end + log.debug("Adding event handler [", event_handler.id, "] for event: ", event_handler.event) + queue:add(event_handler) +end + +M.unsubscribe = function(event_handler) + local queue = event_queues[event_handler.event] + if queue == nil then + return nil + end + queue:remove_by_id(event_handler.id or event_handler) + if queue:is_empty() then + M.destroy_event(event_handler.event) + event_queues[event_handler.event] = nil + else + event_queues[event_handler.event] = queue + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/git/ignored.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/git/ignored.lua new file mode 100644 index 00000000..e51674fc --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/git/ignored.lua @@ -0,0 +1,176 @@ +local Job = require("plenary.job") + +local utils = require("neo-tree.utils") +local log = require("neo-tree.log") +local git_utils = require("neo-tree.git.utils") + +local M = {} +local sep = utils.path_separator + +M.is_ignored = function(ignored, path, _type) + if _type == "directory" and not utils.is_windows then + path = path .. sep + end + + return vim.tbl_contains(ignored, path) +end + +local git_root_cache = { + known_roots = {}, + dir_lookup = {}, +} +local get_root_for_item = function(item) + local dir = item.type == "directory" and item.path or item.parent_path + if type(git_root_cache.dir_lookup[dir]) ~= "nil" then + return git_root_cache.dir_lookup[dir] + end + --for _, root in ipairs(git_root_cache.known_roots) do + -- if vim.startswith(dir, root) then + -- git_root_cache.dir_lookup[dir] = root + -- return root + -- end + --end + local root = git_utils.get_repository_root(dir) + if root then + git_root_cache.dir_lookup[dir] = root + table.insert(git_root_cache.known_roots, root) + else + git_root_cache.dir_lookup[dir] = false + end + return root +end + +M.mark_ignored = function(state, items, callback) + local folders = {} + log.trace("================================================================================") + log.trace("IGNORED: mark_ignore BEGIN...") + + for _, item in ipairs(items) do + local folder = utils.split_path(item.path) + if folder then + if not folders[folder] then + folders[folder] = {} + end + table.insert(folders[folder], item.path) + end + end + + local function process_result(result) + if utils.is_windows then + --on Windows, git seems to return quotes and double backslash "path\\directory" + result = vim.tbl_map(function(item) + item = item:gsub("\\\\", "\\") + return item + end, result) + else + --check-ignore does not indicate directories the same as 'status' so we need to + --add the trailing slash to the path manually if not on Windows. + log.trace("IGNORED: Checking types of", #result, "items to see which ones are directories") + for i, item in ipairs(result) do + local stat = vim.loop.fs_stat(item) + if stat and stat.type == "directory" then + result[i] = item .. sep + end + end + end + result = vim.tbl_map(function(item) + -- remove leading and trailing " from git output + item = item:gsub('^"', ""):gsub('"$', "") + -- convert octal encoded lines to utf-8 + item = git_utils.octal_to_utf8(item) + return item + end, result) + return result + end + + local function finalize(all_results) + local show_gitignored = state.filtered_items and state.filtered_items.hide_gitignored == false + log.trace("IGNORED: Comparing results to mark items as ignored:", show_gitignored) + local ignored, not_ignored = 0, 0 + for _, item in ipairs(items) do + if M.is_ignored(all_results, item.path, item.type) then + item.filtered_by = item.filtered_by or {} + item.filtered_by.gitignored = true + item.filtered_by.show_gitignored = show_gitignored + ignored = ignored + 1 + else + not_ignored = not_ignored + 1 + end + end + log.trace("IGNORED: mark_ignored is complete, ignored:", ignored, ", not ignored:", not_ignored) + log.trace("================================================================================") + end + + local all_results = {} + if type(callback) == "function" then + local jobs = {} + local running_jobs = 0 + local job_count = 0 + local completed_jobs = 0 + + -- This is called when a job completes, and starts the next job if there are any left + -- or calls the callback if all jobs are complete. + -- It is also called once at the start to start the first 50 jobs. + -- + -- This is done to avoid running too many jobs at once, which can cause a crash from + -- having too many open files. + local run_more_jobs = function() + while #jobs > 0 and running_jobs < 50 and job_count > completed_jobs do + local next_job = table.remove(jobs, #jobs) + next_job:start() + running_jobs = running_jobs + 1 + end + + if completed_jobs == job_count then + finalize(all_results) + callback(all_results) + end + end + + for folder, folder_items in pairs(folders) do + local args = { "-C", folder, "check-ignore", "--stdin" } + local job = Job:new({ + command = "git", + args = args, + enabled_recording = true, + writer = folder_items, + on_start = function() + log.trace("IGNORED: Running async git with args: ", args) + end, + on_exit = function(self, code, _) + local result + if code ~= 0 then + log.debug("Failed to load ignored files for", folder, ":", self:stderr_result()) + result = {} + else + result = self:result() + end + vim.list_extend(all_results, process_result(result)) + + running_jobs = running_jobs - 1 + completed_jobs = completed_jobs + 1 + run_more_jobs() + end, + }) + table.insert(jobs, job) + job_count = job_count + 1 + end + + run_more_jobs() + else + for folder, folder_items in pairs(folders) do + local cmd = { "git", "-C", folder, "check-ignore", unpack(folder_items) } + log.trace("IGNORED: Running cmd: ", cmd) + local result = vim.fn.systemlist(cmd) + if vim.v.shell_error == 128 then + log.debug("Failed to load ignored files for", state.path, ":", result) + result = {} + end + vim.list_extend(all_results, process_result(result)) + end + finalize(all_results) + return all_results + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/git/init.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/git/init.lua new file mode 100644 index 00000000..863599be --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/git/init.lua @@ -0,0 +1,13 @@ +local status = require("neo-tree.git.status") +local ignored = require("neo-tree.git.ignored") +local git_utils = require("neo-tree.git.utils") + +local M = { + get_repository_root = git_utils.get_repository_root, + is_ignored = ignored.is_ignored, + mark_ignored = ignored.mark_ignored, + status = status.status, + status_async = status.status_async, +} + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/git/status.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/git/status.lua new file mode 100644 index 00000000..5a815d26 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/git/status.lua @@ -0,0 +1,338 @@ +local utils = require("neo-tree.utils") +local events = require("neo-tree.events") +local Job = require("plenary.job") +local log = require("neo-tree.log") +local git_utils = require("neo-tree.git.utils") + +local M = {} + +local function get_simple_git_status_code(status) + -- Prioritze M then A over all others + if status:match("U") or status == "AA" or status == "DD" then + return "U" + elseif status:match("M") then + return "M" + elseif status:match("[ACR]") then + return "A" + elseif status:match("!$") then + return "!" + elseif status:match("?$") then + return "?" + else + local len = #status + while len > 0 do + local char = status:sub(len, len) + if char ~= " " then + return char + end + len = len - 1 + end + return status + end +end + +local function get_priority_git_status_code(status, other_status) + if not status then + return other_status + elseif not other_status then + return status + elseif status == "U" or other_status == "U" then + return "U" + elseif status == "?" or other_status == "?" then + return "?" + elseif status == "M" or other_status == "M" then + return "M" + elseif status == "A" or other_status == "A" then + return "A" + else + return status + end +end + +local parse_git_status_line = function(context, line) + context.lines_parsed = context.lines_parsed + 1 + if type(line) ~= "string" then + return + end + if #line < 4 then + return + end + local git_root = context.git_root + local git_status = context.git_status + local exclude_directories = context.exclude_directories + + local line_parts = vim.split(line, " ") + if #line_parts < 2 then + return + end + local status = line_parts[1] + local relative_path = line_parts[2] + + -- rename output is `R000 from/filename to/filename` + if status:match("^R") then + relative_path = line_parts[3] + end + + -- remove any " due to whitespace or utf-8 in the path + relative_path = relative_path:gsub('^"', ""):gsub('"$', "") + -- convert octal encoded lines to utf-8 + relative_path = git_utils.octal_to_utf8(relative_path) + + if utils.is_windows == true then + relative_path = utils.windowize_path(relative_path) + end + local absolute_path = utils.path_join(git_root, relative_path) + -- merge status result if there are results from multiple passes + local existing_status = git_status[absolute_path] + if existing_status then + local merged = "" + local i = 0 + while i < 2 do + i = i + 1 + local existing_char = #existing_status >= i and existing_status:sub(i, i) or "" + local new_char = #status >= i and status:sub(i, i) or "" + local merged_char = get_priority_git_status_code(existing_char, new_char) + merged = merged .. merged_char + end + status = merged + end + git_status[absolute_path] = status + + if not exclude_directories then + -- Now bubble this status up to the parent directories + local parts = utils.split(absolute_path, utils.path_separator) + table.remove(parts) -- pop the last part so we don't override the file's status + utils.reduce(parts, "", function(acc, part) + local path = acc .. utils.path_separator .. part + if utils.is_windows == true then + path = path:gsub("^" .. utils.path_separator, "") + end + local path_status = git_status[path] + local file_status = get_simple_git_status_code(status) + git_status[path] = get_priority_git_status_code(path_status, file_status) + return path + end) + end +end + +---Parse "git status" output for the current working directory. +---@base git ref base +---@exclude_directories boolean Whether to skip bubling up status to directories +---@path string Path to run the git status command in, defaults to cwd. +---@return table table Table with the path as key and the status as value. +---@return table, string|nil The git root for the specified path. +M.status = function(base, exclude_directories, path) + local git_root = git_utils.get_repository_root(path) + if not utils.truthy(git_root) then + return {} + end + + local C = git_root + local staged_cmd = { "git", "-C", C, "diff", "--staged", "--name-status", base, "--" } + local staged_ok, staged_result = utils.execute_command(staged_cmd) + if not staged_ok then + return {} + end + local unstaged_cmd = { "git", "-C", C, "diff", "--name-status" } + local unstaged_ok, unstaged_result = utils.execute_command(unstaged_cmd) + if not unstaged_ok then + return {} + end + local untracked_cmd = { "git", "-C", C, "ls-files", "--exclude-standard", "--others" } + local untracked_ok, untracked_result = utils.execute_command(untracked_cmd) + if not untracked_ok then + return {} + end + + local context = { + git_root = git_root, + git_status = {}, + exclude_directories = exclude_directories, + lines_parsed = 0, + } + + for _, line in ipairs(staged_result) do + parse_git_status_line(context, line) + end + for _, line in ipairs(unstaged_result) do + if line then + line = " " .. line + end + parse_git_status_line(context, line) + end + for _, line in ipairs(untracked_result) do + if line then + line = "? " .. line + end + parse_git_status_line(context, line) + end + + return context.git_status, git_root +end + +local function parse_lines_batch(context, job_complete_callback) + local i, batch_size = 0, context.batch_size + + if context.lines_total == nil then + -- first time through, get the total number of lines + context.lines_total = math.min(context.max_lines, #context.lines) + context.lines_parsed = 0 + if context.lines_total == 0 then + if type(job_complete_callback) == "function" then + job_complete_callback() + end + return + end + end + batch_size = math.min(context.batch_size, context.lines_total - context.lines_parsed) + + while i < batch_size do + i = i + 1 + parse_git_status_line(context, context.lines[context.lines_parsed + 1]) + end + + if context.lines_parsed >= context.lines_total then + if type(job_complete_callback) == "function" then + job_complete_callback() + end + else + -- add small delay so other work can happen + vim.defer_fn(function() + parse_lines_batch(context, job_complete_callback) + end, context.batch_delay) + end +end + +M.status_async = function(path, base, opts) + git_utils.get_repository_root(path, function(git_root) + if utils.truthy(git_root) then + log.trace("git.status.status_async called") + else + log.trace("status_async: not a git folder: ", path) + return false + end + + local event_id = "git_status_" .. git_root + local context = { + git_root = git_root, + git_status = {}, + exclude_directories = false, + lines = {}, + lines_parsed = 0, + batch_size = opts.batch_size or 1000, + batch_delay = opts.batch_delay or 10, + max_lines = opts.max_lines or 100000, + } + + local should_process = function(err, line, job, err_msg) + if vim.v.dying > 0 or vim.v.exiting ~= vim.NIL then + job:shutdown() + return false + end + if err and err > 0 then + log.error(err_msg, err, line) + return false + end + return true + end + + local job_complete_callback = function() + vim.schedule(function() + events.fire_event(events.GIT_STATUS_CHANGED, { + git_root = context.git_root, + git_status = context.git_status, + }) + end) + end + + local parse_lines = vim.schedule_wrap(function() + parse_lines_batch(context, job_complete_callback) + end) + + utils.debounce(event_id, function() + local staged_job = Job:new({ + command = "git", + args = { "-C", git_root, "diff", "--staged", "--name-status", base, "--" }, + enable_recording = false, + maximium_results = context.max_lines, + on_stdout = vim.schedule_wrap(function(err, line, job) + if should_process(err, line, job, "status_async staged error:") then + table.insert(context.lines, line) + end + end), + on_stderr = function(err, line) + if err and err > 0 then + log.error("status_async staged error: ", err, line) + end + end, + }) + + local unstaged_job = Job:new({ + command = "git", + args = { "-C", git_root, "diff", "--name-status" }, + enable_recording = false, + maximium_results = context.max_lines, + on_stdout = vim.schedule_wrap(function(err, line, job) + if should_process(err, line, job, "status_async unstaged error:") then + if line then + line = " " .. line + end + table.insert(context.lines, line) + end + end), + on_stderr = function(err, line) + if err and err > 0 then + log.error("status_async unstaged error: ", err, line) + end + end, + }) + + local untracked_job = Job:new({ + command = "git", + args = { "-C", git_root, "ls-files", "--exclude-standard", "--others" }, + enable_recording = false, + maximium_results = context.max_lines, + on_stdout = vim.schedule_wrap(function(err, line, job) + if should_process(err, line, job, "status_async untracked error:") then + if line then + line = "? " .. line + end + table.insert(context.lines, line) + end + end), + on_stderr = function(err, line) + if err and err > 0 then + log.error("status_async untracked error: ", err, line) + end + end, + }) + + Job:new({ + command = "git", + args = { + "-C", + git_root, + "config", + "--get", + "status.showUntrackedFiles", + }, + enabled_recording = true, + on_exit = function(self, _, _) + local result = self:result() + log.debug("git status.showUntrackedFiles =", result[1]) + if result[1] == "no" then + unstaged_job:after(parse_lines) + Job.chain(staged_job, unstaged_job) + else + untracked_job:after(parse_lines) + Job.chain(staged_job, unstaged_job, untracked_job) + end + end, + }):start() + end, 1000, utils.debounce_strategy.CALL_FIRST_AND_LAST, utils.debounce_action.START_ASYNC_JOB) + + return true + end) +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/git/utils.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/git/utils.lua new file mode 100644 index 00000000..d237de8a --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/git/utils.lua @@ -0,0 +1,65 @@ +local Job = require("plenary.job") + +local utils = require("neo-tree.utils") +local log = require("neo-tree.log") + +local M = {} + +M.get_repository_root = function(path, callback) + local args = { "rev-parse", "--show-toplevel" } + if utils.truthy(path) then + args = { "-C", path, "rev-parse", "--show-toplevel" } + end + if type(callback) == "function" then + Job:new({ + command = "git", + args = args, + enabled_recording = true, + on_exit = function(self, code, _) + if code ~= 0 then + log.trace("GIT ROOT ERROR ", self:stderr_result()) + callback(nil) + return + end + local git_root = self:result()[1] + + if utils.is_windows then + git_root = utils.windowize_path(git_root) + end + + log.trace("GIT ROOT for '", path, "' is '", git_root, "'") + callback(git_root) + end, + }):start() + else + local ok, git_root = utils.execute_command({ "git", unpack(args) }) + if not ok then + log.trace("GIT ROOT ERROR ", git_root) + return nil + end + git_root = git_root[1] + + if utils.is_windows then + git_root = utils.windowize_path(git_root) + end + + log.trace("GIT ROOT for '", path, "' is '", git_root, "'") + return git_root + end +end + +local convert_octal_char = function(octal) + return string.char(tonumber(octal, 8)) +end + +M.octal_to_utf8 = function(text) + -- git uses octal encoding for utf-8 filepaths, convert octal back to utf-8 + local success, converted = pcall(string.gsub, text, "\\([0-7][0-7][0-7])", convert_octal_char) + if success then + return converted + else + return text + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/log.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/log.lua new file mode 100644 index 00000000..a0912fc4 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/log.lua @@ -0,0 +1,189 @@ +-- log.lua +-- +-- Inspired by rxi/log.lua +-- Modified by tjdevries and can be found at github.com/tjdevries/vlog.nvim +-- +-- This library is free software; you can redistribute it and/or modify it +-- under the terms of the MIT license. See LICENSE for details. + +local vim = vim +-- User configuration section +local default_config = { + -- Name of the plugin. Prepended to log messages + plugin = "neo-tree.nvim", + + -- Should print the output to neovim while running + use_console = true, + + -- Should highlighting be used in console (using echohl) + highlights = true, + + -- Should write to a file + use_file = false, + + -- Any messages above this level will be logged. + level = "info", + + -- Level configuration + modes = { + { name = "trace", hl = "None", level = vim.log.levels.TRACE }, + { name = "debug", hl = "None", level = vim.log.levels.DEBGUG }, + { name = "info", hl = "None", level = vim.log.levels.INFO }, + { name = "warn", hl = "WarningMsg", level = vim.log.levels.WARN }, + { name = "error", hl = "ErrorMsg", level = vim.log.levels.ERROR }, + { name = "fatal", hl = "ErrorMsg", level = vim.log.levels.ERROR }, + }, + + -- Can limit the number of decimals displayed for floats + float_precision = 0.01, +} + +-- {{{ NO NEED TO CHANGE +local log = {} + +local unpack = unpack or table.unpack + +local notify = function(message, level_config) + if type(vim.notify) == "table" then + -- probably using nvim-notify + vim.notify(message, level_config.level, { title = "Neo-tree" }) + else + local nameupper = level_config.name:upper() + local console_string = string.format("[Neo-tree %s] %s", nameupper, message) + vim.notify(console_string, level_config.level) + end +end + +log.new = function(config, standalone) + config = vim.tbl_deep_extend("force", default_config, config) + + local outfile = + string.format("%s/%s.log", vim.api.nvim_call_function("stdpath", { "data" }), config.plugin) + + local obj + if standalone then + obj = log + else + obj = {} + end + obj.outfile = outfile + + obj.use_file = function(file, quiet) + if file == false then + if not quiet then + obj.info("[neo-tree] Logging to file disabled") + end + config.use_file = false + else + if type(file) == "string" then + obj.outfile = file + else + obj.outfile = outfile + end + config.use_file = true + if not quiet then + obj.info("[neo-tree] Logging to file: " .. obj.outfile) + end + end + end + + local levels = {} + for i, v in ipairs(config.modes) do + levels[v.name] = i + end + + obj.set_level = function(level) + if levels[level] then + if config.level ~= level then + config.level = level + end + else + notify("Invalid log level: " .. level, config.modes[5]) + end + end + + local round = function(x, increment) + increment = increment or 1 + x = x / increment + return (x > 0 and math.floor(x + 0.5) or math.ceil(x - 0.5)) * increment + end + + local make_string = function(...) + local t = {} + for i = 1, select("#", ...) do + local x = select(i, ...) + + if type(x) == "number" and config.float_precision then + x = tostring(round(x, config.float_precision)) + elseif type(x) == "table" then + x = vim.inspect(x) + if #x > 300 then + x = x:sub(1, 300) .. "..." + end + else + x = tostring(x) + end + + t[#t + 1] = x + end + return table.concat(t, " ") + end + + local log_at_level = function(level, level_config, message_maker, ...) + -- Return early if we're below the config.level + if level < levels[config.level] then + return + end + -- Ignnore this if vim is exiting + if vim.v.dying > 0 or vim.v.exiting ~= vim.NIL then + return + end + local nameupper = level_config.name:upper() + + local msg = message_maker(...) + local info = debug.getinfo(2, "Sl") + local lineinfo = info.short_src .. ":" .. info.currentline + + -- Output to log file + if config.use_file then + local str = string.format("[%-6s%s] %s: %s\n", nameupper, os.date(), lineinfo, msg) + local fp = io.open(obj.outfile, "a") + if fp then + fp:write(str) + fp:close() + else + print("[neo-tree] Could not open log file: " .. obj.outfile) + end + end + + -- Output to console + if config.use_console and level > 2 then + vim.schedule(function() + notify(msg, level_config) + end) + end + end + + for i, x in ipairs(config.modes) do + obj[x.name] = function(...) + return log_at_level(i, x, make_string, ...) + end + + obj[("fmt_%s"):format(x.name)] = function() + return log_at_level(i, x, function(...) + local passed = { ... } + local fmt = table.remove(passed, 1) + local inspected = {} + for _, v in ipairs(passed) do + table.insert(inspected, vim.inspect(v)) + end + return string.format(fmt, unpack(inspected)) + end) + end + end +end + +log.new(default_config, true) +-- }}} + +return log diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/setup/deprecations.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/setup/deprecations.lua new file mode 100644 index 00000000..527799ab --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/setup/deprecations.lua @@ -0,0 +1,135 @@ +local utils = require("neo-tree.utils") + +local M = {} + +local migrations = {} + +M.show_migrations = function() + if #migrations > 0 then + local content = {} + for _, message in ipairs(migrations) do + vim.list_extend(content, vim.split("\n## " .. message, "\n", { trimempty = false })) + end + local header = "# Neo-tree configuration has been updated. Please review the changes below." + table.insert(content, 1, header) + local buf = vim.api.nvim_create_buf(false, true) + vim.api.nvim_buf_set_lines(buf, 0, -1, false, content) + vim.api.nvim_buf_set_option(buf, "buftype", "nofile") + vim.api.nvim_buf_set_option(buf, "bufhidden", "wipe") + vim.api.nvim_buf_set_option(buf, "buflisted", false) + vim.api.nvim_buf_set_option(buf, "swapfile", false) + vim.api.nvim_buf_set_option(buf, "modifiable", false) + vim.api.nvim_buf_set_option(buf, "filetype", "markdown") + vim.api.nvim_buf_set_name(buf, "Neo-tree migrations") + vim.defer_fn(function() + vim.cmd(string.format("%ssplit", #content)) + vim.api.nvim_win_set_buf(0, buf) + end, 100) + end +end + +M.migrate = function(config) + migrations = {} + + local moved = function(old, new, converter) + local existing = utils.get_value(config, old) + if type(existing) ~= "nil" then + if type(converter) == "function" then + existing = converter(existing) + end + utils.set_value(config, old, nil) + utils.set_value(config, new, existing) + migrations[#migrations + 1] = + string.format("The `%s` option has been deprecated, please use `%s` instead.", old, new) + end + end + + local moved_inside = function(old, new_inside, converter) + local existing = utils.get_value(config, old) + if type(existing) ~= "nil" and type(existing) ~= "table" then + if type(converter) == "function" then + existing = converter(existing) + end + utils.set_value(config, old, {}) + local new = old .. "." .. new_inside + utils.set_value(config, new, existing) + migrations[#migrations + 1] = + string.format("The `%s` option is replaced with a table, please move to `%s`.", old, new) + end + end + + local removed = function(key, desc) + local value = utils.get_value(config, key) + if type(value) ~= "nil" then + utils.set_value(config, key, nil) + migrations[#migrations + 1] = + string.format("The `%s` option has been removed.\n%s", key, desc or "") + end + end + + local renamed_value = function(key, old_value, new_value) + local value = utils.get_value(config, key) + if value == old_value then + utils.set_value(config, key, new_value) + migrations[#migrations + 1] = + string.format("The `%s=%s` option has been renamed to `%s`.", key, old_value, new_value) + end + end + + local opposite = function(value) + return not value + end + + local tab_to_source_migrator = function(labels) + local converted_sources = {} + for entry, label in pairs(labels) do + table.insert(converted_sources, { source = entry, display_name = label }) + end + return converted_sources + end + + moved("filesystem.filters", "filesystem.filtered_items") + moved("filesystem.filters.show_hidden", "filesystem.filtered_items.hide_dotfiles", opposite) + moved("filesystem.filters.respect_gitignore", "filesystem.filtered_items.hide_gitignored") + moved("open_files_do_not_replace_filetypes", "open_files_do_not_replace_types") + moved("source_selector.tab_labels", "source_selector.sources", tab_to_source_migrator) + removed("filesystem.filters.gitignore_source") + removed("filesystem.filter_items.gitignore_source") + renamed_value("filesystem.hijack_netrw_behavior", "open_split", "open_current") + for _, source in ipairs({ "filesystem", "buffers", "git_status" }) do + renamed_value(source .. "window.position", "split", "current") + end + moved_inside("filesystem.follow_current_file", "enabled") + moved_inside("buffers.follow_current_file", "enabled") + + -- v3.x + removed("close_floats_on_escape_key") + + -- v4.x + removed( + "enable_normal_mode_for_inputs", + [[ +Please use `neo_tree_popup_input_ready` event instead and call `stopinsert` inside the handler. + + +See instructions in `:h neo-tree-events` for more details. + +```lua +event_handlers = { + { + event = "neo_tree_popup_input_ready", + ---@param args { bufnr: integer, winid: integer } + handler = function(args) + vim.cmd("stopinsert") + vim.keymap.set("i", "", vim.cmd.stopinsert, { noremap = true, buffer = args.bufnr }) + end, + } +} +``` +]] + ) + + return migrations +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/setup/init.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/setup/init.lua new file mode 100644 index 00000000..bb5a7b8e --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/setup/init.lua @@ -0,0 +1,746 @@ +local utils = require("neo-tree.utils") +local defaults = require("neo-tree.defaults") +local mapping_helper = require("neo-tree.setup.mapping-helper") +local events = require("neo-tree.events") +local log = require("neo-tree.log") +local file_nesting = require("neo-tree.sources.common.file-nesting") +local highlights = require("neo-tree.ui.highlights") +local manager = require("neo-tree.sources.manager") +local netrw = require("neo-tree.setup.netrw") +local hijack_cursor = require("neo-tree.sources.common.hijack_cursor") + +local M = {} + +local normalize_mappings = function(config) + if config == nil then + return false + end + local mappings = utils.get_value(config, "window.mappings", nil) + if mappings then + local fixed = mapping_helper.normalize_map(mappings) + config.window.mappings = fixed + return true + else + return false + end +end + +local events_setup = false +local define_events = function() + if events_setup then + return + end + + events.define_event(events.FS_EVENT, { + debounce_frequency = 100, + debounce_strategy = utils.debounce_strategy.CALL_LAST_ONLY, + }) + + local v = vim.version() + local diag_autocmd = "DiagnosticChanged" + if v.major < 1 and v.minor < 6 then + diag_autocmd = "User LspDiagnosticsChanged" + end + events.define_autocmd_event(events.VIM_DIAGNOSTIC_CHANGED, { diag_autocmd }, 500, function(args) + args.diagnostics_lookup = utils.get_diagnostic_counts() + return args + end) + + + + local update_opened_buffers = function(args) + args.opened_buffers = utils.get_opened_buffers() + return args + end + + events.define_autocmd_event(events.VIM_AFTER_SESSION_LOAD, { "SessionLoadPost" }, 200) + events.define_autocmd_event(events.VIM_BUFFER_ADDED, { "BufAdd" }, 200, update_opened_buffers) + events.define_autocmd_event(events.VIM_BUFFER_CHANGED, { "BufWritePost" }, 200) + events.define_autocmd_event( + events.VIM_BUFFER_DELETED, + { "BufDelete" }, + 200, + update_opened_buffers + ) + events.define_autocmd_event(events.VIM_BUFFER_ENTER, { "BufEnter", "BufWinEnter" }, 0) + events.define_autocmd_event( + events.VIM_BUFFER_MODIFIED_SET, + { "BufModifiedSet" }, + 0, + update_opened_buffers + ) + events.define_autocmd_event(events.VIM_COLORSCHEME, { "ColorScheme" }, 0) + events.define_autocmd_event(events.VIM_CURSOR_MOVED, { "CursorMoved" }, 100) + events.define_autocmd_event(events.VIM_DIR_CHANGED, { "DirChanged" }, 200, nil, true) + events.define_autocmd_event(events.VIM_INSERT_LEAVE, { "InsertLeave" }, 200) + events.define_autocmd_event(events.VIM_LEAVE, { "VimLeavePre" }) + events.define_autocmd_event(events.VIM_RESIZED, { "VimResized" }, 100) + events.define_autocmd_event(events.VIM_TAB_CLOSED, { "TabClosed" }) + events.define_autocmd_event(events.VIM_TERMINAL_ENTER, { "TermEnter" }, 0) + events.define_autocmd_event(events.VIM_TEXT_CHANGED_NORMAL, { "TextChanged" }, 200) + events.define_autocmd_event(events.VIM_WIN_CLOSED, { "WinClosed" }) + events.define_autocmd_event(events.VIM_WIN_ENTER, { "WinEnter" }, 0, nil, true) + + events.define_autocmd_event(events.GIT_EVENT, { "User FugitiveChanged" }, 100) + events.define_event(events.GIT_STATUS_CHANGED, { debounce_frequency = 0 }) + events_setup = true + + events.subscribe({ + event = events.VIM_LEAVE, + handler = function() + events.clear_all_events() + end, + }) + + events.subscribe({ + event = events.VIM_RESIZED, + handler = function() + require("neo-tree.ui.renderer").update_floating_window_layouts() + end, + }) +end + +local prior_window_options = {} + +--- Store the current window options so we can restore them when we close the tree. +--- @param winid number | nil The window id to store the options for, defaults to current window +local store_local_window_settings = function(winid) + winid = winid or vim.api.nvim_get_current_win() + local neo_tree_settings_applied, _ = + pcall(vim.api.nvim_win_get_var, winid, "neo_tree_settings_applied") + if neo_tree_settings_applied then + -- don't store our own window settings + return + end + prior_window_options[tostring(winid)] = { + cursorline = vim.wo.cursorline, + cursorlineopt = vim.wo.cursorlineopt, + foldcolumn = vim.wo.foldcolumn, + wrap = vim.wo.wrap, + list = vim.wo.list, + spell = vim.wo.spell, + number = vim.wo.number, + relativenumber = vim.wo.relativenumber, + winhighlight = vim.wo.winhighlight, + } +end + +--- Restore the window options for the current window +--- @param winid number | nil The window id to restore the options for, defaults to current window +local restore_local_window_settings = function(winid) + winid = winid or vim.api.nvim_get_current_win() + -- return local window settings to their prior values + local wo = prior_window_options[tostring(winid)] + if wo then + vim.wo.cursorline = wo.cursorline + vim.wo.cursorlineopt = wo.cursorlineopt + vim.wo.foldcolumn = wo.foldcolumn + vim.wo.wrap = wo.wrap + vim.wo.list = wo.list + vim.wo.spell = wo.spell + vim.wo.number = wo.number + vim.wo.relativenumber = wo.relativenumber + vim.wo.winhighlight = wo.winhighlight + log.debug("Window settings restored") + vim.api.nvim_win_set_var(0, "neo_tree_settings_applied", false) + else + log.debug("No window settings to restore") + end +end + +local last_buffer_enter_filetype = nil +M.buffer_enter_event = function() + -- if it is a neo-tree window, just set local options + if vim.bo.filetype == "neo-tree" then + if last_buffer_enter_filetype == "neo-tree" then + -- we've switched to another neo-tree window + events.fire_event(events.NEO_TREE_BUFFER_LEAVE) + else + store_local_window_settings() + end + vim.cmd([[ + setlocal cursorline + setlocal cursorlineopt=line + setlocal nowrap + setlocal nolist nospell nonumber norelativenumber + ]]) + + local winhighlight = + "Normal:NeoTreeNormal,NormalNC:NeoTreeNormalNC,SignColumn:NeoTreeSignColumn,CursorLine:NeoTreeCursorLine,FloatBorder:NeoTreeFloatBorder,StatusLine:NeoTreeStatusLine,StatusLineNC:NeoTreeStatusLineNC,VertSplit:NeoTreeVertSplit,EndOfBuffer:NeoTreeEndOfBuffer" + if vim.version().minor >= 7 then + vim.cmd("setlocal winhighlight=" .. winhighlight .. ",WinSeparator:NeoTreeWinSeparator") + else + vim.cmd("setlocal winhighlight=" .. winhighlight) + end + + events.fire_event(events.NEO_TREE_BUFFER_ENTER) + last_buffer_enter_filetype = vim.bo.filetype + vim.api.nvim_win_set_var(0, "neo_tree_settings_applied", true) + return + end + + if vim.bo.filetype == "neo-tree-popup" then + vim.cmd([[ + setlocal winhighlight=Normal:NeoTreeFloatNormal,FloatBorder:NeoTreeFloatBorder + setlocal nolist nospell nonumber norelativenumber + ]]) + events.fire_event(events.NEO_TREE_POPUP_BUFFER_ENTER) + last_buffer_enter_filetype = vim.bo.filetype + return + end + + if last_buffer_enter_filetype == "neo-tree" then + events.fire_event(events.NEO_TREE_BUFFER_LEAVE) + end + if last_buffer_enter_filetype == "neo-tree-popup" then + events.fire_event(events.NEO_TREE_POPUP_BUFFER_LEAVE) + end + last_buffer_enter_filetype = vim.bo.filetype + + -- For all others, make sure another buffer is not hijacking our window + -- ..but not if the position is "current" + local prior_buf = vim.fn.bufnr("#") + if prior_buf < 1 then + return + end + local prior_type = vim.api.nvim_buf_get_option(prior_buf, "filetype") + + -- there is nothing more we want to do with floating windows + -- but when prior_type is neo-tree we might need to redirect buffer somewhere else. + if utils.is_floating() and prior_type ~= "neo-tree" then + return + end + + -- if vim is trying to open a dir, then we hijack it + if netrw.hijack() then + return + end + + if prior_type == "neo-tree" then + local success, position = pcall(vim.api.nvim_buf_get_var, prior_buf, "neo_tree_position") + if not success then + -- just bail out now, the rest of these lookups will probably fail too. + return + end + + if position == "current" then + -- nothing to do here, files are supposed to open in same window + return + end + + local current_tabid = vim.api.nvim_get_current_tabpage() + local neo_tree_tabid = vim.api.nvim_buf_get_var(prior_buf, "neo_tree_tabid") + if neo_tree_tabid ~= current_tabid then + -- This a new tab, so the alternate being neo-tree doesn't matter. + return + end + local neo_tree_winid = vim.api.nvim_buf_get_var(prior_buf, "neo_tree_winid") + local current_winid = vim.api.nvim_get_current_win() + if neo_tree_winid ~= current_winid then + -- This is not the neo-tree window, so the alternate being neo-tree doesn't matter. + return + end + + local bufname = vim.api.nvim_buf_get_name(0) + log.debug("redirecting buffer " .. bufname .. " to new split") + vim.cmd("b#") + -- Using schedule at this point fixes problem with syntax + -- highlighting in the buffer. I also prevents errors with diagnostics + -- trying to work with the buffer as it's being closed. + vim.schedule(function() + -- try to delete the buffer, only because if it was new it would take + -- on options from the neo-tree window that are undesirable. + pcall(vim.cmd, "bdelete " .. bufname) + local fake_state = { + window = { + position = position, + }, + } + utils.open_file(fake_state, bufname) + end) + end +end + +M.win_enter_event = function() + local win_id = vim.api.nvim_get_current_win() + if utils.is_floating(win_id) then + return + end + + -- if the new win is not a floating window, make sure all neo-tree floats are closed + manager.close_all("float") + + if M.config.close_if_last_window then + local tabid = vim.api.nvim_get_current_tabpage() + local wins = utils.get_value(M, "config.prior_windows", {})[tabid] + local prior_exists = utils.truthy(wins) + local non_floating_wins = vim.tbl_filter(function(win) + return not utils.is_floating(win) + end, vim.api.nvim_tabpage_list_wins(tabid)) + local win_count = #non_floating_wins + log.trace("checking if last window") + log.trace("prior window exists = ", prior_exists) + log.trace("win_count: ", win_count) + if prior_exists and win_count == 1 and vim.o.filetype == "neo-tree" then + local position = vim.api.nvim_buf_get_var(0, "neo_tree_position") + local source = vim.api.nvim_buf_get_var(0, "neo_tree_source") + if position ~= "current" then + -- close_if_last_window just doesn't make sense for a split style + log.trace("last window, closing") + local state = require("neo-tree.sources.manager").get_state(source) + if state == nil then + return + end + local mod = utils.get_opened_buffers() + log.debug("close_if_last_window, modified files found: ", vim.inspect(mod)) + for filename, buf_info in pairs(mod) do + if buf_info.modified then + local buf_name, message + if vim.startswith(filename, "[No Name]#") then + buf_name = string.sub(filename, 11) + message = "Cannot close because an unnamed buffer is modified. Please save or discard this file." + else + buf_name = filename + message = "Cannot close because one of the files is modified. Please save or discard changes." + end + log.trace("close_if_last_window, showing unnamed modified buffer: ", filename) + vim.schedule(function() + log.warn(message) + vim.cmd("rightbelow vertical split") + vim.api.nvim_win_set_width(win_id, state.window.width or 40) + vim.cmd("b " .. buf_name) + end) + return + end + end + vim.cmd("q!") + return + end + end + end + + if vim.o.filetype == "neo-tree" then + local _, position = pcall(vim.api.nvim_buf_get_var, 0, "neo_tree_position") + if position == "current" then + -- make sure the buffer wasn't moved to a new window + local neo_tree_winid = vim.api.nvim_buf_get_var(0, "neo_tree_winid") + local current_winid = vim.api.nvim_get_current_win() + local current_bufnr = vim.api.nvim_get_current_buf() + if neo_tree_winid ~= current_winid then + -- At this point we know that either the neo-tree window was split, + -- or the neo-tree buffer is being shown in another window for some other reason. + -- Sometime the split is just the first step in the process of opening somethig else, + -- so instead of fixing this right away, we add a short delay and check back again to see + -- if the buffer is still in this window. + local old_state = manager.get_state("filesystem", nil, neo_tree_winid) + vim.schedule(function() + local bufnr = vim.api.nvim_get_current_buf() + if bufnr ~= current_bufnr then + -- The neo-tree buffer was replaced with something else, so we don't need to do anything. + log.trace("neo-tree buffer replaced with something else - no further action required") + return + end + -- create a new tree for this window + local state = manager.get_state("filesystem", nil, current_winid) + state.path = old_state.path + state.current_position = "current" + local renderer = require("neo-tree.ui.renderer") + state.force_open_folders = renderer.get_expanded_nodes(old_state.tree) + require("neo-tree.sources.filesystem")._navigate_internal(state, nil, nil, nil, false) + end) + return + end + end + -- it's a neo-tree window, ignore + return + end + + M.config.prior_windows = M.config.prior_windows or {} + + local tabid = vim.api.nvim_get_current_tabpage() + local tab_windows = M.config.prior_windows[tabid] + if tab_windows == nil then + tab_windows = {} + M.config.prior_windows[tabid] = tab_windows + end + table.insert(tab_windows, win_id) + + -- prune the history when it gets too big + if #tab_windows > 100 then + local new_array = {} + local win_count = #tab_windows + for i = 80, win_count do + table.insert(new_array, tab_windows[i]) + end + M.config.prior_windows[tabid] = new_array + end +end + +M.set_log_level = function(level) + log.set_level(level) +end + +local function merge_global_components_config(components, config) + local indent_exists = false + local merged_components = {} + local do_merge + + do_merge = function(component) + local name = component[1] + if type(name) == "string" then + if name == "indent" then + indent_exists = true + end + local merged = { name } + local global_config = config.default_component_configs[name] + if global_config then + for k, v in pairs(global_config) do + merged[k] = v + end + end + for k, v in pairs(component) do + merged[k] = v + end + if name == "container" then + for i, child in ipairs(component.content) do + merged.content[i] = do_merge(child) + end + end + return merged + else + log.error("component name is the wrong type", component) + end + end + + for _, component in ipairs(components) do + local merged = do_merge(component) + table.insert(merged_components, merged) + end + + -- If the indent component is not specified, then add it. + -- We do this because it used to be implicitly added, so we don't want to + -- break any existing configs. + if not indent_exists then + local indent = { "indent" } + for k, v in pairs(config.default_component_configs.indent or {}) do + indent[k] = v + end + table.insert(merged_components, 1, indent) + end + return merged_components +end + +local merge_renderers = function(default_config, source_default_config, user_config) + -- This can't be a deep copy/merge. If a renderer is specified in the target it completely + -- replaces the base renderer. + + if source_default_config == nil then + -- first override the default config global renderer with the user's global renderers + for name, renderer in pairs(user_config.renderers or {}) do + log.debug("overriding global renderer for " .. name) + default_config.renderers[name] = renderer + end + else + -- then override the global renderers with the source specific renderers + source_default_config.renderers = source_default_config.renderers or {} + for name, renderer in pairs(default_config.renderers or {}) do + if source_default_config.renderers[name] == nil then + log.debug("overriding source renderer for " .. name) + local r = {} + -- Only copy components that exist in the target source. + -- This alllows us to specify global renderers that include components from all sources, + -- even if some of those components are not universal + for _, value in ipairs(renderer) do + if value[1] and source_default_config.components[value[1]] ~= nil then + table.insert(r, value) + end + end + source_default_config.renderers[name] = r + end + end + + -- if user sets renderers, completely wipe the default ones + local source_name = source_default_config.name + for name, _ in pairs(source_default_config.renderers) do + local user = utils.get_value(user_config, source_name .. ".renderers." .. name) + if user then + source_default_config.renderers[name] = nil + end + end + end +end + +M.merge_config = function(user_config, is_auto_config) + local default_config = vim.deepcopy(defaults) + user_config = vim.deepcopy(user_config or {}) + + local migrations = require("neo-tree.setup.deprecations").migrate(user_config) + if #migrations > 0 then + -- defer to make sure it is the last message printed + vim.defer_fn(function() + vim.cmd( + "echohl WarningMsg | echo 'Some options have changed, please run `:Neotree migrations` to see the changes' | echohl NONE" + ) + end, 50) + end + + if user_config.log_level ~= nil then + M.set_log_level(user_config.log_level) + end + log.use_file(user_config.log_to_file, true) + log.debug("setup") + + events.clear_all_events() + define_events() + + -- Prevent accidentally opening another file in the neo-tree window. + events.subscribe({ + event = events.VIM_BUFFER_ENTER, + handler = M.buffer_enter_event, + }) + + -- Setup autocmd for neo-tree BufLeave, to restore window settings. + -- This is set to happen just before leaving the window. + -- The patterns used should ensure it only runs in neo-tree windows where position = "current" + local augroup = vim.api.nvim_create_augroup("NeoTree_BufLeave", { clear = true }) + local bufleave = function(data) + -- Vim patterns in autocmds are not quite precise enough + -- so we are doing a second stage filter in lua + local pattern = "neo%-tree [^ ]+ %[1%d%d%d%]" + if string.match(data.file, pattern) then + restore_local_window_settings() + end + end + vim.api.nvim_create_autocmd({ "BufWinLeave" }, { + group = augroup, + pattern = "neo-tree *", + callback = bufleave, + }) + + if user_config.event_handlers ~= nil then + for _, handler in ipairs(user_config.event_handlers) do + events.subscribe(handler) + end + end + + highlights.setup() + + -- used to either limit the sources that or loaded, or add extra external sources + local all_sources = {} + local all_source_names = {} + for _, source in ipairs(user_config.sources or default_config.sources) do + local parts = utils.split(source, ".") + local name = parts[#parts] + local is_internal_ns, is_external_ns = false, false + local module + + if #parts == 1 then + -- might be a module name in the internal namespace + is_internal_ns, module = pcall(require, "neo-tree.sources." .. source) + end + if is_internal_ns then + name = module.name or name + all_sources[name] = "neo-tree.sources." .. name + else + -- fully qualified module name + -- or just a root level module name + is_external_ns, module = pcall(require, source) + if is_external_ns then + name = module.name or name + all_sources[name] = source + else + log.error("Source module not found", source) + name = nil + end + end + if name then + default_config[name] = module.default_config or default_config[name] + table.insert(all_source_names, name) + end + end + log.debug("Sources to load: ", vim.inspect(all_sources)) + require("neo-tree.command.parser").setup(all_source_names) + + -- setup the default values for all sources + normalize_mappings(default_config) + normalize_mappings(user_config) + merge_renderers(default_config, nil, user_config) + + for source_name, mod_root in pairs(all_sources) do + local module = require(mod_root) + default_config[source_name] = default_config[source_name] + or { + renderers = {}, + components = {}, + } + local source_default_config = default_config[source_name] + source_default_config.components = module.components or require(mod_root .. ".components") + source_default_config.commands = module.commands or require(mod_root .. ".commands") + source_default_config.name = source_name + source_default_config.display_name = module.display_name or source_default_config.name + + if user_config.use_default_mappings == false then + default_config.window.mappings = {} + source_default_config.window.mappings = {} + end + -- Make sure all the mappings are normalized so they will merge properly. + normalize_mappings(source_default_config) + normalize_mappings(user_config[source_name]) + -- merge the global config with the source specific config + source_default_config.window = vim.tbl_deep_extend( + "force", + default_config.window or {}, + source_default_config.window or {}, + user_config.window or {} + ) + + merge_renderers(default_config, source_default_config, user_config) + + --validate the window.position + local pos_key = source_name .. ".window.position" + local position = utils.get_value(user_config, pos_key, "left", true) + local valid_positions = { + left = true, + right = true, + top = true, + bottom = true, + float = true, + current = true, + } + if not valid_positions[position] then + log.error("Invalid value for ", pos_key, ": ", position) + user_config[source_name].window.position = "left" + end + end + --print(vim.inspect(default_config.filesystem)) + + -- Moving user_config.sources to user_config.orig_sources + user_config.orig_sources = user_config.sources and user_config.sources or {} + + -- apply the users config + M.config = vim.tbl_deep_extend("force", default_config, user_config) + + -- RE: 873, fixes issue with invalid source checking by overriding + -- source table with name table + -- Setting new "sources" to be the parsed names of the sources + M.config.sources = all_source_names + + if ( M.config.source_selector.winbar or M.config.source_selector.statusline ) + and M.config.source_selector.sources + and not user_config.default_source then + -- Set the default source to the head of these + -- This resolves some weirdness with the source selector having + -- a different "head" item than our current default. + -- Removing this line makes Neo-tree show the "filesystem" + -- source instead of whatever the first item in the config is. + -- Probably don't remove this unless you have a better fix for that + M.config.default_source = M.config.source_selector.sources[1].source + end + -- Check if the default source is not included in config.sources + -- log a warning and then "pick" the first in the sources list + local match = false + for _, source in ipairs(M.config.sources) do + if source == M.config.default_source then + match = true + break + end + end + if not match and M.config.default_source ~= "last" then + M.config.default_source = M.config.sources[1] + log.warn(string.format("Invalid default source found in configuration. Using first available source: %s", M.config.default_source)) + end + + if not M.config.enable_git_status then + M.config.git_status_async = false + end + + -- Validate that the source_selector.sources are all available and if any + -- aren't, remove them + local source_selector_sources = {} + for _, ss_source in ipairs(M.config.source_selector.sources or {}) do + local source_match = false + for _, source in ipairs(M.config.sources) do + if ss_source.source == source then + source_match = true + break + end + end + if source_match then + table.insert(source_selector_sources, ss_source) + else + log.debug(string.format("Unable to locate Neo-tree extension %s", ss_source.source)) + end + end + M.config.source_selector.sources = source_selector_sources + + file_nesting.setup(M.config.nesting_rules) + + for source_name, mod_root in pairs(all_sources) do + for name, rndr in pairs(M.config[source_name].renderers) do + M.config[source_name].renderers[name] = merge_global_components_config(rndr, M.config) + end + local module = require(mod_root) + if M.config.commands then + M.config[source_name].commands = + vim.tbl_extend("keep", M.config[source_name].commands or {}, M.config.commands) + end + manager.setup(source_name, M.config[source_name], M.config, module) + manager.redraw(source_name) + end + + if M.config.auto_clean_after_session_restore then + require("neo-tree.ui.renderer").clean_invalid_neotree_buffers(false) + events.subscribe({ + event = events.VIM_AFTER_SESSION_LOAD, + handler = function() + require("neo-tree.ui.renderer").clean_invalid_neotree_buffers(true) + end, + }) + end + + events.subscribe({ + event = events.VIM_COLORSCHEME, + handler = highlights.setup, + id = "neo-tree-highlight", + }) + + events.subscribe({ + event = events.VIM_WIN_ENTER, + handler = M.win_enter_event, + id = "neo-tree-win-enter", + }) + + --Dispose ourselves if the tab closes + events.subscribe({ + event = events.VIM_TAB_CLOSED, + handler = function(args) + local tabnr = tonumber(args.afile) + log.debug("VIM_TAB_CLOSED: disposing state for tabnr", tabnr) + -- Internally we use tabids to track state but is tabnr of a tab that has already been + -- closed so there is no way to get its tabid. Instead dispose all tabs that are no longer valid. + -- Must be scheduled because nvim_tabpage_is_valid does not work inside TabClosed event callback. + vim.schedule_wrap(manager.dispose_invalid_tabs)() + end, + }) + + --Dispose ourselves if the tab closes + events.subscribe({ + event = events.VIM_WIN_CLOSED, + handler = function(args) + local winid = tonumber(args.afile) + log.debug("VIM_WIN_CLOSED: disposing state for window", winid) + manager.dispose_window(winid) + end, + }) + + local rt = utils.get_value(M.config, "resize_timer_interval", 50, true) + require("neo-tree.ui.renderer").resize_timer_interval = rt + + if M.config.enable_cursor_hijack then + hijack_cursor.setup() + end + + return M.config +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/setup/mapping-helper.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/setup/mapping-helper.lua new file mode 100644 index 00000000..79fc3910 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/setup/mapping-helper.lua @@ -0,0 +1,62 @@ +local utils = require("neo-tree.utils") + +local M = {} + +M.normalize_map_key = function(key) + if key == nil then + return nil + end + if key:match("^<[^>]+>$") then + local parts = utils.split(key, "-") + if #parts == 2 then + local mod = parts[1]:lower() + if mod == " 2 then + alpha = alpha:lower() + end + key = string.format("%s-%s", mod, alpha) + return key + else + key = key:lower() + if key == "" then + return "" + elseif key == "" then + return "" + elseif key == "" then + return "" + end + end + end + return key +end + +M.normalize_map = function(map) + local new_map = {} + for key, value in pairs(map) do + local normalized_key = M.normalize_map_key(key) + if normalized_key ~= nil then + new_map[normalized_key] = value + end + end + return new_map +end + +local tests = { + { "", "" }, + { "", "" }, + { "", "" }, + { "", "" }, + { "", "" }, + { "", "" }, + { "", "" }, + { "", "" }, +} +for _, test in ipairs(tests) do + local key = M.normalize_map_key(test[1]) + assert(key == test[2], string.format("%s != %s", key, test[2])) +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/setup/netrw.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/setup/netrw.lua new file mode 100644 index 00000000..e5775609 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/setup/netrw.lua @@ -0,0 +1,103 @@ +local utils = require("neo-tree.utils") +local log = require("neo-tree.log") +local manager = require("neo-tree.sources.manager") +local command = require("neo-tree.command") +local M = {} + +local get_position = function(source_name) + local nt = require("neo-tree") + local pos = utils.get_value(nt.config, source_name .. ".window.position", "left", true) + return pos +end + +M.get_hijack_netrw_behavior = function() + local nt = require("neo-tree") + local option = "filesystem.hijack_netrw_behavior" + local hijack_behavior = utils.get_value(nt.config, option, "open_default", true) + if hijack_behavior == "disabled" then + return hijack_behavior + elseif hijack_behavior == "open_default" then + return hijack_behavior + elseif hijack_behavior == "open_current" then + return hijack_behavior + else + log.error("Invalid value for " .. option .. ": " .. hijack_behavior) + return "disabled" + end +end + +M.hijack = function() + local hijack_behavior = M.get_hijack_netrw_behavior() + if hijack_behavior == "disabled" then + return false + end + + -- ensure this is a directory + local bufname = vim.api.nvim_buf_get_name(0) + local stats = vim.loop.fs_stat(bufname) + if not stats then + return false + end + if stats.type ~= "directory" then + return false + end + + -- record where we are now + local pos = get_position("filesystem") + local should_open_current = hijack_behavior == "open_current" or pos == "current" + local winid = vim.api.nvim_get_current_win() + local dir_bufnr = vim.api.nvim_get_current_buf() + + -- Now actually open the tree, with a very quick debounce because this may be + -- called multiple times in quick succession. + utils.debounce("hijack_netrw_" .. winid, function() + -- We will want to replace the "directory" buffer with either the "alternate" + -- buffer or a new blank one. + local replace_with_bufnr = vim.fn.bufnr("#") + local is_currently_neo_tree = false + if replace_with_bufnr > 0 then + if vim.api.nvim_buf_get_option(replace_with_bufnr, "filetype") == "neo-tree" then + -- don't hijack the current window if it's already a Neo-tree sidebar + local _, position = pcall(vim.api.nvim_buf_get_var, replace_with_bufnr, "neo_tree_position") + if position ~= "current" then + is_currently_neo_tree = true + else + replace_with_bufnr = -1 + end + end + end + if not should_open_current then + if replace_with_bufnr == dir_bufnr or replace_with_bufnr < 1 then + replace_with_bufnr = vim.api.nvim_create_buf(true, false) + log.trace("Created new buffer for netrw hijack", replace_with_bufnr) + end + end + if replace_with_bufnr > 0 then + log.trace("Replacing buffer in netrw hijack", replace_with_bufnr) + pcall(vim.api.nvim_win_set_buf, winid, replace_with_bufnr) + end + local remove_dir_buf = vim.schedule_wrap(function() + log.trace("Deleting buffer in netrw hijack", dir_bufnr) + pcall(vim.api.nvim_buf_delete, dir_bufnr, { force = true }) + end) + + local state + if should_open_current and not is_currently_neo_tree then + log.debug("hijack_netrw: opening current") + state = manager.get_state("filesystem", nil, winid) + state.current_position = "current" + elseif is_currently_neo_tree then + log.debug("hijack_netrw: opening in existing Neo-tree") + state = manager.get_state("filesystem") + else + log.debug("hijack_netrw: opening default") + manager.close_all_except("filesystem") + state = manager.get_state("filesystem") + end + require("neo-tree.sources.filesystem")._navigate_internal(state, bufname, nil, remove_dir_buf) + end, 10, utils.debounce_strategy.CALL_LAST_ONLY) + + return true +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/buffers/commands.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/buffers/commands.lua new file mode 100644 index 00000000..1d67f58b --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/buffers/commands.lua @@ -0,0 +1,98 @@ +--This file should contain all commands meant to be used by mappings. + +local vim = vim +local cc = require("neo-tree.sources.common.commands") +local buffers = require("neo-tree.sources.buffers") +local utils = require("neo-tree.utils") +local manager = require("neo-tree.sources.manager") + +local M = {} + +local refresh = utils.wrap(manager.refresh, "buffers") +local redraw = utils.wrap(manager.redraw, "buffers") + +M.add = function(state) + cc.add(state, refresh) +end + +M.add_directory = function(state) + cc.add_directory(state, refresh) +end + +M.buffer_delete = function(state) + local node = state.tree:get_node() + if node then + if node.type == "message" then + return + end + vim.api.nvim_buf_delete(node.extra.bufnr, { force = false, unload = false }) + refresh() + end +end + +---Marks node as copied, so that it can be pasted somewhere else. +M.copy_to_clipboard = function(state) + cc.copy_to_clipboard(state, redraw) +end + +M.copy_to_clipboard_visual = function(state, selected_nodes) + cc.copy_to_clipboard_visual(state, selected_nodes, redraw) +end + +---Marks node as cut, so that it can be pasted (moved) somewhere else. +M.cut_to_clipboard = function(state) + cc.cut_to_clipboard(state, redraw) +end + +M.cut_to_clipboard_visual = function(state, selected_nodes) + cc.cut_to_clipboard_visual(state, selected_nodes, redraw) +end + +M.copy = function(state) + cc.copy(state, redraw) +end + +M.move = function(state) + cc.move(state, redraw) +end + +M.show_debug_info = cc.show_debug_info + +---Pastes all items from the clipboard to the current directory. +M.paste_from_clipboard = function(state) + cc.paste_from_clipboard(state, refresh) +end + +M.delete = function(state) + cc.delete(state, refresh) +end + +---Navigate up one level. +M.navigate_up = function(state) + local parent_path, _ = utils.split_path(state.path) + buffers.navigate(state, parent_path) +end + +M.refresh = refresh + +M.rename = function(state) + cc.rename(state, refresh) +end + +M.set_root = function(state) + local node = state.tree:get_node() + while node and node.type ~= "directory" do + local parent_id = node:get_parent_id() + node = parent_id and state.tree:get_node(parent_id) or nil + end + + if not node then + return + end + + buffers.navigate(state, node:get_id()) +end + +cc._add_common_commands(M) + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/buffers/components.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/buffers/components.lua new file mode 100644 index 00000000..0d6d3b1a --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/buffers/components.lua @@ -0,0 +1,48 @@ +-- This file contains the built-in components. Each componment is a function +-- that takes the following arguments: +-- config: A table containing the configuration provided by the user +-- when declaring this component in their renderer config. +-- node: A NuiNode object for the currently focused node. +-- state: The current state of the source providing the items. +-- +-- The function should return either a table, or a list of tables, each of which +-- contains the following keys: +-- text: The text to display for this item. +-- highlight: The highlight group to apply to this text. + +local highlights = require("neo-tree.ui.highlights") +local common = require("neo-tree.sources.common.components") +local utils = require("neo-tree.utils") + +local M = {} + +M.name = function(config, node, state) + local highlight = config.highlight or highlights.FILE_NAME_OPENED + local name = node.name + if node.type == "directory" then + if node:get_depth() == 1 then + highlight = highlights.ROOT_NAME + name = "OPEN BUFFERS in " .. name + else + highlight = highlights.DIRECTORY_NAME + end + elseif node.type == "terminal" then + if node:get_depth() == 1 then + highlight = highlights.ROOT_NAME + name = "TERMINALS" + else + highlight = highlights.FILE_NAME + end + elseif config.use_git_status_colors then + local git_status = state.components.git_status({}, node, state) + if git_status and git_status.highlight then + highlight = git_status.highlight + end + end + return { + text = name, + highlight = highlight, + } +end + +return vim.tbl_deep_extend("force", common, M) diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/buffers/init.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/buffers/init.lua new file mode 100644 index 00000000..b97a5c9f --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/buffers/init.lua @@ -0,0 +1,201 @@ +--This file should have all functions that are in the public api and either set +--or read the state of this source. + +local vim = vim +local utils = require("neo-tree.utils") +local renderer = require("neo-tree.ui.renderer") +local items = require("neo-tree.sources.buffers.lib.items") +local events = require("neo-tree.events") +local manager = require("neo-tree.sources.manager") +local git = require("neo-tree.git") + +local M = { + name = "buffers", + display_name = " 󰈚 Buffers " +} + +local wrap = function(func) + return utils.wrap(func, M.name) +end + +local get_state = function() + return manager.get_state(M.name) +end + +local follow_internal = function() + if vim.bo.filetype == "neo-tree" or vim.bo.filetype == "neo-tree-popup" then + return + end + local bufnr = vim.api.nvim_get_current_buf() + local path_to_reveal = manager.get_path_to_reveal(true) or tostring(bufnr) + + local state = get_state() + if state.current_position == "float" then + return false + end + if not state.path then + return false + end + local window_exists = renderer.window_exists(state) + if window_exists then + local node = state.tree and state.tree:get_node() + if node then + if node:get_id() == path_to_reveal then + -- already focused + return false + end + end + renderer.focus_node(state, path_to_reveal, true) + end +end + +M.follow = function() + if vim.fn.bufname(0) == "COMMIT_EDITMSG" then + return false + end + utils.debounce("neo-tree-buffer-follow", function() + return follow_internal() + end, 100, utils.debounce_strategy.CALL_LAST_ONLY) +end + +local buffers_changed_internal = function() + for _, tabid in ipairs(vim.api.nvim_list_tabpages()) do + local state = manager.get_state(M.name, tabid) + if state.path and renderer.window_exists(state) then + items.get_opened_buffers(state) + if state.follow_current_file.enabled then + follow_internal() + end + end + end +end + +---Calld by autocmd when any buffer is open, closed, renamed, etc. +M.buffers_changed = function() + utils.debounce( + "buffers_changed", + buffers_changed_internal, + 100, + utils.debounce_strategy.CALL_LAST_ONLY + ) +end + +---Navigate to the given path. +---@param path string Path to navigate to. If empty, will navigate to the cwd. +M.navigate = function(state, path, path_to_reveal, callback, async) + state.dirty = false + local path_changed = false + if path == nil then + path = vim.fn.getcwd() + end + if path ~= state.path then + state.path = path + path_changed = true + end + if path_to_reveal then + renderer.position.set(state, path_to_reveal) + end + + items.get_opened_buffers(state) + + if path_changed and state.bind_to_cwd then + vim.api.nvim_command("tcd " .. path) + end + + if type(callback) == "function" then + vim.schedule(callback) + end +end + +---Configures the plugin, should be called before the plugin is used. +---@param config table Configuration table containing any keys that the user +--wants to change from the defaults. May be empty to accept default values. +M.setup = function(config, global_config) + --Configure events for before_render + if config.before_render then + --convert to new event system + manager.subscribe(M.name, { + event = events.BEFORE_RENDER, + handler = function(state) + local this_state = get_state() + if state == this_state then + config.before_render(this_state) + end + end, + }) + elseif global_config.enable_git_status then + manager.subscribe(M.name, { + event = events.BEFORE_RENDER, + handler = function(state) + local this_state = get_state() + if state == this_state then + state.git_status_lookup = git.status(state.git_base) + end + end, + }) + manager.subscribe(M.name, { + event = events.GIT_EVENT, + handler = M.buffers_changed, + }) + end + + local refresh_events = { + events.VIM_BUFFER_ADDED, + events.VIM_BUFFER_DELETED, + } + if global_config.enable_refresh_on_write then + table.insert(refresh_events, events.VIM_BUFFER_CHANGED) + end + for _, e in ipairs(refresh_events) do + manager.subscribe(M.name, { + event = e, + handler = function(args) + if args.afile == "" or utils.is_real_file(args.afile) then + M.buffers_changed() + end + end, + }) + end + + if config.bind_to_cwd then + manager.subscribe(M.name, { + event = events.VIM_DIR_CHANGED, + handler = wrap(manager.dir_changed), + }) + end + + if global_config.enable_diagnostics then + manager.subscribe(M.name, { + event = events.STATE_CREATED, + handler = function(state) + state.diagnostics_lookup = utils.get_diagnostic_counts() + end, + }) + manager.subscribe(M.name, { + event = events.VIM_DIAGNOSTIC_CHANGED, + handler = wrap(manager.diagnostics_changed), + }) + end + + --Configure event handlers for modified files + if global_config.enable_modified_markers then + manager.subscribe(M.name, { + event = events.VIM_BUFFER_MODIFIED_SET, + handler = wrap(manager.opened_buffers_changed), + }) + end + + -- Configure event handler for follow_current_file option + if config.follow_current_file.enabled then + manager.subscribe(M.name, { + event = events.VIM_BUFFER_ENTER, + handler = M.follow, + }) + manager.subscribe(M.name, { + event = events.VIM_TERMINAL_ENTER, + handler = M.follow, + }) + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/buffers/lib/items.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/buffers/lib/items.lua new file mode 100644 index 00000000..460cbf2b --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/buffers/lib/items.lua @@ -0,0 +1,112 @@ +local vim = vim +local renderer = require("neo-tree.ui.renderer") +local utils = require("neo-tree.utils") +local file_items = require("neo-tree.sources.common.file-items") +local log = require("neo-tree.log") + +local M = {} + +---Get a table of all open buffers, along with all parent paths of those buffers. +---The paths are the keys of the table, and all the values are 'true'. +M.get_opened_buffers = function(state) + if state.loading then + return + end + state.loading = true + local context = file_items.create_context() + context.state = state + -- Create root folder + local root = file_items.create_item(context, state.path, "directory") + root.name = vim.fn.fnamemodify(root.path, ":~") + root.loaded = true + root.search_pattern = state.search_pattern + context.folders[root.path] = root + local terminals = {} + + local function add_buffer(bufnr, path) + local is_loaded = vim.api.nvim_buf_is_loaded(bufnr) + if is_loaded or state.show_unloaded then + local is_listed = vim.fn.buflisted(bufnr) + if is_listed == 1 then + if path == "" then + path = "[No Name]" + end + local success, item = pcall(file_items.create_item, context, path, "file", bufnr) + if success then + item.extra = { + bufnr = bufnr, + is_listed = is_listed, + } + else + log.error("Error creating item for " .. path .. ": " .. item) + end + end + end + end + + local bufs = vim.api.nvim_list_bufs() + for _, b in ipairs(bufs) do + local path = vim.api.nvim_buf_get_name(b) + if vim.startswith(path, "term://") then + local name = path:match("term://(.*)//.*") + local abs_path = vim.fn.fnamemodify(name, ":p") + local has_title, title = pcall(vim.api.nvim_buf_get_var, b, "term_title") + local item = { + name = has_title and title or name, + ext = "terminal", + path = abs_path, + id = path, + type = "terminal", + loaded = true, + extra = { + bufnr = b, + is_listed = true, + }, + } + if utils.is_subpath(state.path, abs_path) then + table.insert(terminals, item) + end + elseif path == "" then + add_buffer(b, path) + else + if #state.path > 1 then + local rootsub = path:sub(1, #state.path) + -- make sure this is within the root path + if rootsub == state.path then + add_buffer(b, path) + end + else + add_buffer(b, path) + end + end + end + + local root_folders = { root } + + if #terminals > 0 then + local terminal_root = { + name = "Terminals", + id = "Terminals", + ext = "terminal", + type = "terminal", + children = terminals, + loaded = true, + search_pattern = state.search_pattern, + } + context.folders["Terminals"] = terminal_root + if state.terminals_first then + table.insert(root_folders, 1, terminal_root) + else + table.insert(root_folders, terminal_root) + end + end + state.default_expanded_nodes = {} + for id, _ in pairs(context.folders) do + table.insert(state.default_expanded_nodes, id) + end + file_items.advanced_sort(root.children, state) + renderer.show_nodes(root_folders, state) + state.loading = false +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/commands.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/commands.lua new file mode 100644 index 00000000..5b668384 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/commands.lua @@ -0,0 +1,889 @@ +--This file should contain all commands meant to be used by mappings. + +local vim = vim +local fs_actions = require("neo-tree.sources.filesystem.lib.fs_actions") +local utils = require("neo-tree.utils") +local renderer = require("neo-tree.ui.renderer") +local events = require("neo-tree.events") +local inputs = require("neo-tree.ui.inputs") +local popups = require("neo-tree.ui.popups") +local log = require("neo-tree.log") +local help = require("neo-tree.sources.common.help") +local Preview = require("neo-tree.sources.common.preview") +local async = require("plenary.async") +local node_expander = require("neo-tree.sources.common.node_expander") + +---Gets the node parent folder +---@param state table to look for nodes +---@return table? node +local function get_folder_node(state) + local tree = state.tree + local node = tree:get_node() + local last_id = node:get_id() + + while node do + local insert_as_local = state.config.insert_as + local insert_as_global = require("neo-tree").config.window.insert_as + local use_parent + if insert_as_local then + use_parent = insert_as_local == "sibling" + else + use_parent = insert_as_global == "sibling" + end + + local is_open_dir = node.type == "directory" and (node:is_expanded() or node.empty_expanded) + if use_parent and not is_open_dir then + return tree:get_node(node:get_parent_id()) + end + + if node.type == "directory" then + return node + end + + local parent_id = node:get_parent_id() + if not parent_id or parent_id == last_id then + return node + else + last_id = parent_id + node = tree:get_node(parent_id) + end + end +end + +---The using_root_directory is used to decide what part of the filename to show +-- the user when asking for a new filename to e.g. create, copy to or move to. +---@param state table The state of the source +---@return string The root path from which the relative source path should be taken +local function get_using_root_directory(state) + -- default to showing only the basename of the path + local using_root_directory = get_folder_node(state):get_id() + local show_path = state.config.show_path + if show_path == "absolute" then + using_root_directory = "" + elseif show_path == "relative" then + using_root_directory = state.path + elseif show_path ~= nil and show_path ~= "none" then + log.warn( + 'A neo-tree mapping was setup with a config.show_path option with invalid value: "' + .. show_path + .. '", falling back to its default: nil/"none"' + ) + end + return using_root_directory +end + +local M = {} + +---Adds all missing common commands to the given module +---@param to_source_command_module table The commands module for a source +---@param pattern string? A pattern specifying which commands to add, nil to add all +M._add_common_commands = function(to_source_command_module, pattern) + for name, func in pairs(M) do + if + type(name) == "string" + and not to_source_command_module[name] + and (not pattern or name:find(pattern)) + and not name:find("^_") + then + to_source_command_module[name] = func + end + end +end + +---Add a new file or dir at the current node +---@param state table The state of the source +---@param callback function The callback to call when the command is done. Called with the parent node as the argument. +M.add = function(state, callback) + local node = get_folder_node(state) + local in_directory = node:get_id() + local using_root_directory = get_using_root_directory(state) + fs_actions.create_node(in_directory, callback, using_root_directory) +end + +---Add a new file or dir at the current node +---@param state table The state of the source +---@param callback function The callback to call when the command is done. Called with the parent node as the argument. +M.add_directory = function(state, callback) + local node = get_folder_node(state) + local in_directory = node:get_id() + local using_root_directory = get_using_root_directory(state) + fs_actions.create_directory(in_directory, callback, using_root_directory) +end + +---Expand all nodes +---@param state table The state of the source +---@param node table A node to expand +---@param prefetcher table an object with two methods `prefetch(state, node)` and `should_prefetch(node) => boolean` +M.expand_all_nodes = function(state, node, prefetcher) + log.debug("Expanding all nodes under " .. node:get_id()) + if prefetcher == nil then + prefetcher = node_expander.default_prefetcher + end + + renderer.position.set(state, nil) + + local task = function() + node_expander.expand_directory_recursively(state, node, prefetcher) + end + async.run(task, function() + log.debug("All nodes expanded - redrawing") + renderer.redraw(state) + end) +end + +M.close_node = function(state, callback) + local tree = state.tree + local node = tree:get_node() + local parent_node = tree:get_node(node:get_parent_id()) + local target_node + + if node:has_children() and node:is_expanded() then + target_node = node + else + target_node = parent_node + end + + local root = tree:get_nodes()[1] + local is_root = target_node:get_id() == root:get_id() + + if target_node and target_node:has_children() and not is_root then + target_node:collapse() + renderer.redraw(state) + renderer.focus_node(state, target_node:get_id()) + if + state.explicitly_opened_directories + and state.explicitly_opened_directories[target_node:get_id()] + then + state.explicitly_opened_directories[target_node:get_id()] = false + end + end +end + +M.close_all_subnodes = function(state) + local tree = state.tree + local node = tree:get_node() + local parent_node = tree:get_node(node:get_parent_id()) + local target_node + + if node:has_children() and node:is_expanded() then + target_node = node + else + target_node = parent_node + end + + renderer.collapse_all_nodes(tree, target_node:get_id()) + renderer.redraw(state) + renderer.focus_node(state, target_node:get_id()) + if + state.explicitly_opened_directories + and state.explicitly_opened_directories[target_node:get_id()] + then + state.explicitly_opened_directories[target_node:get_id()] = false + end +end + +M.close_all_nodes = function(state) + state.explicitly_opened_directories = {} + renderer.collapse_all_nodes(state.tree) + renderer.redraw(state) +end + +M.close_window = function(state) + renderer.close(state) +end + +M.toggle_auto_expand_width = function(state) + if state.window.position == "float" then + return + end + state.window.auto_expand_width = state.window.auto_expand_width == false + local width = utils.resolve_width(state.window.width) + if not state.window.auto_expand_width then + if (state.window.last_user_width or width) >= vim.api.nvim_win_get_width(0) then + state.window.last_user_width = width + end + vim.api.nvim_win_set_width(0, state.window.last_user_width) + state.win_width = state.window.last_user_width + state.longest_width_exact = 0 + log.trace(string.format("Collapse auto_expand_width.")) + end + renderer.redraw(state) +end + +local copy_node_to_clipboard = function(state, node) + state.clipboard = state.clipboard or {} + local existing = state.clipboard[node.id] + if existing and existing.action == "copy" then + state.clipboard[node.id] = nil + else + state.clipboard[node.id] = { action = "copy", node = node } + log.info("Copied " .. node.name .. " to clipboard") + end +end + +---Marks node as copied, so that it can be pasted somewhere else. +M.copy_to_clipboard = function(state, callback) + local node = state.tree:get_node() + if node.type == "message" then + return + end + copy_node_to_clipboard(state, node) + if callback then + callback() + end +end + +M.copy_to_clipboard_visual = function(state, selected_nodes, callback) + for _, node in ipairs(selected_nodes) do + if node.type ~= "message" then + copy_node_to_clipboard(state, node) + end + end + if callback then + callback() + end +end + +local cut_node_to_clipboard = function(state, node) + state.clipboard = state.clipboard or {} + local existing = state.clipboard[node.id] + if existing and existing.action == "cut" then + state.clipboard[node.id] = nil + else + state.clipboard[node.id] = { action = "cut", node = node } + log.info("Cut " .. node.name .. " to clipboard") + end +end + +---Marks node as cut, so that it can be pasted (moved) somewhere else. +M.cut_to_clipboard = function(state, callback) + local node = state.tree:get_node() + cut_node_to_clipboard(state, node) + if callback then + callback() + end +end + +M.cut_to_clipboard_visual = function(state, selected_nodes, callback) + for _, node in ipairs(selected_nodes) do + if node.type ~= "message" then + cut_node_to_clipboard(state, node) + end + end + if callback then + callback() + end +end + +-------------------------------------------------------------------------------- +-- Git commands +-------------------------------------------------------------------------------- + +M.git_add_file = function(state) + local node = state.tree:get_node() + if node.type == "message" then + return + end + local path = node:get_id() + local cmd = { "git", "add", path } + vim.fn.system(cmd) + events.fire_event(events.GIT_EVENT) +end + +M.git_add_all = function(state) + local cmd = { "git", "add", "-A" } + vim.fn.system(cmd) + events.fire_event(events.GIT_EVENT) +end + +M.git_commit = function(state, and_push) + local width = vim.fn.winwidth(0) - 2 + local row = vim.api.nvim_win_get_height(0) - 3 + local popup_options = { + relative = "win", + position = { + row = row, + col = 0, + }, + size = width, + } + + inputs.input("Commit message: ", "", function(msg) + local cmd = { "git", "commit", "-m", msg } + local title = "git commit" + local result = vim.fn.systemlist(cmd) + if vim.v.shell_error ~= 0 or (#result > 0 and vim.startswith(result[1], "fatal:")) then + popups.alert("ERROR: git commit", result) + return + end + if and_push then + title = "git commit && git push" + cmd = { "git", "push" } + local result2 = vim.fn.systemlist(cmd) + table.insert(result, "") + for i = 1, #result2 do + table.insert(result, result2[i]) + end + end + events.fire_event(events.GIT_EVENT) + popups.alert(title, result) + end, popup_options) +end + +M.git_commit_and_push = function(state) + M.git_commit(state, true) +end + +M.git_push = function(state) + inputs.confirm("Are you sure you want to push your changes?", function(yes) + if yes then + local result = vim.fn.systemlist({ "git", "push" }) + events.fire_event(events.GIT_EVENT) + popups.alert("git push", result) + end + end) +end + +M.git_unstage_file = function(state) + local node = state.tree:get_node() + if node.type == "message" then + return + end + local path = node:get_id() + local cmd = { "git", "reset", "--", path } + vim.fn.system(cmd) + events.fire_event(events.GIT_EVENT) +end + +M.git_revert_file = function(state) + local node = state.tree:get_node() + if node.type == "message" then + return + end + local path = node:get_id() + local cmd = { "git", "checkout", "HEAD", "--", path } + local msg = string.format("Are you sure you want to revert %s?", node.name) + inputs.confirm(msg, function(yes) + if yes then + vim.fn.system(cmd) + events.fire_event(events.GIT_EVENT) + end + end) +end + +-------------------------------------------------------------------------------- +-- END Git commands +-------------------------------------------------------------------------------- + +M.next_source = function(state) + local sources = require("neo-tree").config.sources + local sources = require("neo-tree").config.source_selector.sources + local next_source = sources[1] + for i, source_info in ipairs(sources) do + if source_info.source == state.name then + next_source = sources[i + 1] + if not next_source then + next_source = sources[1] + end + break + end + end + + require("neo-tree.command").execute({ + source = next_source.source, + position = state.current_position, + action = "focus", + }) +end + +M.prev_source = function(state) + local sources = require("neo-tree").config.sources + local sources = require("neo-tree").config.source_selector.sources + local next_source = sources[#sources] + for i, source_info in ipairs(sources) do + if source_info.source == state.name then + next_source = sources[i - 1] + if not next_source then + next_source = sources[#sources] + end + break + end + end + + require("neo-tree.command").execute({ + source = next_source.source, + position = state.current_position, + action = "focus", + }) +end + +local function set_sort(state, label) + local sort = state.sort or { label = "Name", direction = -1 } + if sort.label == label then + sort.direction = sort.direction * -1 + else + sort.label = label + sort.direction = -1 + end + state.sort = sort +end + +M.order_by_created = function(state) + set_sort(state, "Created") + state.sort_field_provider = function(node) + local stat = utils.get_stat(node) + return stat.birthtime and stat.birthtime.sec or 0 + end + require("neo-tree.sources.manager").refresh(state.name) +end + +M.order_by_modified = function(state) + set_sort(state, "Last Modified") + state.sort_field_provider = function(node) + local stat = utils.get_stat(node) + return stat.mtime and stat.mtime.sec or 0 + end + require("neo-tree.sources.manager").refresh(state.name) +end + +M.order_by_name = function(state) + set_sort(state, "Name") + state.sort_field_provider = nil + require("neo-tree.sources.manager").refresh(state.name) +end + +M.order_by_size = function(state) + set_sort(state, "Size") + state.sort_field_provider = function(node) + local stat = utils.get_stat(node) + return stat.size or 0 + end + require("neo-tree.sources.manager").refresh(state.name) +end + +M.order_by_type = function(state) + set_sort(state, "Type") + state.sort_field_provider = function(node) + return node.ext or node.type + end + require("neo-tree.sources.manager").refresh(state.name) +end + +M.order_by_git_status = function(state) + set_sort(state, "Git Status") + + state.sort_field_provider = function(node) + local git_status_lookup = state.git_status_lookup or {} + local git_status = git_status_lookup[node.path] + if git_status then + return git_status + end + + if node.filtered_by and node.filtered_by.gitignored then + return "!!" + else + return "" + end + end + + require("neo-tree.sources.manager").refresh(state.name) +end + +M.order_by_diagnostics = function(state) + set_sort(state, "Diagnostics") + + state.sort_field_provider = function(node) + local diag = state.diagnostics_lookup or {} + local diagnostics = diag[node.path] + if not diagnostics then + return 0 + end + if not diagnostics.severity_number then + return 0 + end + -- lower severity number means higher severity + return 5 - diagnostics.severity_number + end + + require("neo-tree.sources.manager").refresh(state.name) +end + +M.show_debug_info = function(state) + print(vim.inspect(state)) +end + +M.show_file_details = function(state) + local node = state.tree:get_node() + if node.type == "message" then + return + end + local stat = utils.get_stat(node) + local left = {} + local right = {} + table.insert(left, "Name") + table.insert(right, node.name) + table.insert(left, "Path") + table.insert(right, node:get_id()) + table.insert(left, "Type") + table.insert(right, node.type) + if stat.size then + table.insert(left, "Size") + table.insert(right, utils.human_size(stat.size)) + table.insert(left, "Created") + table.insert(right, os.date("%Y-%m-%d %I:%M %p", stat.birthtime.sec)) + table.insert(left, "Modified") + table.insert(right, os.date("%Y-%m-%d %I:%M %p", stat.mtime.sec)) + end + + local lines = {} + for i, v in ipairs(left) do + local line = string.format("%9s: %s", v, right[i]) + table.insert(lines, line) + end + + popups.alert("File Details", lines) +end + +---Pastes all items from the clipboard to the current directory. +---@param state table The state of the source +---@param callback function The callback to call when the command is done. Called with the parent node as the argument. +M.paste_from_clipboard = function(state, callback) + if state.clipboard then + local folder = get_folder_node(state):get_id() + -- Convert to list so to make it easier to pop items from the stack. + local clipboard_list = {} + for _, item in pairs(state.clipboard) do + table.insert(clipboard_list, item) + end + state.clipboard = nil + local handle_next_paste, paste_complete + + paste_complete = function(source, destination) + if callback then + local insert_as = require("neo-tree").config.window.insert_as + -- open the folder so the user can see the new files + local node = insert_as == "sibling" and state.tree:get_node() or state.tree:get_node(folder) + if not node then + log.warn("Could not find node for " .. folder) + end + callback(node, destination) + end + local next_item = table.remove(clipboard_list) + if next_item then + handle_next_paste(next_item) + end + end + + handle_next_paste = function(item) + if item.action == "copy" then + fs_actions.copy_node( + item.node.path, + folder .. utils.path_separator .. item.node.name, + paste_complete + ) + elseif item.action == "cut" then + fs_actions.move_node( + item.node.path, + folder .. utils.path_separator .. item.node.name, + paste_complete + ) + end + end + + local next_item = table.remove(clipboard_list) + if next_item then + handle_next_paste(next_item) + end + end +end + +---Copies a node to a new location, using typed input. +---@param state table The state of the source +---@param callback function The callback to call when the command is done. Called with the parent node as the argument. +M.copy = function(state, callback) + local node = state.tree:get_node() + if node.type == "message" then + return + end + local using_root_directory = get_using_root_directory(state) + fs_actions.copy_node(node.path, nil, callback, using_root_directory) +end + +---Moves a node to a new location, using typed input. +---@param state table The state of the source +---@param callback function The callback to call when the command is done. Called with the parent node as the argument. +M.move = function(state, callback) + local node = state.tree:get_node() + if node.type == "message" then + return + end + local using_root_directory = get_using_root_directory(state) + fs_actions.move_node(node.path, nil, callback, using_root_directory) +end + +M.delete = function(state, callback) + local tree = state.tree + local node = tree:get_node() + if node.type == "file" or node.type == "directory" then + fs_actions.delete_node(node.path, callback) + else + log.warn("The `delete` command can only be used on files and directories") + end +end + +M.delete_visual = function(state, selected_nodes, callback) + local paths_to_delete = {} + for _, node_to_delete in pairs(selected_nodes) do + if node_to_delete.type == "file" or node_to_delete.type == "directory" then + table.insert(paths_to_delete, node_to_delete.path) + end + end + fs_actions.delete_nodes(paths_to_delete, callback) +end + +M.preview = function(state) + Preview.show(state) +end + +M.revert_preview = function() + Preview.hide() +end +-- +-- Multi-purpose function to back out of whatever we are in +M.cancel = function(state) + if Preview.is_active() then + Preview.hide() + else + if state.current_position == "float" then + renderer.close_all_floating_windows() + end + end +end + +M.toggle_preview = function(state) + Preview.toggle(state) +end + +M.scroll_preview = function(state) + Preview.scroll(state) +end + +M.focus_preview = function() + Preview.focus() +end + +---Expands or collapses the current node. +M.toggle_node = function(state, toggle_directory) + local tree = state.tree + local node = tree:get_node() + if not utils.is_expandable(node) then + return + end + if node.type == "directory" and toggle_directory then + toggle_directory(node) + elseif node:has_children() then + local updated = false + if node:is_expanded() then + updated = node:collapse() + else + updated = node:expand() + end + if updated then + renderer.redraw(state) + end + end +end + +---Expands or collapses the current node. +M.toggle_directory = function(state, toggle_directory) + local tree = state.tree + local node = tree:get_node() + if node.type ~= "directory" then + return + end + M.toggle_node(state, toggle_directory) +end + +---Open file or directory +---@param state table The state of the source +---@param open_cmd string The vim command to use to open the file +---@param toggle_directory function The function to call to toggle a directory +---open/closed +local open_with_cmd = function(state, open_cmd, toggle_directory, open_file) + local tree = state.tree + local success, node = pcall(tree.get_node, tree) + if node.type == "message" then + return + end + if not (success and node) then + log.debug("Could not get node.") + return + end + + local function open() + M.revert_preview() + local path = node.path or node:get_id() + local bufnr = node.extra and node.extra.bufnr + if node.type == "terminal" then + path = node:get_id() + end + if type(open_file) == "function" then + open_file(state, path, open_cmd, bufnr) + else + utils.open_file(state, path, open_cmd, bufnr) + end + local extra = node.extra or {} + local pos = extra.position or extra.end_position + if pos ~= nil then + vim.api.nvim_win_set_cursor(0, { (pos[1] or 0) + 1, pos[2] or 0 }) + vim.api.nvim_win_call(0, function() + vim.cmd("normal! zvzz") -- expand folds and center cursor + end) + end + end + + local config = state.config or {} + if node.type ~= "directory" and config.no_expand_file ~= nil then + log.warn("`no_expand_file` options is deprecated, move to `expand_nested_files` (OPPOSITE)") + config.expand_nested_files = not config.no_expand_file + end + if node.type == "directory" then + M.toggle_node(state, toggle_directory) + elseif node:has_children() and config.expand_nested_files and not node:is_expanded() then + M.toggle_node(state, toggle_directory) + else + open() + end +end + +---Open file or directory in the closest window +---@param state table The state of the source +---@param toggle_directory function The function to call to toggle a directory +---open/closed +M.open = function(state, toggle_directory) + open_with_cmd(state, "e", toggle_directory) +end + +---Open file or directory in a split of the closest window +---@param state table The state of the source +---@param toggle_directory function The function to call to toggle a directory +---open/closed +M.open_split = function(state, toggle_directory) + open_with_cmd(state, "split", toggle_directory) +end + +---Open file or directory in a vertical split of the closest window +---@param state table The state of the source +---@param toggle_directory function The function to call to toggle a directory +---open/closed +M.open_vsplit = function(state, toggle_directory) + open_with_cmd(state, "vsplit", toggle_directory) +end + +---Open file or directory in a right below vertical split of the closest window +---@param state table The state of the source +---@param toggle_directory function The function to call to toggle a directory +---open/closed +M.open_rightbelow_vs = function(state, toggle_directory) + open_with_cmd(state, "rightbelow vs", toggle_directory) +end + +---Open file or directory in a left above vertical split of the closest window +---@param state table The state of the source +---@param toggle_directory function The function to call to toggle a directory +---open/closed +M.open_leftabove_vs = function(state, toggle_directory) + open_with_cmd(state, "leftabove vs", toggle_directory) +end + +---Open file or directory in a new tab +---@param state table The state of the source +---@param toggle_directory function The function to call to toggle a directory +---open/closed +M.open_tabnew = function(state, toggle_directory) + open_with_cmd(state, "tabnew", toggle_directory) +end + +---Open file or directory or focus it if a buffer already exists with it +---@param state table The state of the source +---@param toggle_directory function The function to call to toggle a directory +---open/closed +M.open_drop = function(state, toggle_directory) + open_with_cmd(state, "drop", toggle_directory) +end + +---Open file or directory in new tab or focus it if a buffer already exists with it +---@param state table The state of the source +---@param toggle_directory function The function to call to toggle a directory +---open/closed +M.open_tab_drop = function(state, toggle_directory) + open_with_cmd(state, "tab drop", toggle_directory) +end + +M.rename = function(state, callback) + local tree = state.tree + local node = tree:get_node() + if node.type == "message" then + return + end + fs_actions.rename_node(node.path, callback) +end + +---Marks potential windows with letters and will open the give node in the picked window. +---@param state table The state of the source +---@param path string The path to open +---@param cmd string Command that is used to perform action on picked window +local use_window_picker = function(state, path, cmd) + local success, picker = pcall(require, "window-picker") + if not success then + print( + "You'll need to install window-picker to use this command: https://github.com/s1n7ax/nvim-window-picker" + ) + return + end + local events = require("neo-tree.events") + local event_result = events.fire_event(events.FILE_OPEN_REQUESTED, { + state = state, + path = path, + open_cmd = cmd, + }) or {} + if event_result.handled then + events.fire_event(events.FILE_OPENED, path) + return + end + local picked_window_id = picker.pick_window() + if picked_window_id then + vim.api.nvim_set_current_win(picked_window_id) + local result, err = pcall(vim.cmd, cmd .. " " .. vim.fn.fnameescape(path)) + if result or err == "Vim(edit):E325: ATTENTION" then + -- fixes #321 + vim.api.nvim_buf_set_option(0, "buflisted", true) + events.fire_event(events.FILE_OPENED, path) + else + log.error("Error opening file:", err) + end + end +end + +---Marks potential windows with letters and will open the give node in the picked window. +M.open_with_window_picker = function(state, toggle_directory) + open_with_cmd(state, "edit", toggle_directory, use_window_picker) +end + +---Marks potential windows with letters and will open the give node in a split next to the picked window. +M.split_with_window_picker = function(state, toggle_directory) + open_with_cmd(state, "split", toggle_directory, use_window_picker) +end + +---Marks potential windows with letters and will open the give node in a vertical split next to the picked window. +M.vsplit_with_window_picker = function(state, toggle_directory) + open_with_cmd(state, "vsplit", toggle_directory, use_window_picker) +end + +M.show_help = function(state) + local title = state.config and state.config.title or nil + local prefix_key = state.config and state.config.prefix_key or nil + help.show(state, title, prefix_key) +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/components.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/components.lua new file mode 100644 index 00000000..05607fc9 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/components.lua @@ -0,0 +1,558 @@ +-- This file contains the built-in components. Each componment is a function +-- that takes the following arguments: +-- config: A table containing the configuration provided by the user +-- when declaring this component in their renderer config. +-- node: A NuiNode object for the currently focused node. +-- state: The current state of the source providing the items. +-- +-- The function should return either a table, or a list of tables, each of which +-- contains the following keys: +-- text: The text to display for this item. +-- highlight: The highlight group to apply to this text. + +local highlights = require("neo-tree.ui.highlights") +local utils = require("neo-tree.utils") +local file_nesting = require("neo-tree.sources.common.file-nesting") +local container = require("neo-tree.sources.common.container") +local log = require("neo-tree.log") + +local M = {} + +local make_two_char = function(symbol) + if vim.fn.strchars(symbol) == 1 then + return symbol .. " " + else + return symbol + end +end +-- only works in the buffers component, but it's here so we don't have to defined +-- multple renderers. +M.bufnr = function(config, node, state) + local highlight = config.highlight or highlights.BUFFER_NUMBER + local bufnr = node.extra and node.extra.bufnr + if not bufnr then + return {} + end + return { + text = string.format("#%s", bufnr), + highlight = highlight, + } +end + +M.clipboard = function(config, node, state) + local clipboard = state.clipboard or {} + local clipboard_state = clipboard[node:get_id()] + if not clipboard_state then + return {} + end + return { + text = " (" .. clipboard_state.action .. ")", + highlight = config.highlight or highlights.DIM_TEXT, + } +end + +M.container = container.render + +M.current_filter = function(config, node, state) + local filter = node.search_pattern or "" + if filter == "" then + return {} + end + return { + { + text = "Find", + highlight = highlights.DIM_TEXT, + }, + { + text = string.format('"%s"', filter), + highlight = config.highlight or highlights.FILTER_TERM, + }, + { + text = "in", + highlight = highlights.DIM_TEXT, + }, + } +end + +---`sign_getdefined` based wrapper with compatibility +---@param severity string +---@return vim.fn.sign_getdefined.ret.item +local function get_defined_sign(severity) + local defined + + if vim.fn.has("nvim-0.10") > 0 then + local signs_config = vim.diagnostic.config().signs + if type(signs_config) == "table" then + local identifier = severity:sub(1, 1) + if identifier == "H" then + identifier = "N" + end + defined = { + text = (signs_config.text or {})[vim.diagnostic.severity[identifier]], + texthl = "DiagnosticSign" .. severity, + } + end + else -- before 0.10 + defined = vim.fn.sign_getdefined("DiagnosticSign" .. severity) + if vim.tbl_isempty(defined) then + -- backwards compatibility... + local old_severity = severity + if severity == "Warning" then + old_severity = "Warn" + elseif severity == "Information" then + old_severity = "Info" + end + defined = vim.fn.sign_getdefined("LspDiagnosticsSign" .. old_severity) + end + defined = defined and defined[1] + end + + if type(defined) ~= "table" then + defined = {} + end + return defined +end + +M.diagnostics = function(config, node, state) + local diag = state.diagnostics_lookup or {} + local diag_state = utils.index_by_path(diag, node:get_id()) + if config.hide_when_expanded and node.type == "directory" and node:is_expanded() then + return {} + end + if not diag_state then + return {} + end + if config.errors_only and diag_state.severity_number > 1 then + return {} + end + local severity = diag_state.severity_string + local defined = get_defined_sign(severity) + + -- check for overrides in the component config + local severity_lower = severity:lower() + if config.symbols and config.symbols[severity_lower] then + defined.texthl = defined.texthl or ("Diagnostic" .. severity) + defined.text = config.symbols[severity_lower] + end + if config.highlights and config.highlights[severity_lower] then + defined.text = defined.text or severity:sub(1, 1) + defined.texthl = config.highlights[severity_lower] + end + + if defined.text and defined.texthl then + return { + text = make_two_char(defined.text), + highlight = defined.texthl, + } + else + return { + text = severity:sub(1, 1), + highlight = "Diagnostic" .. severity, + } + end +end + +M.git_status = function(config, node, state) + local git_status_lookup = state.git_status_lookup + if config.hide_when_expanded and node.type == "directory" and node:is_expanded() then + return {} + end + if not git_status_lookup then + return {} + end + local git_status = git_status_lookup[node.path] + if not git_status then + if node.filtered_by and node.filtered_by.gitignored then + git_status = "!!" + else + return {} + end + end + + local symbols = config.symbols or {} + local change_symbol + local change_highlt = highlights.FILE_NAME + local status_symbol = symbols.staged + local status_highlt = highlights.GIT_STAGED + if node.type == "directory" and git_status:len() == 1 then + status_symbol = nil + end + + if git_status:sub(1, 1) == " " then + status_symbol = symbols.unstaged + status_highlt = highlights.GIT_UNSTAGED + end + + if git_status:match("?$") then + status_symbol = nil + status_highlt = highlights.GIT_UNTRACKED + change_symbol = symbols.untracked + change_highlt = highlights.GIT_UNTRACKED + -- all variations of merge conflicts + elseif git_status == "DD" then + status_symbol = symbols.conflict + status_highlt = highlights.GIT_CONFLICT + change_symbol = symbols.deleted + change_highlt = highlights.GIT_CONFLICT + elseif git_status == "UU" then + status_symbol = symbols.conflict + status_highlt = highlights.GIT_CONFLICT + change_symbol = symbols.modified + change_highlt = highlights.GIT_CONFLICT + elseif git_status == "AA" then + status_symbol = symbols.conflict + status_highlt = highlights.GIT_CONFLICT + change_symbol = symbols.added + change_highlt = highlights.GIT_CONFLICT + elseif git_status:match("U") then + status_symbol = symbols.conflict + status_highlt = highlights.GIT_CONFLICT + if git_status:match("A") then + change_symbol = symbols.added + elseif git_status:match("D") then + change_symbol = symbols.deleted + end + change_highlt = highlights.GIT_CONFLICT + -- end merge conflict section + elseif git_status:match("M") then + change_symbol = symbols.modified + change_highlt = highlights.GIT_MODIFIED + elseif git_status:match("R") then + change_symbol = symbols.renamed + change_highlt = highlights.GIT_RENAMED + elseif git_status:match("[ACT]") then + change_symbol = symbols.added + change_highlt = highlights.GIT_ADDED + elseif git_status:match("!") then + status_symbol = nil + change_symbol = symbols.ignored + change_highlt = highlights.GIT_IGNORED + elseif git_status:match("D") then + change_symbol = symbols.deleted + change_highlt = highlights.GIT_DELETED + end + + if change_symbol or status_symbol then + local components = {} + if type(change_symbol) == "string" and #change_symbol > 0 then + table.insert(components, { + text = make_two_char(change_symbol), + highlight = change_highlt, + }) + end + if type(status_symbol) == "string" and #status_symbol > 0 then + table.insert(components, { + text = make_two_char(status_symbol), + highlight = status_highlt, + }) + end + return components + else + return { + text = "[" .. git_status .. "]", + highlight = config.highlight or change_highlt, + } + end +end + +M.filtered_by = function(config, node, state) + local result = {} + if type(node.filtered_by) == "table" then + local fby = node.filtered_by + if fby.name then + result = { + text = "(hide by name)", + highlight = highlights.HIDDEN_BY_NAME, + } + elseif fby.pattern then + result = { + text = "(hide by pattern)", + highlight = highlights.HIDDEN_BY_NAME, + } + elseif fby.gitignored then + result = { + text = "(gitignored)", + highlight = highlights.GIT_IGNORED, + } + elseif fby.dotfiles then + result = { + text = "(dotfile)", + highlight = highlights.DOTFILE, + } + elseif fby.hidden then + result = { + text = "(hidden)", + highlight = highlights.WINDOWS_HIDDEN, + } + end + fby = nil + end + return result +end + +M.icon = function(config, node, state) + local icon = config.default or " " + local highlight = config.highlight or highlights.FILE_ICON + if node.type == "directory" then + highlight = highlights.DIRECTORY_ICON + if node.loaded and not node:has_children() then + icon = not node.empty_expanded and config.folder_empty or config.folder_empty_open + elseif node:is_expanded() then + icon = config.folder_open or "-" + else + icon = config.folder_closed or "+" + end + elseif node.type == "file" or node.type == "terminal" then + local success, web_devicons = pcall(require, "nvim-web-devicons") + local name = node.type == "terminal" and "terminal" or node.name + if success then + local devicon, hl = web_devicons.get_icon(name) + icon = devicon or icon + highlight = hl or highlight + end + end + + local filtered_by = M.filtered_by(config, node, state) + + return { + text = icon .. " ", + highlight = filtered_by.highlight or highlight, + } +end + +M.modified = function(config, node, state) + local opened_buffers = state.opened_buffers or {} + local buf_info = utils.index_by_path(opened_buffers, node.path) + + if buf_info and buf_info.modified then + return { + text = (make_two_char(config.symbol) or "[+]"), + highlight = config.highlight or highlights.MODIFIED, + } + else + return {} + end +end + +M.name = function(config, node, state) + local highlight = config.highlight or highlights.FILE_NAME + local text = node.name + if node.type == "directory" then + highlight = highlights.DIRECTORY_NAME + if config.trailing_slash and text ~= "/" then + text = text .. "/" + end + end + + if node:get_depth() == 1 and node.type ~= "message" then + highlight = highlights.ROOT_NAME + else + local filtered_by = M.filtered_by(config, node, state) + highlight = filtered_by.highlight or highlight + if config.use_git_status_colors then + local git_status = state.components.git_status({}, node, state) + if git_status and git_status.highlight then + highlight = git_status.highlight + end + end + end + + local hl_opened = config.highlight_opened_files + if hl_opened then + local opened_buffers = state.opened_buffers or {} + if + (hl_opened == "all" and opened_buffers[node.path]) + or (opened_buffers[node.path] and opened_buffers[node.path].loaded) + then + highlight = highlights.FILE_NAME_OPENED + end + end + + if type(config.right_padding) == "number" then + if config.right_padding > 0 then + text = text .. string.rep(" ", config.right_padding) + end + else + text = text + end + + return { + text = text, + highlight = highlight, + } +end + +M.indent = function(config, node, state) + if not state.skip_marker_at_level then + state.skip_marker_at_level = {} + end + + local strlen = vim.fn.strdisplaywidth + local skip_marker = state.skip_marker_at_level + local indent_size = config.indent_size or 2 + local padding = config.padding or 0 + local level = node.level + local with_markers = config.with_markers + local with_expanders = config.with_expanders == nil and file_nesting.is_enabled() + or config.with_expanders + local marker_highlight = config.highlight or highlights.INDENT_MARKER + local expander_highlight = config.expander_highlight or config.highlight or highlights.EXPANDER + + local function get_expander() + if with_expanders and utils.is_expandable(node) then + return node:is_expanded() and (config.expander_expanded or "") + or (config.expander_collapsed or "") + end + end + + if indent_size == 0 or level < 2 or not with_markers then + local len = indent_size * level + padding + local expander = get_expander() + if level == 0 or not expander then + return { + text = string.rep(" ", len), + } + end + return { + text = string.rep(" ", len - strlen(expander) - 1) .. expander .. " ", + highlight = expander_highlight, + } + end + + local indent_marker = config.indent_marker or "│" + local last_indent_marker = config.last_indent_marker or "└" + + skip_marker[level] = node.is_last_child + local indent = {} + if padding > 0 then + table.insert(indent, { text = string.rep(" ", padding) }) + end + + for i = 1, level do + local char = "" + local spaces_count = indent_size + local highlight = nil + + if i > 1 and not skip_marker[i] or i == level then + spaces_count = spaces_count - 1 + char = indent_marker + highlight = marker_highlight + if i == level then + local expander = get_expander() + if expander then + char = expander + highlight = expander_highlight + elseif node.is_last_child then + char = last_indent_marker + spaces_count = spaces_count - (vim.api.nvim_strwidth(last_indent_marker) - 1) + end + end + end + + table.insert(indent, { + text = char .. string.rep(" ", spaces_count), + highlight = highlight, + no_next_padding = true, + }) + end + + return indent +end + +local get_header = function (state, label, size) + if state.sort and state.sort.label == label then + local icon = state.sort.direction == 1 and "▲" or "▼" + size = size - 2 + return string.format("%" .. size .. "s %s ", label, icon) + end + return string.format("%" .. size .. "s ", label) +end + +M.file_size = function (config, node, state) + -- Root node gets column labels + if node:get_depth() == 1 then + return { + text = get_header(state, "Size", 12), + highlight = highlights.FILE_STATS_HEADER + } + end + + local text = "-" + if node.type == "file" then + local stat = utils.get_stat(node) + local size = stat and stat.size or nil + if size then + local success, human = pcall(utils.human_size, size) + if success then + text = human or text + end + end + end + + return { + text = string.format("%12s ", text), + highlight = config.highlight or highlights.FILE_STATS + } +end + +local file_time = function(config, node, state, stat_field) + -- Root node gets column labels + if node:get_depth() == 1 then + local label = stat_field + if stat_field == "mtime" then + label = "Last Modified" + elseif stat_field == "birthtime" then + label = "Created" + end + return { + text = get_header(state, label, 20), + highlight = highlights.FILE_STATS_HEADER + } + end + + local stat = utils.get_stat(node) + local value = stat and stat[stat_field] + local seconds = value and value.sec or nil + local display = seconds and os.date("%Y-%m-%d %I:%M %p", seconds) or "-" + return { + text = string.format("%20s ", display), + highlight = config.highlight or highlights.FILE_STATS + } +end + +M.last_modified = function(config, node, state) + return file_time(config, node, state, "mtime") +end + +M.created = function(config, node, state) + return file_time(config, node, state, "birthtime") +end + +M.symlink_target = function(config, node, state) + if node.is_link then + return { + text = string.format(" ➛ %s", node.link_to), + highlight = config.highlight or highlights.SYMBOLIC_LINK_TARGET, + } + else + return {} + end +end + +M.type = function (config, node, state) + local text = node.ext or node.type + -- Root node gets column labels + if node:get_depth() == 1 then + return { + text = get_header(state, "Type", 10), + highlight = highlights.FILE_STATS_HEADER + } + end + + return { + text = string.format("%10s ", text), + highlight = highlights.FILE_STATS + } +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/container.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/container.lua new file mode 100644 index 00000000..bfb4127d --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/container.lua @@ -0,0 +1,340 @@ +local utils = require("neo-tree.utils") +local renderer = require("neo-tree.ui.renderer") +local highlights = require("neo-tree.ui.highlights") +local log = require("neo-tree.log") + +local M = {} + +local calc_rendered_width = function(rendered_item) + local width = 0 + + for _, item in ipairs(rendered_item) do + if item.text then + width = width + vim.fn.strchars(item.text) + end + end + + return width +end + +local calc_container_width = function(config, node, state, context) + local container_width = 0 + if type(config.width) == "string" then + if config.width == "fit_content" then + container_width = context.max_width + elseif config.width == "100%" then + container_width = context.available_width + elseif config.width:match("^%d+%%$") then + local percent = tonumber(config.width:sub(1, -2)) / 100 + container_width = math.floor(percent * context.available_width) + else + error("Invalid container width: " .. config.width) + end + elseif type(config.width) == "number" then + container_width = config.width + elseif type(config.width) == "function" then + container_width = config.width(node, state) + else + error("Invalid container width: " .. config.width) + end + + if config.min_width then + container_width = math.max(container_width, config.min_width) + end + if config.max_width then + container_width = math.min(container_width, config.max_width) + end + context.container_width = container_width + return container_width +end + +local render_content = function(config, node, state, context) + local window_width = vim.api.nvim_win_get_width(state.winid) + local add_padding = function(rendered_item, should_pad) + for _, data in ipairs(rendered_item) do + if data.text then + local padding = (should_pad and #data.text and data.text:sub(1, 1) ~= " ") and " " or "" + data.text = padding .. data.text + should_pad = data.text:sub(#data.text) ~= " " + end + end + return should_pad + end + + local max_width = 0 + local grouped_by_zindex = utils.group_by(config.content, "zindex") + + for zindex, items in pairs(grouped_by_zindex) do + local should_pad = { left = false, right = false } + local zindex_rendered = { left = {}, right = {} } + local rendered_width = 0 + + for _, item in ipairs(items) do + if item.enabled == false then + goto continue + end + local required_width = item.required_width or 0 + if required_width > window_width then + goto continue + end + local rendered_item = renderer.render_component(item, node, state, context.available_width) + if rendered_item then + local align = item.align or "left" + should_pad[align] = add_padding(rendered_item, should_pad[align]) + + vim.list_extend(zindex_rendered[align], rendered_item) + rendered_width = rendered_width + calc_rendered_width(rendered_item) + end + ::continue:: + end + + max_width = math.max(max_width, rendered_width) + grouped_by_zindex[zindex] = zindex_rendered + end + + context.max_width = max_width + context.grouped_by_zindex = grouped_by_zindex + return context +end + +---Takes a list of rendered components and truncates them to fit the container width +---@param layer table The list of rendered components. +---@param skip_count number The number of characters to skip from the begining/left. +---@param max_length number The maximum number of characters to return. +local truncate_layer_keep_left = function(layer, skip_count, max_length) + local result = {} + local taken = 0 + local skipped = 0 + for _, item in ipairs(layer) do + local remaining_to_skip = skip_count - skipped + if remaining_to_skip > 0 then + if #item.text <= remaining_to_skip then + skipped = skipped + vim.fn.strchars(item.text) + item.text = "" + else + item.text = item.text:sub(remaining_to_skip) + if #item.text + taken > max_length then + item.text = item.text:sub(1, max_length - taken) + end + table.insert(result, item) + taken = taken + #item.text + skipped = skipped + remaining_to_skip + end + elseif taken <= max_length then + if #item.text + taken > max_length then + item.text = item.text:sub(1, max_length - taken) + end + table.insert(result, item) + taken = taken + vim.fn.strchars(item.text) + end + end + return result +end + +---Takes a list of rendered components and truncates them to fit the container width +---@param layer table The list of rendered components. +---@param skip_count number The number of characters to skip from the end/right. +---@param max_length number The maximum number of characters to return. +local truncate_layer_keep_right = function(layer, skip_count, max_length) + local result = {} + local taken = 0 + local skipped = 0 + local i = #layer + while i > 0 do + local item = layer[i] + i = i - 1 + local text_length = vim.fn.strchars(item.text) + local remaining_to_skip = skip_count - skipped + if remaining_to_skip > 0 then + if text_length <= remaining_to_skip then + skipped = skipped + text_length + item.text = "" + else + item.text = vim.fn.strcharpart(item.text, 0, text_length - remaining_to_skip) + text_length = vim.fn.strchars(item.text) + if text_length + taken > max_length then + item.text = vim.fn.strcharpart(item.text, text_length - (max_length - taken)) + text_length = vim.fn.strchars(item.text) + end + table.insert(result, item) + taken = taken + text_length + skipped = skipped + remaining_to_skip + end + elseif taken <= max_length then + if text_length + taken > max_length then + item.text = vim.fn.strcharpart(item.text, text_length - (max_length - taken)) + text_length = vim.fn.strchars(item.text) + end + table.insert(result, item) + taken = taken + text_length + end + end + return result +end + +local fade_content = function(layer, fade_char_count) + local text = layer[#layer].text + if not text or #text == 0 then + return + end + local hl = layer[#layer].highlight or "Normal" + local fade = { + highlights.get_faded_highlight_group(hl, 0.68), + highlights.get_faded_highlight_group(hl, 0.6), + highlights.get_faded_highlight_group(hl, 0.35), + } + + for i = 3, 1, -1 do + if #text >= i and fade_char_count >= i then + layer[#layer].text = text:sub(1, -i - 1) + for j = i, 1, -1 do + -- force no padding for each faded character + local entry = { text = text:sub(-j, -j), highlight = fade[i - j + 1], no_padding = true } + table.insert(layer, entry) + end + break + end + end +end + +local try_fade_content = function(layer, fade_char_count) + local success, err = pcall(fade_content, layer, fade_char_count) + if not success then + log.debug("Error while trying to fade content: ", err) + end +end + +local merge_content = function(context) + -- Heres the idea: + -- * Starting backwards from the layer with the highest zindex + -- set the left and right tables to the content of the layer + -- * If a layer has more content than will fit, the left side will be truncated. + -- * If the available space is not used up, move on to the next layer + -- * With each subsequent layer, if the length of that layer is greater then the existing + -- length for that side (left or right), then clip that layer and append whatver portion is + -- not covered up to the appropriate side. + -- * Check again to see if we have used up the available width, short circuit if we have. + -- * Repeat until all layers have been merged. + -- * Join the left and right tables together and return. + -- + local remaining_width = context.container_width + local left, right = {}, {} + local left_width, right_width = 0, 0 + local wanted_width = 0 + + if context.left_padding and context.left_padding > 0 then + table.insert(left, { text = string.rep(" ", context.left_padding) }) + remaining_width = remaining_width - context.left_padding + left_width = left_width + context.left_padding + wanted_width = wanted_width + context.left_padding + end + + if context.right_padding and context.right_padding > 0 then + remaining_width = remaining_width - context.right_padding + wanted_width = wanted_width + context.right_padding + end + + local keys = utils.get_keys(context.grouped_by_zindex, true) + if type(keys) ~= "table" then + return {} + end + local i = #keys + while i > 0 do + local key = keys[i] + local layer = context.grouped_by_zindex[key] + i = i - 1 + + if utils.truthy(layer.right) then + local width = calc_rendered_width(layer.right) + wanted_width = wanted_width + width + if remaining_width > 0 then + context.has_right_content = true + if width > remaining_width then + local truncated = truncate_layer_keep_right(layer.right, right_width, remaining_width) + vim.list_extend(right, truncated) + remaining_width = 0 + else + remaining_width = remaining_width - width + vim.list_extend(right, layer.right) + right_width = right_width + width + end + end + end + + if utils.truthy(layer.left) then + local width = calc_rendered_width(layer.left) + wanted_width = wanted_width + width + if remaining_width > 0 then + if width > remaining_width then + local truncated = truncate_layer_keep_left(layer.left, left_width, remaining_width) + if context.enable_character_fade then + try_fade_content(truncated, 3) + end + vim.list_extend(left, truncated) + remaining_width = 0 + else + remaining_width = remaining_width - width + if context.enable_character_fade and not context.auto_expand_width then + local fade_chars = 3 - remaining_width + if fade_chars > 0 then + try_fade_content(layer.left, fade_chars) + end + end + vim.list_extend(left, layer.left) + left_width = left_width + width + end + end + end + + if remaining_width == 0 and not context.auto_expand_width then + i = 0 + break + end + end + + if remaining_width > 0 and #right > 0 then + table.insert(left, { text = string.rep(" ", remaining_width) }) + end + + local result = {} + vim.list_extend(result, left) + + -- we do not pad between left and right side + if #right >= 1 then + right[1].no_padding = true + end + + vim.list_extend(result, right) + context.merged_content = result + log.trace("wanted width: ", wanted_width, " actual width: ", context.container_width) + context.wanted_width = math.max(wanted_width, context.wanted_width) +end + +M.render = function(config, node, state, available_width) + local context = { + wanted_width = 0, + max_width = 0, + grouped_by_zindex = {}, + available_width = available_width, + left_padding = config.left_padding, + right_padding = config.right_padding, + enable_character_fade = config.enable_character_fade, + auto_expand_width = state.window.auto_expand_width and state.window.position ~= "float", + } + + render_content(config, node, state, context) + calc_container_width(config, node, state, context) + merge_content(context) + + if context.has_right_content then + state.has_right_content = true + end + + -- we still want padding between this container and the previous component + if #context.merged_content > 0 then + context.merged_content[1].no_padding = false + end + return context.merged_content, context.wanted_width +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/file-items.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/file-items.lua new file mode 100644 index 00000000..1d040421 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/file-items.lua @@ -0,0 +1,252 @@ +local vim = vim +local file_nesting = require("neo-tree.sources.common.file-nesting") +local utils = require("neo-tree.utils") +local log = require("neo-tree.log") + +local function sort_items(a, b) + if a.type == b.type then + return a.path < b.path + else + return a.type < b.type + end +end + +local function sort_items_case_insensitive(a, b) + if a.type == b.type then + return a.path:lower() < b.path:lower() + else + return a.type < b.type + end +end + +---Creates a sort function the will sort by the values returned by the field provider. +---@param field_provider function a function that takes an item and returns a value to +-- sort by. +---@param fallback_sort_function function a sort function to use if the field provider +-- returns the same value for both items. +local function make_sort_function(field_provider, fallback_sort_function, direction) + return function(a, b) + if a.type == b.type then + local a_field = field_provider(a) + local b_field = field_provider(b) + if a_field == b_field then + return fallback_sort_function(a, b) + else + if direction < 0 then + return a_field > b_field + else + return a_field < b_field + end + end + else + return a.type < b.type + end + end +end + +local function sort_function_is_valid(func) + if func == nil then + return false + end + + local a = { type = "dir", path = "foo" } + local b = { type = "dir", path = "baz" } + + local success, result = pcall(func, a, b) + if success and type(result) == "boolean" then + return true + end + + log.error("sort function isn't valid ", result) + return false +end + +local function deep_sort(tbl, sort_func, field_provider, direction) + if sort_func == nil then + local config = require("neo-tree").config + if sort_function_is_valid(config.sort_function) then + sort_func = config.sort_function + elseif config.sort_case_insensitive then + sort_func = sort_items_case_insensitive + else + sort_func = sort_items + end + if field_provider ~= nil then + sort_func = make_sort_function(field_provider, sort_func, direction) + end + end + table.sort(tbl, sort_func) + for _, item in pairs(tbl) do + if item.type == "directory" or item.children ~= nil then + deep_sort(item.children, sort_func) + end + end +end + +local advanced_sort = function(tbl, state) + local sort_func = state.sort_function_override + local field_provider = state.sort_field_provider + local direction = state.sort and state.sort.direction or 1 + deep_sort(tbl, sort_func, field_provider, direction) +end + +local create_item, set_parents + +function create_item(context, path, _type, bufnr) + local parent_path, name = utils.split_path(path) + local id = path + if path == "[No Name]" and bufnr then + parent_path = context.state.path + name = "[No Name]" + id = tostring(bufnr) + else + -- avoid creating duplicate items + if context.folders[path] or context.nesting[path] or context.item_exists[path] then + return context.folders[path] or context.nesting[path] or context.item_exists[path] + end + end + + if _type == nil then + local stat = vim.loop.fs_stat(path) + _type = stat and stat.type or "unknown" + end + local item = { + id = id, + name = name, + parent_path = parent_path, + path = path, + type = _type, + } + if utils.is_windows then + if vim.fn.getftype(path) == "link" then + item.type = "link" + end + end + if item.type == "link" then + item.is_link = true + item.link_to = vim.loop.fs_realpath(path) + if item.link_to ~= nil then + item.type = vim.loop.fs_stat(item.link_to).type + end + end + if item.type == "directory" then + item.children = {} + item.loaded = false + context.folders[path] = item + if context.state.search_pattern then + table.insert(context.state.default_expanded_nodes, item.id) + end + else + item.base = item.name:match("^([-_,()%s%w%i]+)%.") + item.ext = item.name:match("%.([-_,()%s%w%i]+)$") + item.exts = item.name:match("^[-_,()%s%w%i]+%.(.*)") + item.name_lcase = item.name:lower() + + local nesting_callback = file_nesting.get_nesting_callback(item) + if nesting_callback ~= nil then + item.children = {} + item.nesting_callback = nesting_callback + context.nesting[path] = item + end + end + + item.is_reveal_target = (path == context.path_to_reveal) + local state = context.state + local f = state.filtered_items + local is_not_root = not utils.is_subpath(path, context.state.path) + if f and is_not_root then + if f.never_show[name] then + item.filtered_by = item.filtered_by or {} + item.filtered_by.never_show = true + else + if utils.is_filtered_by_pattern(f.never_show_by_pattern, path, name) then + item.filtered_by = item.filtered_by or {} + item.filtered_by.never_show = true + end + end + if f.always_show[name] then + item.filtered_by = item.filtered_by or {} + item.filtered_by.always_show = true + end + if f.hide_by_name[name] then + item.filtered_by = item.filtered_by or {} + item.filtered_by.name = true + end + if utils.is_filtered_by_pattern(f.hide_by_pattern, path, name) then + item.filtered_by = item.filtered_by or {} + item.filtered_by.pattern = true + end + if f.hide_dotfiles and string.sub(name, 1, 1) == "." then + item.filtered_by = item.filtered_by or {} + item.filtered_by.dotfiles = true + end + if f.hide_hidden and utils.is_hidden(path) then + item.filtered_by = item.filtered_by or {} + item.filtered_by.hidden = true + end + -- NOTE: git_ignored logic moved to job_complete + end + + set_parents(context, item) + if context.all_items == nil then + context.all_items = {} + end + if is_not_root then + table.insert(context.all_items, item) + end + return item +end + +-- function to set (or create) parent folder +function set_parents(context, item, siblings) + -- we can get duplicate items if we navigate up with open folders + -- this is probably hacky, but it works + if context.item_exists[item.id] then + return + end + if not item.parent_path then + return + end + + local parent = context.folders[item.parent_path] + if not utils.truthy(item.parent_path) then + return + end + if parent == nil then + local success + success, parent = pcall(create_item, context, item.parent_path, "directory") + if not success then + log.error("error creating item for ", item.parent_path) + end + context.folders[parent.id] = parent + set_parents(context, parent) + end + table.insert(parent.children, item) + context.item_exists[item.id] = true + + if item.filtered_by == nil and type(parent.filtered_by) == "table" then + item.filtered_by = vim.deepcopy(parent.filtered_by) + end +end + +---Create context to be used in other file-items functions. +---@param state table|nil The state of the file-items. +---@return table +local create_context = function(state) + local context = {} + -- Make the context a weak table so that it can be garbage collected + --setmetatable(context, { __mode = 'v' }) + context.state = state + context.folders = {} + context.nesting = {} + context.item_exists = {} + context.all_items = {} + return context +end + +return { + create_context = create_context, + create_item = create_item, + deep_sort = deep_sort, + advanced_sort = advanced_sort, +} diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/file-nesting.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/file-nesting.lua new file mode 100644 index 00000000..76770195 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/file-nesting.lua @@ -0,0 +1,248 @@ +local utils = require("neo-tree.utils") +local Path = require("plenary.path") +local globtopattern = require("neo-tree.sources.filesystem.lib.globtopattern") +local log = require("neo-tree.log") + +-- File nesting a la JetBrains (#117). +local M = {} + +local pattern_matcher = { + enabled = false, + config = {}, +} + +local extension_matcher = { + enabled = false, + config = {}, +} + +local matchers = {} +matchers.pattern = pattern_matcher +matchers.exts = extension_matcher + +extension_matcher.get_nesting_callback = function(item) + if utils.truthy(extension_matcher.config[item.exts]) then + return extension_matcher.get_children + end + return nil +end + +extension_matcher.get_children = function(item, siblings) + local matching_files = {} + if siblings == nil then + return matching_files + end + for _, ext in pairs(extension_matcher.config[item.exts]) do + for _, sibling in pairs(siblings) do + if + sibling.id ~= item.id + and sibling.is_nested ~= true + and item.parent_path == sibling.parent_path + and sibling.exts == ext + and item.base .. "." .. ext == sibling.name + then + table.insert(matching_files, sibling) + end + end + end + return matching_files +end + +pattern_matcher.get_nesting_callback = function(item) + for _, rule_config in pairs(pattern_matcher.config) do + if item.name:match(rule_config["pattern"]) then + return function(inner_item, siblings) + local rule_config_helper = rule_config + return pattern_matcher.get_children(inner_item, siblings, rule_config_helper) + end + end + end + return nil +end + +pattern_matcher.pattern_types = {} +pattern_matcher.pattern_types.files_glob = {} +pattern_matcher.pattern_types.files_glob.get_pattern = function(pattern) + return globtopattern.globtopattern(pattern) +end +pattern_matcher.pattern_types.files_glob.match = function(filename, pattern) + return filename:match(pattern) +end +pattern_matcher.pattern_types.files_exact = {} +pattern_matcher.pattern_types.files_exact.get_pattern = function(pattern) + return pattern +end +pattern_matcher.pattern_types.files_exact.match = function(filename, pattern) + return filename == pattern +end + +pattern_matcher.get_children = function(item, siblings, rule_config) + local matching_files = {} + if siblings == nil then + return matching_files + end + for type, type_functions in pairs(pattern_matcher.pattern_types) do + for _, pattern in pairs(rule_config[type]) do + local item_name = item.name + if rule_config["ignore_case"] ~= nil and item.name_lcase ~= nil then + item_name = item.name_lcase + end + local success, replaced_pattern = + pcall(string.gsub, item_name, rule_config["pattern"], pattern) + if success then + local glob_or_file = type_functions.get_pattern(replaced_pattern) + for _, sibling in pairs(siblings) do + if + sibling.id ~= item.id + and sibling.is_nested ~= true + and item.parent_path == sibling.parent_path + then + local sibling_name = sibling.name + if rule_config["ignore_case"] ~= nil and sibling.name_lcase ~= nil then + sibling_name = sibling.name_lcase + end + if type_functions.match(sibling_name, glob_or_file) then + table.insert(matching_files, sibling) + end + end + end + else + log.error("Error using file glob '" .. pattern .. "'; Error: " .. replaced_pattern) + end + end + end + return matching_files +end + +--- Checks if file-nesting module is enabled by config +---@return boolean +function M.is_enabled() + for _, matcher in pairs(matchers) do + if matcher.enabled then + return true + end + end + return false +end + +local function is_glob(str) + local test = str:gsub("\\[%*%?%[%]]", "") + local pos, _ = test:find("*") + if pos ~= nil then + return true + end + return false +end + +local function case_insensitive_pattern(pattern) + -- find an optional '%' (group 1) followed by any character (group 2) + local p = pattern:gsub("(%%?)(.)", function(percent, letter) + if percent ~= "" or not letter:match("%a") then + -- if the '%' matched, or `letter` is not a letter, return "as is" + return percent .. letter + else + -- else, return a case-insensitive character class of the matched letter + return string.format("[%s%s]", letter:lower(), letter:upper()) + end + end) + + return p +end + +function table_is_empty(table_to_check) + return table_to_check == nil or next(table_to_check) == nil +end + +function flatten_nesting(nesting_parents) + for key, config in pairs(nesting_parents) do + if config.is_nested ~= nil then + local parent = config.nesting_parent + -- count for emergency escape + local count = 0 + while parent.nesting_parent ~= nil and count < 100 do + parent = parent.nesting_parent + count = count + 1 + end + if parent ~= nil then + for _, child in pairs(config.children) do + child.nesting_parent = parent + table.insert(parent.children, child) + end + config.children = nil + end + end + nesting_parents[key] = nil + end +end + +function M.nest_items(context) + if M.is_enabled() == false or table_is_empty(context.nesting) then + return + end + for _, config in pairs(context.nesting) do + local files = config.nesting_callback(config, context.all_items) + local folder = context.folders[config.parent_path] + for _, to_be_nested in ipairs(files) do + table.insert(config.children, to_be_nested) + to_be_nested.is_nested = true + to_be_nested.nesting_parent = config + if folder ~= nil then + for index, file_to_check in ipairs(folder.children) do + if file_to_check.id == to_be_nested.id then + table.remove(folder.children, index) + end + end + end + end + end + + flatten_nesting(context.nesting) +end + +function M.get_nesting_callback(item) + for _, matcher in pairs(matchers) do + if matcher.enabled then + local callback = matcher.get_nesting_callback(item) + if callback ~= nil then + return callback + end + end + end + return nil +end + +---Setup the module with the given config +---@param config table +function M.setup(config) + for key, value in pairs(config or {}) do + local type = "exts" + if value["pattern"] ~= nil then + type = "pattern" + if value["ignore_case"] == true then + value["pattern"] = case_insensitive_pattern(value["pattern"]) + end + value["files_glob"] = {} + value["files_exact"] = {} + for _, glob in pairs(value["files"]) do + if value["ignore_case"] == true then + glob = glob:lower() + end + local replaced = glob:gsub("%%%d+", "") + if is_glob(replaced) then + table.insert(value["files_glob"], glob) + else + table.insert(value["files_exact"], glob) + end + end + end + matchers[type]["config"][key] = value + end + local next = next + for _, value in pairs(matchers) do + if next(value.config) ~= nil then + value.enabled = true + end + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/filters/filter_fzy.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/filters/filter_fzy.lua new file mode 100644 index 00000000..8f155bf0 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/filters/filter_fzy.lua @@ -0,0 +1,246 @@ +-- The lua implementation of the fzy string matching algorithm +-- credits to: https://github.com/swarn/fzy-lua +--[[ +The MIT License (MIT) + +Copyright (c) 2020 Seth Warn + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--]] +-- modified by: @pysan3 (2023) + +local SCORE_GAP_LEADING = -0.005 +local SCORE_GAP_TRAILING = -0.005 +local SCORE_GAP_INNER = -0.01 +local SCORE_MATCH_CONSECUTIVE = 1.0 +local SCORE_MATCH_SLASH = 0.9 +local SCORE_MATCH_WORD = 0.8 +local SCORE_MATCH_CAPITAL = 0.7 +local SCORE_MATCH_DOT = 0.6 +local SCORE_MAX = math.huge +local SCORE_MIN = -math.huge +local MATCH_MAX_LENGTH = 1024 + +local M = {} + +-- Return `true` if `needle` is a subsequence of `haystack`. +function M.has_match(needle, haystack, case_sensitive) + if not case_sensitive then + needle = string.lower(needle) + haystack = string.lower(haystack) + end + + local j = 1 + for i = 1, string.len(needle) do + j = string.find(haystack, needle:sub(i, i), j, true) + if not j then + return false + else + j = j + 1 + end + end + + return true +end + +local function is_lower(c) + return c:match('%l') +end + +local function is_upper(c) + return c:match('%u') +end + +local function precompute_bonus(haystack) + local match_bonus = {} + + local last_char = '/' + for i = 1, string.len(haystack) do + local this_char = haystack:sub(i, i) + if last_char == '/' or last_char == '\\' then + match_bonus[i] = SCORE_MATCH_SLASH + elseif last_char == '-' or last_char == '_' or last_char == ' ' then + match_bonus[i] = SCORE_MATCH_WORD + elseif last_char == '.' then + match_bonus[i] = SCORE_MATCH_DOT + elseif is_lower(last_char) and is_upper(this_char) then + match_bonus[i] = SCORE_MATCH_CAPITAL + else + match_bonus[i] = 0 + end + + last_char = this_char + end + + return match_bonus +end + +local function compute(needle, haystack, D, T, case_sensitive) + -- Note that the match bonuses must be computed before the arguments are + -- converted to lowercase, since there are bonuses for camelCase. + local match_bonus = precompute_bonus(haystack) + local n = string.len(needle) + local m = string.len(haystack) + + if not case_sensitive then + needle = string.lower(needle) + haystack = string.lower(haystack) + end + + -- Because lua only grants access to chars through substring extraction, + -- get all the characters from the haystack once now, to reuse below. + local haystack_chars = {} + for i = 1, m do + haystack_chars[i] = haystack:sub(i, i) + end + + for i = 1, n do + D[i] = {} + T[i] = {} + + local prev_score = SCORE_MIN + local gap_score = i == n and SCORE_GAP_TRAILING or SCORE_GAP_INNER + local needle_char = needle:sub(i, i) + + for j = 1, m do + if needle_char == haystack_chars[j] then + local score = SCORE_MIN + if i == 1 then + score = ((j - 1) * SCORE_GAP_LEADING) + match_bonus[j] + elseif j > 1 then + local a = T[i - 1][j - 1] + match_bonus[j] + local b = D[i - 1][j - 1] + SCORE_MATCH_CONSECUTIVE + score = math.max(a, b) + end + D[i][j] = score + prev_score = math.max(score, prev_score + gap_score) + T[i][j] = prev_score + else + D[i][j] = SCORE_MIN + prev_score = prev_score + gap_score + T[i][j] = prev_score + end + end + end +end + +-- Compute a matching score for two strings. +-- +-- Where `needle` is a subsequence of `haystack`, this returns a score +-- measuring the quality of their match. Better matches get higher scores. +-- +-- `needle` must be a subsequence of `haystack`, the result is undefined +-- otherwise. Call `has_match()` before calling `score`. +-- +-- returns `get_score_min()` where a or b are longer than `get_max_length()` +-- +-- returns `get_score_min()` when a or b are empty strings. +-- +-- returns `get_score_max()` when a and b are the same string. +-- +-- When the return value is not covered by the above rules, it is a number +-- in the range (`get_score_floor()`, `get_score_ceiling()`) +function M.score(needle, haystack, case_sensitive) + local n = string.len(needle) + local m = string.len(haystack) + + if n == 0 or m == 0 or m > MATCH_MAX_LENGTH or n > MATCH_MAX_LENGTH then + return SCORE_MIN + elseif n == m then + return SCORE_MAX + else + local D = {} + local T = {} + compute(needle, haystack, D, T, case_sensitive) + return T[n][m] + end +end + +-- Find the locations where fzy matched a string. +-- +-- Returns {score, indices}, where indices is an array showing where each +-- character of the needle matches the haystack in the best match. +function M.score_and_positions(needle, haystack, case_sensitive) + local n = string.len(needle) + local m = string.len(haystack) + + if n == 0 or m == 0 or m > MATCH_MAX_LENGTH or n > MATCH_MAX_LENGTH then + return SCORE_MIN, {} + elseif n == m then + local consecutive = {} + for i = 1, n do + consecutive[i] = i + end + return SCORE_MAX, consecutive + end + + local D = {} + local T = {} + compute(needle, haystack, D, T, case_sensitive) + + local positions = {} + local match_required = false + local j = m + for i = n, 1, -1 do + while j >= 1 do + if D[i][j] ~= SCORE_MIN and (match_required or D[i][j] == T[i][j]) then + match_required = (i ~= 1) and (j ~= 1) and (T[i][j] == D[i - 1][j - 1] + SCORE_MATCH_CONSECUTIVE) + positions[i] = j + j = j - 1 + break + else + j = j - 1 + end + end + end + + return T[n][m], positions +end + +-- Return only the positions of a match. +function M.positions(needle, haystack, case_sensitive) + local _, positions = M.score_and_positions(needle, haystack, case_sensitive) + return positions +end + +function M.get_score_min() + return SCORE_MIN +end + +function M.get_score_max() + return SCORE_MAX +end + +function M.get_max_length() + return MATCH_MAX_LENGTH +end + +function M.get_score_floor() + return MATCH_MAX_LENGTH * SCORE_GAP_INNER +end + +function M.get_score_ceiling() + return MATCH_MAX_LENGTH * SCORE_MATCH_CONSECUTIVE +end + +function M.get_implementation_name() + return 'lua' +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/filters/init.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/filters/init.lua new file mode 100644 index 00000000..8575c7eb --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/filters/init.lua @@ -0,0 +1,232 @@ +---A generalization of the filter functionality to directly filter the +---source tree instead of relying on pre-filtered data, which is specific +---to the filesystem source. +local vim = vim +local Input = require("nui.input") +local event = require("nui.utils.autocmd").event +local popups = require("neo-tree.ui.popups") +local renderer = require("neo-tree.ui.renderer") +local utils = require("neo-tree.utils") +local log = require("neo-tree.log") +local manager = require("neo-tree.sources.manager") +local fzy = require("neo-tree.sources.common.filters.filter_fzy") + +local M = {} + +local cmds = { + move_cursor_down = function(state, scroll_padding) + renderer.focus_node(state, nil, true, 1, scroll_padding) + end, + + move_cursor_up = function(state, scroll_padding) + renderer.focus_node(state, nil, true, -1, scroll_padding) + vim.cmd("redraw!") + end, +} + +---Reset the current filter to the empty string. +---@param state any +---@param refresh boolean? whether to refresh the source tree +---@param open_current_node boolean? whether to open the current node +local reset_filter = function(state, refresh, open_current_node) + log.trace("reset_search") + if refresh == nil then + refresh = true + end + + -- Cancel any pending search + require("neo-tree.sources.filesystem.lib.filter_external").cancel() + + -- reset search state + if state.open_folders_before_search then + state.force_open_folders = vim.deepcopy(state.open_folders_before_search, { noref = 1 }) + else + state.force_open_folders = nil + end + state.open_folders_before_search = nil + state.search_pattern = nil + + if open_current_node then + local success, node = pcall(state.tree.get_node, state.tree) + if success and node then + local id = node:get_id() + renderer.position.set(state, id) + id = utils.remove_trailing_slash(id) + manager.navigate(state, nil, id, utils.wrap(pcall, renderer.focus_node, state, id, false)) + end + elseif refresh then + manager.navigate(state) + else + state.tree = vim.deepcopy(state.orig_tree) + end + state.orig_tree = nil +end + +---Show the filtered tree +---@param state any +---@param do_not_focus_window boolean? whether to focus the window +local show_filtered_tree = function(state, do_not_focus_window) + state.tree = vim.deepcopy(state.orig_tree) + state.tree:get_nodes()[1].search_pattern = state.search_pattern + local max_score, max_id = fzy.get_score_min(), nil + local function filter_tree(node_id) + local node = state.tree:get_node(node_id) + local path = node.extra.search_path or node.path + + local should_keep = fzy.has_match(state.search_pattern, path) + if should_keep then + local score = fzy.score(state.search_pattern, path) + node.extra.fzy_score = score + if score > max_score then + max_score = score + max_id = node_id + end + end + + if node:has_children() then + for _, child_id in ipairs(node:get_child_ids()) do + should_keep = filter_tree(child_id) or should_keep + end + end + if not should_keep then + state.tree:remove_node(node_id) -- TODO: this might not be efficient + end + return should_keep + end + if #state.search_pattern > 0 then + for _, root in ipairs(state.tree:get_nodes()) do + filter_tree(root:get_id()) + end + end + manager.redraw(state.name) + if max_id then + renderer.focus_node(state, max_id, do_not_focus_window) + end +end + +---Main entry point for the filter functionality. +---This will display a filter input popup and filter the source tree on change and on submit +---@param state table the source state +---@param search_as_you_type boolean? whether to filter as you type or only on submit +---@param keep_filter_on_submit boolean? whether to keep the filter on or reset it +M.show_filter = function(state, search_as_you_type, keep_filter_on_submit) + local winid = vim.api.nvim_get_current_win() + local height = vim.api.nvim_win_get_height(winid) + local scroll_padding = 3 + + -- setup the input popup options + local popup_msg = "Search:" + if search_as_you_type then + popup_msg = "Filter:" + end + + local width = vim.fn.winwidth(0) - 2 + local row = height - 3 + if state.current_position == "float" then + scroll_padding = 0 + width = vim.fn.winwidth(winid) + row = height - 2 + vim.api.nvim_win_set_height(winid, row) + end + + state.orig_tree = vim.deepcopy(state.tree) + + local popup_options = popups.popup_options(popup_msg, width, { + relative = "win", + winid = winid, + position = { + row = row, + col = 0, + }, + size = width, + }) + + local has_pre_search_folders = utils.truthy(state.open_folders_before_search) + if not has_pre_search_folders then + log.trace("No search or pre-search folders, recording pre-search folders now") + state.open_folders_before_search = renderer.get_expanded_nodes(state.tree) + end + + local waiting_for_default_value = utils.truthy(state.search_pattern) + local input = Input(popup_options, { + prompt = " ", + default_value = state.search_pattern, + on_submit = function(value) + if value == "" then + reset_filter(state) + return + end + if search_as_you_type and not keep_filter_on_submit then + reset_filter(state, true, true) + return + end + -- do the search + state.search_pattern = value + show_filtered_tree(state, false) + end, + --this can be bad in a deep folder structure + on_change = function(value) + if not search_as_you_type then + return + end + -- apparently when a default value is set, on_change fires for every character + if waiting_for_default_value then + if #value < #state.search_pattern then + return + end + waiting_for_default_value = false + end + if value == state.search_pattern or value == nil then + return + end + + -- finally do the search + log.trace("Setting search in on_change to: " .. value) + state.search_pattern = value + local len_to_delay = { [0] = 500, 500, 400, 200 } + local delay = len_to_delay[#value] or 100 + + utils.debounce(state.name .. "_filter", function() + show_filtered_tree(state, true) + end, delay, utils.debounce_strategy.CALL_LAST_ONLY) + end, + }) + + input:mount() + + local restore_height = vim.schedule_wrap(function() + if vim.api.nvim_win_is_valid(winid) then + vim.api.nvim_win_set_height(winid, height) + end + end) + + -- create mappings and autocmd + input:map("i", "", "", { noremap = true }) + input:map("i", "", function(bufnr) + vim.cmd("stopinsert") + input:unmount() + if utils.truthy(state.search_pattern) then + reset_filter(state, true) + end + restore_height() + end, { noremap = true }) + + local config = require("neo-tree").config + for lhs, cmd_name in pairs(config.filesystem.window.fuzzy_finder_mappings) do + local t = type(cmd_name) + if t == "string" then + local cmd = cmds[cmd_name] + if cmd then + input:map("i", lhs, utils.wrap(cmd, state, scroll_padding), { noremap = true }) + else + log.warn(string.format("Invalid command in fuzzy_finder_mappings: %s = %s", lhs, cmd_name)) + end + elseif t == "function" then + input:map("i", lhs, utils.wrap(cmd_name, state, scroll_padding), { noremap = true }) + else + log.warn(string.format("Invalid command in fuzzy_finder_mappings: %s = %s", lhs, cmd_name)) + end + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/help.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/help.lua new file mode 100644 index 00000000..5de33999 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/help.lua @@ -0,0 +1,152 @@ +local Popup = require("nui.popup") +local NuiLine = require("nui.line") +local utils = require("neo-tree.utils") +local popups = require("neo-tree.ui.popups") +local highlights = require("neo-tree.ui.highlights") +local M = {} + +local add_text = function(text, highlight) + local line = NuiLine() + line:append(text, highlight) + return line +end + +local get_sub_keys = function(state, prefix_key) + local keys = utils.get_keys(state.resolved_mappings, true) + if prefix_key then + local len = prefix_key:len() + local sub_keys = {} + for _, key in ipairs(keys) do + if #key > len and key:sub(1, len) == prefix_key then + table.insert(sub_keys, key) + end + end + return sub_keys + else + return keys + end +end + +local function key_minus_prefix(key, prefix) + if prefix then + return key:sub(prefix:len() + 1) + else + return key + end +end + +---Shows a help screen for the mapped commands when will execute those commands +---when the corresponding key is pressed. +---@param state table state of the source. +---@param title string if this is a sub-menu for a multi-key mapping, the title for the window. +---@param prefix_key string if this is a sub-menu, the start of tehe multi-key mapping +M.show = function(state, title, prefix_key) + local tree_width = vim.api.nvim_win_get_width(state.winid) + local keys = get_sub_keys(state, prefix_key) + + local lines = { add_text("") } + lines[1] = add_text(" Press the corresponding key to execute the command.", "Comment") + lines[2] = add_text(" Press to cancel.", "Comment") + lines[3] = add_text("") + local header = NuiLine() + header:append(string.format(" %14s", "KEY(S)"), highlights.ROOT_NAME) + header:append(" ", highlights.DIM_TEXT) + header:append("COMMAND", highlights.ROOT_NAME) + lines[4] = header + local max_width = #lines[1]:content() + for _, key in ipairs(keys) do + local value = state.resolved_mappings[key] + local nline = NuiLine() + nline:append(string.format(" %14s", key_minus_prefix(key, prefix_key)), highlights.FILTER_TERM) + nline:append(" -> ", highlights.DIM_TEXT) + nline:append(value.text, highlights.NORMAL) + local line = nline:content() + if #line > max_width then + max_width = #line + end + table.insert(lines, nline) + end + + local width = math.min(60, max_width + 1) + + if state.current_position == "right" then + col = vim.o.columns - tree_width - width - 1 + else + col = tree_width - 1 + end + + local options = { + position = { + row = 2, + col = col, + }, + size = { + width = width, + height = #keys + 5, + }, + enter = true, + focusable = true, + zindex = 50, + relative = "editor", + } + + local popup_max_height = function() + local lines = vim.o.lines + local cmdheight = vim.o.cmdheight + -- statuscolumn + local statuscolumn_lines = 0 + local laststatus = vim.o.laststatus + if laststatus ~= 0 then + local windows = vim.api.nvim_tabpage_list_wins(0) + if (laststatus == 1 and #windows > 1) or laststatus > 1 then + statuscolumn_lines = 1 + end + end + -- tabs + local tab_lines = 0 + local showtabline = vim.o.showtabline + if showtabline ~= 0 then + local tabs = vim.api.nvim_list_tabpages() + if (showtabline == 1 and #tabs > 1) or showtabline == 2 then + tab_lines = 1 + end + end + return lines - cmdheight - statuscolumn_lines - tab_lines - 1 + end + local max_height = popup_max_height() + if options.size.height > max_height then + options.size.height = max_height + end + + local title = title or "Neotree Help" + local options = popups.popup_options(title, width, options) + local popup = Popup(options) + popup:mount() + + popup:map("n", "", function() + popup:unmount() + end, { noremap = true }) + + local event = require("nui.utils.autocmd").event + popup:on({ event.BufLeave, event.BufDelete }, function() + popup:unmount() + end, { once = true }) + + for _, key in ipairs(keys) do + -- map everything except for + if string.match(key:lower(), "^ boolean` +M.expand_directory_recursively = function(state, node, prefetcher) + log.debug("Expanding directory " .. node:get_id()) + if node.type ~= "directory" then + return + end + state.explicitly_opened_directories = state.explicitly_opened_directories or {} + if prefetcher.should_prefetch(node) then + local id = node:get_id() + state.explicitly_opened_directories[id] = true + prefetcher.prefetch(state, node) + expand_loaded(node, state, prefetcher) + else + expand_and_load(node, state, prefetcher) + end +end + +M.default_prefetcher = { + prefetch = function (state, node) + log.debug("Default expander prefetch does nothing") + end, + should_prefetch = function (node) + return false + end +} + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/preview.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/preview.lua new file mode 100644 index 00000000..153cd888 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/common/preview.lua @@ -0,0 +1,452 @@ +local vim = vim +local utils = require("neo-tree.utils") +local highlights = require("neo-tree.ui.highlights") +local events = require("neo-tree.events") +local manager = require("neo-tree.sources.manager") +local log = require("neo-tree.log") +local renderer = require("neo-tree.ui.renderer") + +local neo_tree_preview_namespace = vim.api.nvim_create_namespace("neo_tree_preview") + +local function create_floating_preview_window(state) + local default_position = utils.resolve_config_option(state, "window.position", "left") + state.current_position = state.current_position or default_position + + local winwidth = vim.api.nvim_win_get_width(state.winid) + local winheight = vim.api.nvim_win_get_height(state.winid) + local height = vim.o.lines - 4 + local width = 120 + local row, col = 0, 0 + + if state.current_position == "left" then + col = winwidth + 1 + width = math.min(vim.o.columns - col, 120) + elseif state.current_position == "top" or state.current_position == "bottom" then + height = height - winheight + width = winwidth - 2 + if state.current_position == "top" then + row = vim.api.nvim_win_get_height(state.winid) + 1 + end + elseif state.current_position == "right" then + width = math.min(vim.o.columns - winwidth - 4, 120) + col = vim.o.columns - winwidth - width - 3 + elseif state.current_position == "float" then + local pos = vim.api.nvim_win_get_position(state.winid) + -- preview will be same height and top as tree + row = pos[1] - 1 + height = winheight + + -- tree and preview window will be side by side and centered in the editor + width = math.min(vim.o.columns - winwidth - 4, 120) + local total_width = winwidth + width + 4 + local margin = math.floor((vim.o.columns - total_width) / 2) + col = margin + winwidth + 2 + + -- move the tree window to make the combined layout centered + local popup = renderer.get_nui_popup(state.winid) + popup:update_layout({ + relative = "editor", + position = { + row = row, + col = margin, + }, + }) + else + local cur_pos = state.current_position or "unknown" + log.error('Preview cannot be used when position = "' .. cur_pos .. '"') + return + end + + local popups = require("neo-tree.ui.popups") + local options = popups.popup_options("Neo-tree Preview", width, { + ns_id = highlights.ns_id, + size = { height = height, width = width }, + relative = "editor", + position = { + row = row, + col = col, + }, + win_options = { + number = true, + winhighlight = "Normal:" + .. highlights.FLOAT_NORMAL + .. ",FloatBorder:" + .. highlights.FLOAT_BORDER, + }, + }) + options.zindex = 40 + options.buf_options.filetype = "neo-tree-preview" + + local NuiPopup = require("nui.popup") + local win = NuiPopup(options) + win:mount() + return win +end + +local Preview = {} +local instance = nil + +---Creates a new preview. +---@param state table The state of the source. +---@return table preview A new preview. A preview is a table consisting of the following keys: +-- active = boolean Whether the preview is active. +-- winid = number The id of the window being used to preview. +-- is_neo_tree_window boolean Whether the preview window belongs to neo-tree. +-- bufnr = number The buffer that is currently in the preview window. +-- start_pos = array or nil An array-like table specifying the (0-indexed) starting position of the previewed text. +-- end_pos = array or nil An array-like table specifying the (0-indexed) ending position of the preview text. +-- truth = table A table containing information to be restored when the preview ends. +-- events = array A list of events the preview is subscribed to. +--These keys should not be altered directly. Note that the keys `start_pos`, `end_pos` and `truth` +--may be inaccurate if `active` is false. +function Preview:new(state) + local preview = {} + preview.active = false + preview.config = vim.deepcopy(state.config) + setmetatable(preview, { __index = self }) + preview:findWindow(state) + return preview +end + +---Preview a buffer in the preview window and optionally reveal and highlight the previewed text. +---@param bufnr number? The number of the buffer to be previewed. +---@param start_pos table? The (0-indexed) starting position of the previewed text. May be absent. +---@param end_pos table? The (0-indexed) ending position of the previewed text. May be absent +function Preview:preview(bufnr, start_pos, end_pos) + if self.is_neo_tree_window then + log.warn("Could not find appropriate window for preview") + return + end + + bufnr = bufnr or self.bufnr + if not self.active then + self:activate() + end + + if not self.active then + return + end + + if bufnr ~= self.bufnr then + self:setBuffer(bufnr) + end + + self:clearHighlight() + + self.bufnr = bufnr + self.start_pos = start_pos + self.end_pos = end_pos + + self:reveal() + self:highlight() +end + +---Reverts the preview and inactivates it, restoring the preview window to its previous state. +function Preview:revert() + self.active = false + self:unsubscribe() + self:clearHighlight() + + if not renderer.is_window_valid(self.winid) then + self.winid = nil + return + end + + if self.config.use_float then + vim.api.nvim_win_close(self.winid, true) + self.winid = nil + return + else + local foldenable = utils.get_value(self.truth, "options.foldenable", nil, false) + if foldenable ~= nil then + vim.api.nvim_win_set_option(self.winid, "foldenable", self.truth.options.foldenable) + end + vim.api.nvim_win_set_var(self.winid, "neo_tree_preview", 0) + end + + local bufnr = self.truth.bufnr + if type(bufnr) ~= "number" then + return + end + if not vim.api.nvim_buf_is_valid(bufnr) then + return + end + self:setBuffer(bufnr) + self.bufnr = bufnr + if vim.api.nvim_win_is_valid(self.winid) then + vim.api.nvim_win_call(self.winid, function() + vim.fn.winrestview(self.truth.view) + end) + end + vim.api.nvim_buf_set_option(self.bufnr, "bufhidden", self.truth.options.bufhidden) +end + +---Subscribe to event and add it to the preview event list. +--@param source string? Name of the source to add the event to. Will use `events.subscribe` if nil. +--@param event table Event to subscribe to. +function Preview:subscribe(source, event) + if source == nil then + events.subscribe(event) + else + manager.subscribe(source, event) + end + self.events = self.events or {} + table.insert(self.events, { source = source, event = event }) +end + +---Unsubscribe to all events in the preview event list. +function Preview:unsubscribe() + if self.events == nil then + return + end + for _, event in ipairs(self.events) do + if event.source == nil then + events.unsubscribe(event.event) + else + manager.unsubscribe(event.source, event.event) + end + end + self.events = {} +end + +---Finds the appropriate window and updates the preview accordingly. +---@param state table The state of the source. +function Preview:findWindow(state) + local winid, is_neo_tree_window + if self.config.use_float then + if + type(self.winid) == "number" + and vim.api.nvim_win_is_valid(self.winid) + and utils.is_floating(self.winid) + then + return + end + local win = create_floating_preview_window(state) + if not win then + self.active = false + return + end + winid = win.winid + is_neo_tree_window = false + else + winid, is_neo_tree_window = utils.get_appropriate_window(state) + self.bufnr = vim.api.nvim_win_get_buf(winid) + end + + if winid == self.winid then + return + end + self.winid, self.is_neo_tree_window = winid, is_neo_tree_window + + if self.active then + self:revert() + self:preview() + end +end + +---Activates the preview, but does not populate the preview window, +function Preview:activate() + if self.active then + return + end + if not renderer.is_window_valid(self.winid) then + return + end + if self.config.use_float then + self.truth = {} + else + self.truth = { + bufnr = self.bufnr, + view = vim.api.nvim_win_call(self.winid, vim.fn.winsaveview), + options = { + bufhidden = vim.api.nvim_buf_get_option(self.bufnr, "bufhidden"), + foldenable = vim.api.nvim_win_get_option(self.winid, "foldenable"), + }, + } + vim.api.nvim_buf_set_option(self.bufnr, "bufhidden", "hide") + vim.api.nvim_win_set_option(self.winid, "foldenable", false) + end + self.active = true + vim.api.nvim_win_set_var(self.winid, "neo_tree_preview", 1) +end + +---@param winid number +---@param bufnr number +local function try_load_image_nvim_buf(winid, bufnr) + if vim.bo[bufnr].filetype ~= "image_nvim" then + return false + end + local success, mod = pcall(require, "image") + if not success or not mod.hijack_buffer then + local image_nvim_url = "https://github.com/3rd/image.nvim" + log.debug("You'll need to install image.nvim to use this command: " .. image_nvim_url) + return false + end + return mod.hijack_buffer(vim.api.nvim_buf_get_name(bufnr), winid, bufnr) +end + +---Set the buffer in the preview window without executing BufEnter or BufWinEnter autocommands. +--@param bufnr number The buffer number of the buffer to set. +function Preview:setBuffer(bufnr) + local eventignore = vim.opt.eventignore + vim.opt.eventignore:append("BufEnter,BufWinEnter") + vim.api.nvim_win_set_buf(self.winid, bufnr) + if self.config.use_image_nvim then + try_load_image_nvim_buf(self.winid, bufnr) + end + if self.config.use_float then + -- I'm not sufe why float windows won;t show numbers without this + vim.api.nvim_win_set_option(self.winid, "number", true) + end + vim.opt.eventignore = eventignore +end + +---Move the cursor to the previewed position and center the screen. +function Preview:reveal() + local pos = self.start_pos or self.end_pos + if not self.active or not self.winid or not pos then + return + end + vim.api.nvim_win_set_cursor(self.winid, { (pos[1] or 0) + 1, pos[2] or 0 }) + vim.api.nvim_win_call(self.winid, function() + vim.cmd("normal! zz") + end) +end + +---Highlight the previewed range +function Preview:highlight() + if not self.active or not self.bufnr then + return + end + local start_pos, end_pos = self.start_pos, self.end_pos + if not start_pos and not end_pos then + return + elseif not start_pos then + start_pos = end_pos + elseif not end_pos then + end_pos = start_pos + end + + local highlight = function(line, col_start, col_end) + vim.api.nvim_buf_add_highlight( + self.bufnr, + neo_tree_preview_namespace, + highlights.PREVIEW, + line, + col_start, + col_end + ) + end + + local start_line, end_line = start_pos[1], end_pos[1] + local start_col, end_col = start_pos[2], end_pos[2] + if start_line == end_line then + highlight(start_line, start_col, end_col) + else + highlight(start_line, start_col, -1) + for line = start_line + 1, end_line - 1 do + highlight(line, 0, -1) + end + highlight(end_line, 0, end_col) + end +end + +---Clear the preview highlight in the buffer currently in the preview window. +function Preview:clearHighlight() + if type(self.bufnr) == "number" and vim.api.nvim_buf_is_valid(self.bufnr) then + vim.api.nvim_buf_clear_namespace(self.bufnr, neo_tree_preview_namespace, 0, -1) + end +end + +local toggle_state = false + +Preview.hide = function() + toggle_state = false + if instance then + instance:revert() + end + instance = nil +end + +Preview.is_active = function() + return instance and instance.active +end + +Preview.show = function(state) + local node = state.tree:get_node() + if node.type == "directory" then + return + end + + if instance then + instance:findWindow(state) + else + instance = Preview:new(state) + end + + local extra = node.extra or {} + local position = extra.position + local end_position = extra.end_position + local path = node.path or node:get_id() + local bufnr = extra.bufnr or vim.fn.bufadd(path) + + if bufnr and bufnr > 0 and instance then + instance:preview(bufnr, position, end_position) + end +end + +Preview.toggle = function(state) + if toggle_state then + Preview.hide() + else + Preview.show(state) + if instance and instance.active then + toggle_state = true + else + Preview.hide() + return + end + local winid = state.winid + local source_name = state.name + local preview_event = { + event = events.VIM_CURSOR_MOVED, + handler = function() + local did_enter_preview = vim.api.nvim_get_current_win() == instance.winid + if not toggle_state or (did_enter_preview and instance.config.use_float) then + return + end + if vim.api.nvim_get_current_win() == winid then + log.debug("Cursor moved in tree window, updating preview") + Preview.show(state) + else + log.debug("Neo-tree window lost focus, disposing preview") + Preview.hide() + end + end, + id = "preview-event", + } + instance:subscribe(source_name, preview_event) + end +end + +Preview.focus = function() + if Preview.is_active() then + vim.fn.win_gotoid(instance.winid) + end +end + +Preview.scroll = function(state) + local direction = state.config.direction + -- NOTE: Chars below are raw escape codes for / + local input = direction < 0 and [[]] or [[]] + local count = math.abs(direction) + + if Preview:is_active() then + vim.api.nvim_win_call(instance.winid, function() + vim.cmd([[normal! ]] .. count .. input) + end) + end + +end + +return Preview diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/commands.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/commands.lua new file mode 100644 index 00000000..5e87a2e6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/commands.lua @@ -0,0 +1,69 @@ +--This file should contain all commands meant to be used by mappings. +local cc = require("neo-tree.sources.common.commands") +local utils = require("neo-tree.utils") +local manager = require("neo-tree.sources.manager") +local inputs = require("neo-tree.ui.inputs") +local filters = require("neo-tree.sources.common.filters") + +local vim = vim + +local M = {} +local SOURCE_NAME = "document_symbols" +M.refresh = utils.wrap(manager.refresh, SOURCE_NAME) +M.redraw = utils.wrap(manager.redraw, SOURCE_NAME) + +M.show_debug_info = function(state) + print(vim.inspect(state)) +end + +M.jump_to_symbol = function(state, node) + node = node or state.tree:get_node() + if node:get_depth() == 1 then + return + end + vim.api.nvim_set_current_win(state.lsp_winid) + vim.api.nvim_set_current_buf(state.lsp_bufnr) + local symbol_loc = node.extra.selection_range.start + vim.api.nvim_win_set_cursor(state.lsp_winid, { symbol_loc[1] + 1, symbol_loc[2] }) +end + +M.rename = function(state) + local node = state.tree:get_node() + if node:get_depth() == 1 then + return + end + local old_name = node.name + + local callback = function(new_name) + if not new_name or new_name == "" or new_name == old_name then + return + end + M.jump_to_symbol(state, node) + vim.lsp.buf.rename(new_name) + M.refresh(state) + end + local msg = string.format('Enter new name for "%s":', old_name) + inputs.input(msg, old_name, callback) +end + +M.open = M.jump_to_symbol + +M.filter_on_submit = function(state) + filters.show_filter(state, true, true) +end + +M.filter = function(state) + filters.show_filter(state, true) +end + +cc._add_common_commands(M, "node") -- common tree commands +cc._add_common_commands(M, "^open") -- open commands +cc._add_common_commands(M, "^close_window$") +cc._add_common_commands(M, "source$") -- source navigation +cc._add_common_commands(M, "preview") -- preview +cc._add_common_commands(M, "^cancel$") -- cancel +cc._add_common_commands(M, "help") -- help commands +cc._add_common_commands(M, "with_window_picker$") -- open using window picker +cc._add_common_commands(M, "^toggle_auto_expand_width$") + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/components.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/components.lua new file mode 100644 index 00000000..d97fcd2c --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/components.lua @@ -0,0 +1,41 @@ +-- This file contains the built-in components. Each componment is a function +-- that takes the following arguments: +-- config: A table containing the configuration provided by the user +-- when declaring this component in their renderer config. +-- node: A NuiNode object for the currently focused node. +-- state: The current state of the source providing the items. +-- +-- The function should return either a table, or a list of tables, each of which +-- contains the following keys: +-- text: The text to display for this item. +-- highlight: The highlight group to apply to this text. + +local highlights = require("neo-tree.ui.highlights") +local common = require("neo-tree.sources.common.components") + +local M = {} + +M.icon = function(config, node, state) + return { + text = node:get_depth() == 1 and "" or node.extra.kind.icon, + highlight = node.extra and node.extra.kind.hl or highlights.FILE_NAME, + } +end + +M.kind_icon = M.icon + +M.kind_name = function(config, node, state) + return { + text = node:get_depth() == 1 and "" or node.extra.kind.name, + highlight = node.extra and node.extra.kind.hl or highlights.FILE_NAME, + } +end + +M.name = function(config, node, state) + return { + text = node.name, + highlight = node.extra and node.extra.kind.hl or highlights.FILE_NAME, + } +end + +return vim.tbl_deep_extend("force", common, M) diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/init.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/init.lua new file mode 100644 index 00000000..952f5e8f --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/init.lua @@ -0,0 +1,112 @@ +--This file should have all functions that are in the public api and either set +--or read the state of this source. + +local vim = vim +local manager = require("neo-tree.sources.manager") +local events = require("neo-tree.events") +local utils = require("neo-tree.utils") +local symbols = require("neo-tree.sources.document_symbols.lib.symbols_utils") +local renderer = require("neo-tree.ui.renderer") + +local M = { + name = "document_symbols", + display_name = "  Symbols ", +} + +local get_state = function() + return manager.get_state(M.name) +end + +---Refresh the source with debouncing +---@param args { afile: string } +local refresh_debounced = function(args) + if utils.is_real_file(args.afile) == false then + return + end + utils.debounce( + "document_symbols_refresh", + utils.wrap(manager.refresh, M.name), + 100, + utils.debounce_strategy.CALL_LAST_ONLY + ) +end + +---Internal function to follow the cursor +local follow_symbol = function() + local state = get_state() + if state.lsp_bufnr ~= vim.api.nvim_get_current_buf() then + return + end + local cursor = vim.api.nvim_win_get_cursor(state.lsp_winid) + local node_id = symbols.get_symbol_by_loc(state.tree, { cursor[1] - 1, cursor[2] }) + if #node_id > 0 then + renderer.focus_node(state, node_id, true) + end +end + +---Follow the cursor with debouncing +---@param args { afile: string } +local follow_debounced = function(args) + if utils.is_real_file(args.afile) == false then + return + end + utils.debounce( + "document_symbols_follow", + utils.wrap(follow_symbol, args.afile), + 100, + utils.debounce_strategy.CALL_LAST_ONLY + ) +end + +---Navigate to the given path. +M.navigate = function(state, path, path_to_reveal, callback, async) + state.lsp_winid, _ = utils.get_appropriate_window(state) + state.lsp_bufnr = vim.api.nvim_win_get_buf(state.lsp_winid) + state.path = vim.api.nvim_buf_get_name(state.lsp_bufnr) + + symbols.render_symbols(state) + + if type(callback) == "function" then + vim.schedule(callback) + end +end + +---Configures the plugin, should be called before the plugin is used. +---@param config table Configuration table containing any keys that the user +---wants to change from the defaults. May be empty to accept default values. +M.setup = function(config, global_config) + symbols.setup(config) + + if config.before_render then + manager.subscribe(M.name, { + event = events.BEFORE_RENDER, + handler = function(state) + local this_state = get_state() + if state == this_state then + config.before_render(this_state) + end + end, + }) + end + + local refresh_events = { + events.VIM_BUFFER_ENTER, + events.VIM_INSERT_LEAVE, + events.VIM_TEXT_CHANGED_NORMAL, + } + for _, event in ipairs(refresh_events) do + manager.subscribe(M.name, { + event = event, + handler = refresh_debounced, + }) + end + + if config.follow_cursor then + manager.subscribe(M.name, { + event = events.VIM_CURSOR_MOVED, + handler = follow_debounced, + }) + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/lib/client_filters.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/lib/client_filters.lua new file mode 100644 index 00000000..2273cba4 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/lib/client_filters.lua @@ -0,0 +1,88 @@ +---Utilities function to filter the LSP servers +local utils = require("neo-tree.utils") + +---@alias LspRespRaw table +local M = {} + +---@alias FilterFn fun(client_name: string): boolean + +---Filter clients +---@param filter_type "first" | "all" +---@param filter_fn FilterFn +---@param resp LspRespRaw +---@return table +local filter_clients = function(filter_type, filter_fn, resp) + if resp == nil or type(resp) ~= "table" then + return {} + end + filter_fn = filter_fn or function(client_name) + return true + end + + local result = {} + for client_id, client_resp in pairs(resp) do + local client_name = vim.lsp.get_client_by_id(client_id).name + if filter_fn(client_name) and client_resp.result ~= nil then + result[client_name] = client_resp.result + if filter_type ~= "all" then + break + end + end + end + return result +end + +---Filter only allowed clients +---@param allow_only string[] the list of clients to keep +---@return FilterFn +local allow_only = function(allow_only) + return function(client_name) + return vim.tbl_contains(allow_only, client_name) + end +end + +---Ignore clients +---@param ignore string[] the list of clients to remove +---@return FilterFn +local ignore = function(ignore) + return function(client_name) + return not vim.tbl_contains(ignore, client_name) + end +end + +---Main entry point for the filter +---@param resp LspRespRaw +---@return table +M.filter_resp = function(resp) + return {} +end + +---Setup the filter accordingly to the config +---@see neo-tree-document-symbols-source for more details on options that the filter accepts +---@param cfg_flt "first" | "all" | { type: "first" | "all", fn: FilterFn, allow_only: string[], ignore: string[] } +M.setup = function(cfg_flt) + local filter_type = "first" + local filter_fn = nil + + if type(cfg_flt) == "table" then + if cfg_flt.type == "all" then + filter_type = "all" + end + + if cfg_flt.fn ~= nil then + filter_fn = cfg_flt.fn + elseif cfg_flt.allow_only then + filter_fn = allow_only(cfg_flt.allow_only) + elseif cfg_flt.ignore then + filter_fn = ignore(cfg_flt.ignore) + end + elseif cfg_flt == "all" then + filter_type = "all" + end + + M.filter_resp = function(resp) + return filter_clients(filter_type, filter_fn, resp) + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/lib/kinds.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/lib/kinds.lua new file mode 100644 index 00000000..50440bb0 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/lib/kinds.lua @@ -0,0 +1,62 @@ +---Helper module to render symbols' kinds +---Need to be initialized by calling M.setup() +local M = {} + +local kinds_id_to_name = { + [0] = "Root", + [1] = "File", + [2] = "Module", + [3] = "Namespace", + [4] = "Package", + [5] = "Class", + [6] = "Method", + [7] = "Property", + [8] = "Field", + [9] = "Constructor", + [10] = "Enum", + [11] = "Interface", + [12] = "Function", + [13] = "Variable", + [14] = "Constant", + [15] = "String", + [16] = "Number", + [17] = "Boolean", + [18] = "Array", + [19] = "Object", + [20] = "Key", + [21] = "Null", + [22] = "EnumMember", + [23] = "Struct", + [24] = "Event", + [25] = "Operator", + [26] = "TypeParameter", +} + +local kinds_map = {} + +---Get how the kind with kind_id should be rendered +---@param kind_id integer the kind_id to be render +---@return table res of the form { name = kind_display_name, icon = kind_icon, hl = kind_hl } +M.get_kind = function(kind_id) + local kind_name = kinds_id_to_name[kind_id] + return vim.tbl_extend( + "force", + { name = kind_name or ("Unknown: " .. kind_id), icon = "?", hl = "" }, + kind_name and (kinds_map[kind_name] or {}) or kinds_map["Unknown"] + ) +end + +---Setup the module with custom kinds +---@param custom_kinds table additional kinds, should be of the form { [kind_id] = kind_name } +---@param kinds_display table mapping of kind_name to corresponding display name, icon and hl group +--- { [kind_name] = { +--- name = kind_display_name, +--- icon = kind_icon, +--- hl = kind_hl +--- }, } +M.setup = function(custom_kinds, kinds_display) + kinds_id_to_name = vim.tbl_deep_extend("force", kinds_id_to_name, custom_kinds or {}) + kinds_map = kinds_display +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/lib/symbols_utils.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/lib/symbols_utils.lua new file mode 100644 index 00000000..491fcc3e --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/document_symbols/lib/symbols_utils.lua @@ -0,0 +1,210 @@ +---Utilities functions for the document_symbols source +local renderer = require("neo-tree.ui.renderer") +local filters = require("neo-tree.sources.document_symbols.lib.client_filters") +local kinds = require("neo-tree.sources.document_symbols.lib.kinds") + +local M = {} + +---@alias Loc integer[] a location in a buffer {row, col}, 0-indexed +---@alias LocRange { start: Loc, ["end"]: Loc } a range consisting of two loc + +---@class SymbolExtra +---@field bufnr integer the buffer containing the symbols, +---@field kind string the kind of each symbol +---@field selection_range LocRange the symbol's location +---@field position Loc start of symbol's definition +---@field end_position Loc start of symbol's definition + +---@class SymbolNode see +---@field id string +---@field name string name of symbol +---@field path string buffer path - should all be the same +---@field type "root"|"symbol" +---@field children SymbolNode[] +---@field extra SymbolExtra additional info + +---@alias LspLoc { line: integer, character: integer} +---@alias LspRange { start : LspLoc, ["end"]: LspLoc } +---@class LspRespNode +---@field name string +---@field detail string? +---@field kind integer +---@field tags any +---@field deprecated boolean? +---@field range LspRange +---@field selectionRange LspRange +---@field children LspRespNode[] + +---Parse the LspRange +---@param range LspRange the LspRange object to parse +---@return LocRange range the parsed range +local parse_range = function(range) + return { + start = { range.start.line, range.start.character }, + ["end"] = { range["end"].line, range["end"].character }, + } +end + +---Compare two tuples of length 2 by first - second elements +---@param a Loc +---@param b Loc +---@return boolean +local loc_less_than = function(a, b) + if a[1] < b[1] then + return true + elseif a[1] == b[1] then + return a[2] <= b[2] + end + return false +end + +---Check whether loc is contained in range, i.e range[1] <= loc <= range[2] +---@param loc Loc +---@param range LocRange +---@return boolean +M.is_loc_in_range = function(loc, range) + return loc_less_than(range[1], loc) and loc_less_than(loc, range[2]) +end + +---Get the the current symbol under the cursor +---@param tree any the Nui symbol tree +---@param loc Loc the cursor location {row, col} (0-index) +---@return string node_id +M.get_symbol_by_loc = function(tree, loc) + local function dfs(node) + local node_id = node:get_id() + if node:has_children() then + for _, child in ipairs(tree:get_nodes(node_id)) do + if M.is_loc_in_range(loc, { child.extra.position, child.extra.end_position }) then + return dfs(child) + end + end + end + return node_id + end + + for _, root in ipairs(tree:get_nodes()) do + local node_id = dfs(root) + if node_id ~= root:get_id() then + return node_id + end + end + return "" +end + +---Parse the LSP response into a tree. Each node on the tree follows +---the same structure as a NuiTree node, with the extra field +---containing additional information. +---@param resp_node LspRespNode the LSP response node +---@param id string the id of the current node +---@return SymbolNode symb_node the parsed tree +local function parse_resp(resp_node, id, state, parent_search_path) + -- parse all children + local children = {} + local search_path = parent_search_path .. "/" .. resp_node.name + for i, child in ipairs(resp_node.children or {}) do + local child_node = parse_resp(child, id .. "." .. i, state, search_path) + table.insert(children, child_node) + end + + -- parse current node + local preview_range = parse_range(resp_node.range) + local symb_node = { + id = id, + name = resp_node.name, + type = "symbol", + path = state.path, + children = children, + extra = { + bufnr = state.lsp_bufnr, + kind = kinds.get_kind(resp_node.kind), + selection_range = parse_range(resp_node.selectionRange), + search_path = search_path, + -- detail = resp_node.detail, + position = preview_range.start, + end_position = preview_range["end"], + }, + } + return symb_node +end + +---Callback function for lsp request +---@param lsp_resp LspRespRaw the response of the lsp client +---@param state table the state of the source +local on_lsp_resp = function(lsp_resp, state) + if lsp_resp == nil or type(lsp_resp) ~= "table" then + return + end + + -- filter the response to get only the desired LSP + local resp = filters.filter_resp(lsp_resp) + + local bufname = state.path + local items = {} + + -- parse each client's response + for client_name, client_result in pairs(resp) do + local symbol_list = {} + for i, resp_node in ipairs(client_result) do + table.insert(symbol_list, parse_resp(resp_node, #items .. "." .. i, state, "/")) + end + + -- add the parsed response to the tree + local splits = vim.split(bufname, "/") + local filename = splits[#splits] + table.insert(items, { + id = "" .. #items, + name = string.format("SYMBOLS (%s) in %s", client_name, filename), + path = bufname, + type = "root", + children = symbol_list, + extra = { kind = kinds.get_kind(0), search_path = "/" }, + }) + end + renderer.show_nodes(items, state) +end + +M.render_symbols = function(state) + local bufnr = state.lsp_bufnr + local bufname = state.path + + -- if no client found, terminate + local client_found = false + for _, client in pairs(vim.lsp.get_active_clients({ bufnr = bufnr })) do + if client.server_capabilities.documentSymbolProvider then + client_found = true + break + end + end + if not client_found then + local splits = vim.split(bufname, "/") + renderer.show_nodes({ + { + id = "0", + name = "No client found for " .. splits[#splits], + path = bufname, + type = "root", + children = {}, + extra = { kind = kinds.get_kind(0), search_path = "/" }, + }, + }, state) + return + end + + -- client found + vim.lsp.buf_request_all( + bufnr, + "textDocument/documentSymbol", + { textDocument = vim.lsp.util.make_text_document_params(bufnr) }, + function(resp) + on_lsp_resp(resp, state) + end + ) +end + +M.setup = function(config) + filters.setup(config.client_filters) + kinds.setup(config.custom_kinds, config.kinds) +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/commands.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/commands.lua new file mode 100644 index 00000000..3198d9f1 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/commands.lua @@ -0,0 +1,261 @@ +--This file should contain all commands meant to be used by mappings. + +local cc = require("neo-tree.sources.common.commands") +local fs = require("neo-tree.sources.filesystem") +local utils = require("neo-tree.utils") +local filter = require("neo-tree.sources.filesystem.lib.filter") +local renderer = require("neo-tree.ui.renderer") +local log = require("neo-tree.log") + +local M = {} +local refresh = function(state) + fs._navigate_internal(state, nil, nil, nil, false) +end + +local redraw = function(state) + renderer.redraw(state) +end + +M.add = function(state) + cc.add(state, utils.wrap(fs.show_new_children, state)) +end + +M.add_directory = function(state) + cc.add_directory(state, utils.wrap(fs.show_new_children, state)) +end + +M.clear_filter = function(state) + fs.reset_search(state, true) +end + +M.copy = function(state) + cc.copy(state, utils.wrap(fs.focus_destination_children, state)) +end + +---Marks node as copied, so that it can be pasted somewhere else. +M.copy_to_clipboard = function(state) + cc.copy_to_clipboard(state, utils.wrap(redraw, state)) +end + +M.copy_to_clipboard_visual = function(state, selected_nodes) + cc.copy_to_clipboard_visual(state, selected_nodes, utils.wrap(redraw, state)) +end + +---Marks node as cut, so that it can be pasted (moved) somewhere else. +M.cut_to_clipboard = function(state) + cc.cut_to_clipboard(state, utils.wrap(redraw, state)) +end + +M.cut_to_clipboard_visual = function(state, selected_nodes) + cc.cut_to_clipboard_visual(state, selected_nodes, utils.wrap(redraw, state)) +end + +M.move = function(state) + cc.move(state, utils.wrap(fs.focus_destination_children, state)) +end + +---Pastes all items from the clipboard to the current directory. +M.paste_from_clipboard = function(state) + cc.paste_from_clipboard(state, utils.wrap(fs.show_new_children, state)) +end + +M.delete = function(state) + cc.delete(state, utils.wrap(refresh, state)) +end + +M.delete_visual = function(state, selected_nodes) + cc.delete_visual(state, selected_nodes, utils.wrap(refresh, state)) +end + +M.expand_all_nodes = function(state, node) + if node == nil then + node = state.tree:get_node(state.path) + end + cc.expand_all_nodes(state, node, fs.prefetcher) +end + +---Shows the filter input, which will filter the tree. +M.filter_as_you_type = function(state) + filter.show_filter(state, true) +end + +---Shows the filter input, which will filter the tree. +M.filter_on_submit = function(state) + filter.show_filter(state, false) +end + +---Shows the filter input in fuzzy finder mode. +M.fuzzy_finder = function(state) + filter.show_filter(state, true, true) +end + +---Shows the filter input in fuzzy finder mode. +M.fuzzy_finder_directory = function(state) + filter.show_filter(state, true, "directory") +end + +---Shows the filter input in fuzzy sorter +M.fuzzy_sorter = function(state) + filter.show_filter(state, true, true, true) +end + +---Shows the filter input in fuzzy sorter with only directories +M.fuzzy_sorter_directory = function(state) + filter.show_filter(state, true, "directory", true) +end + +---Navigate up one level. +M.navigate_up = function(state) + local parent_path, _ = utils.split_path(state.path) + if not utils.truthy(parent_path) then + return + end + local path_to_reveal = nil + local node = state.tree:get_node() + if node then + path_to_reveal = node:get_id() + end + if state.search_pattern then + fs.reset_search(state, false) + end + log.debug("Changing directory to:", parent_path) + fs._navigate_internal(state, parent_path, path_to_reveal, nil, false) +end + +local focus_next_git_modified = function(state, reverse) + local node = state.tree:get_node() + local current_path = node:get_id() + local g = state.git_status_lookup + if not utils.truthy(g) then + return + end + local paths = { current_path } + for path, status in pairs(g) do + if path ~= current_path and status and status ~= "!!" then + --don't include files not in the current working directory + if utils.is_subpath(state.path, path) then + table.insert(paths, path) + end + end + end + local sorted_paths = utils.sort_by_tree_display(paths) + if reverse then + sorted_paths = utils.reverse_list(sorted_paths) + end + + local is_file = function(path) + local success, stats = pcall(vim.loop.fs_stat, path) + return (success and stats and stats.type ~= "directory") + end + + local passed = false + local target = nil + for _, path in ipairs(sorted_paths) do + if target == nil and is_file(path) then + target = path + end + if passed then + if is_file(path) then + target = path + break + end + elseif path == current_path then + passed = true + end + end + + local existing = state.tree:get_node(target) + if existing then + renderer.focus_node(state, target) + else + fs.navigate(state, state.path, target, nil, false) + end +end + +M.next_git_modified = function(state) + focus_next_git_modified(state, false) +end + +M.prev_git_modified = function(state) + focus_next_git_modified(state, true) +end + +M.open = function(state) + cc.open(state, utils.wrap(fs.toggle_directory, state)) +end +M.open_split = function(state) + cc.open_split(state, utils.wrap(fs.toggle_directory, state)) +end +M.open_rightbelow_vs = function(state) + cc.open_rightbelow_vs(state, utils.wrap(fs.toggle_directory, state)) +end +M.open_leftabove_vs = function(state) + cc.open_leftabove_vs(state, utils.wrap(fs.toggle_directory, state)) +end +M.open_vsplit = function(state) + cc.open_vsplit(state, utils.wrap(fs.toggle_directory, state)) +end +M.open_tabnew = function(state) + cc.open_tabnew(state, utils.wrap(fs.toggle_directory, state)) +end +M.open_drop = function(state) + cc.open_drop(state, utils.wrap(fs.toggle_directory, state)) +end +M.open_tab_drop = function(state) + cc.open_tab_drop(state, utils.wrap(fs.toggle_directory, state)) +end + +M.open_with_window_picker = function(state) + cc.open_with_window_picker(state, utils.wrap(fs.toggle_directory, state)) +end +M.split_with_window_picker = function(state) + cc.split_with_window_picker(state, utils.wrap(fs.toggle_directory, state)) +end +M.vsplit_with_window_picker = function(state) + cc.vsplit_with_window_picker(state, utils.wrap(fs.toggle_directory, state)) +end + +M.refresh = refresh + +M.rename = function(state) + cc.rename(state, utils.wrap(refresh, state)) +end + +M.set_root = function(state) + if state.search_pattern then + fs.reset_search(state, false) + end + + local node = state.tree:get_node() + while node and node.type ~= "directory" do + local parent_id = node:get_parent_id() + node = parent_id and state.tree:get_node(parent_id) or nil + end + + if not node then + return + end + + fs._navigate_internal(state, node:get_id(), nil, nil, false) +end + +---Toggles whether hidden files are shown or not. +M.toggle_hidden = function(state) + state.filtered_items.visible = not state.filtered_items.visible + log.info("Toggling hidden files: " .. tostring(state.filtered_items.visible)) + refresh(state) +end + +---Toggles whether the tree is filtered by gitignore or not. +M.toggle_gitignore = function(state) + log.warn("`toggle_gitignore` has been removed, running toggle_hidden instead.") + M.toggle_hidden(state) +end + +M.toggle_node = function(state) + cc.toggle_node(state, utils.wrap(fs.toggle_directory, state)) +end + +cc._add_common_commands(M) + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/components.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/components.lua new file mode 100644 index 00000000..d2839aab --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/components.lua @@ -0,0 +1,40 @@ +-- This file contains the built-in components. Each componment is a function +-- that takes the following arguments: +-- config: A table containing the configuration provided by the user +-- when declaring this component in their renderer config. +-- node: A NuiNode object for the currently focused node. +-- state: The current state of the source providing the items. +-- +-- The function should return either a table, or a list of tables, each of which +-- contains the following keys: +-- text: The text to display for this item. +-- highlight: The highlight group to apply to this text. + +local highlights = require("neo-tree.ui.highlights") +local common = require("neo-tree.sources.common.components") +local utils = require("neo-tree.utils") + +local M = {} + +M.current_filter = function(config, node, state) + local filter = node.search_pattern or "" + if filter == "" then + return {} + end + return { + { + text = "Find", + highlight = highlights.DIM_TEXT, + }, + { + text = string.format('"%s"', filter), + highlight = config.highlight or highlights.FILTER_TERM, + }, + { + text = "in", + highlight = highlights.DIM_TEXT, + }, + } +end + +return vim.tbl_deep_extend("force", common, M) diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/init.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/init.lua new file mode 100644 index 00000000..a6a3e4b2 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/init.lua @@ -0,0 +1,434 @@ +--This file should have all functions that are in the public api and either set +--or read the state of this source. + +local vim = vim +local utils = require("neo-tree.utils") +local fs_scan = require("neo-tree.sources.filesystem.lib.fs_scan") +local renderer = require("neo-tree.ui.renderer") +local events = require("neo-tree.events") +local log = require("neo-tree.log") +local manager = require("neo-tree.sources.manager") +local git = require("neo-tree.git") +local glob = require("neo-tree.sources.filesystem.lib.globtopattern") + +local M = { + name = "filesystem", + display_name = " 󰉓 Files ", +} + +local wrap = function(func) + return utils.wrap(func, M.name) +end + +local get_state = function(tabid) + return manager.get_state(M.name, tabid) +end + +local follow_internal = function(callback, force_show, async) + log.trace("follow called") + local state = get_state() + if vim.bo.filetype == "neo-tree" or vim.bo.filetype == "neo-tree-popup" then + return false + end + local path_to_reveal = utils.normalize_path(manager.get_path_to_reveal() or "") + if not utils.truthy(path_to_reveal) then + return false + end + ---@cast path_to_reveal string + + if state.current_position == "float" then + return false + end + if not state.path then + return false + end + local window_exists = renderer.window_exists(state) + if window_exists then + local node = state.tree and state.tree:get_node() + if node then + if node:get_id() == path_to_reveal then + -- already focused + return false + end + end + else + if not force_show then + return false + end + end + + local is_in_path = path_to_reveal:sub(1, #state.path) == state.path + if not is_in_path then + return false + end + + log.debug("follow file: ", path_to_reveal) + local show_only_explicitly_opened = function() + state.explicitly_opened_directories = state.explicitly_opened_directories or {} + local expanded_nodes = renderer.get_expanded_nodes(state.tree) + local state_changed = false + for _, id in ipairs(expanded_nodes) do + if not state.explicitly_opened_directories[id] then + if path_to_reveal:sub(1, #id) == id then + state.explicitly_opened_directories[id] = state.follow_current_file.leave_dirs_open + else + local node = state.tree:get_node(id) + if node then + node:collapse() + state_changed = true + end + end + end + if state_changed then + renderer.redraw(state) + end + end + end + + fs_scan.get_items(state, nil, path_to_reveal, function() + show_only_explicitly_opened() + renderer.focus_node(state, path_to_reveal, true) + if type(callback) == "function" then + callback() + end + end, async) + return true +end + +M.follow = function(callback, force_show) + if vim.fn.bufname(0) == "COMMIT_EDITMSG" then + return false + end + if utils.is_floating() then + return false + end + utils.debounce("neo-tree-follow", function() + return follow_internal(callback, force_show) + end, 100, utils.debounce_strategy.CALL_LAST_ONLY) +end + +M._navigate_internal = function(state, path, path_to_reveal, callback, async) + log.trace("navigate_internal", state.current_position, path, path_to_reveal) + state.dirty = false + local is_search = utils.truthy(state.search_pattern) + local path_changed = false + if not path and not state.bind_to_cwd then + path = state.path + end + if path == nil then + log.debug("navigate_internal: path is nil, using cwd") + path = manager.get_cwd(state) + end + path = utils.normalize_path(path) + if path ~= state.path then + log.debug("navigate_internal: path changed from ", state.path, " to ", path) + state.path = path + path_changed = true + end + + if path_to_reveal then + renderer.position.set(state, path_to_reveal) + log.debug("navigate_internal: in path_to_reveal, state.position=", state.position.node_id) + fs_scan.get_items(state, nil, path_to_reveal, callback) + else + local is_current = state.current_position == "current" + local follow_file = state.follow_current_file.enabled + and not is_search + and not is_current + and manager.get_path_to_reveal() + local handled = false + if utils.truthy(follow_file) then + handled = follow_internal(callback, true, async) + end + if not handled then + local success, msg = pcall(renderer.position.save, state) + if success then + log.trace("navigate_internal: position saved") + else + log.trace("navigate_internal: FAILED to save position: ", msg) + end + fs_scan.get_items(state, nil, nil, callback, async) + end + end + + if path_changed and state.bind_to_cwd then + manager.set_cwd(state) + end + local config = require("neo-tree").config + if config.enable_git_status and not is_search and config.git_status_async then + git.status_async(state.path, state.git_base, config.git_status_async_options) + end +end + +---Navigate to the given path. +---@param path string Path to navigate to. If empty, will navigate to the cwd. +---@param path_to_reveal string Node to focus after the items are loaded. +---@param callback function Callback to call after the items are loaded. +M.navigate = function(state, path, path_to_reveal, callback, async) + state._ready = false + log.trace("navigate", path, path_to_reveal, async) + utils.debounce("filesystem_navigate", function() + M._navigate_internal(state, path, path_to_reveal, callback, async) + end, 100, utils.debounce_strategy.CALL_FIRST_AND_LAST) +end + +M.reset_search = function(state, refresh, open_current_node) + log.trace("reset_search") + -- Cancel any pending search + require("neo-tree.sources.filesystem.lib.filter_external").cancel() + -- reset search state + state.fuzzy_finder_mode = nil + state.use_fzy = nil + state.fzy_sort_result_scores = nil + state.fzy_sort_file_list_cache = nil + state.sort_function_override = nil + + if refresh == nil then + refresh = true + end + if state.open_folders_before_search then + state.force_open_folders = vim.deepcopy(state.open_folders_before_search, { noref = 1 }) + else + state.force_open_folders = nil + end + state.search_pattern = nil + state.open_folders_before_search = nil + if open_current_node then + local success, node = pcall(state.tree.get_node, state.tree) + if success and node then + local path = node:get_id() + renderer.position.set(state, path) + if node.type == "directory" then + path = utils.remove_trailing_slash(path) + log.trace("opening directory from search: ", path) + M.navigate(state, nil, path, function() + pcall(renderer.focus_node, state, path, false) + end) + else + utils.open_file(state, path) + if + refresh + and state.current_position ~= "current" + and state.current_position ~= "float" + then + M.navigate(state, nil, path) + end + end + end + else + if refresh then + M.navigate(state) + end + end +end + +M.show_new_children = function(state, node_or_path) + local node = node_or_path + if node_or_path == nil then + node = state.tree:get_node() + node_or_path = node:get_id() + elseif type(node_or_path) == "string" then + node = state.tree:get_node(node_or_path) + if node == nil then + local parent_path, _ = utils.split_path(node_or_path) + node = state.tree:get_node(parent_path) + if node == nil then + M.navigate(state, nil, node_or_path) + return + end + end + else + node = node_or_path + node_or_path = node:get_id() + end + + if node.type ~= "directory" then + return + end + + M.navigate(state, nil, node_or_path) +end + +M.focus_destination_children = function(state, move_from, destination) + return M.show_new_children(state, destination) +end + +---Configures the plugin, should be called before the plugin is used. +---@param config table Configuration table containing any keys that the user +--wants to change from the defaults. May be empty to accept default values. +M.setup = function(config, global_config) + config.filtered_items = config.filtered_items or {} + config.enable_git_status = global_config.enable_git_status + + for _, key in ipairs({ "hide_by_pattern", "never_show_by_pattern" }) do + local list = config.filtered_items[key] + if type(list) == "table" then + for i, pattern in ipairs(list) do + list[i] = glob.globtopattern(pattern) + end + end + end + + for _, key in ipairs({ "hide_by_name", "always_show", "never_show" }) do + local list = config.filtered_items[key] + if type(list) == "table" then + config.filtered_items[key] = utils.list_to_dict(list) + end + end + + --Configure events for before_render + if config.before_render then + --convert to new event system + manager.subscribe(M.name, { + event = events.BEFORE_RENDER, + handler = function(state) + local this_state = get_state() + if state == this_state then + config.before_render(this_state) + end + end, + }) + elseif global_config.enable_git_status and global_config.git_status_async then + manager.subscribe(M.name, { + event = events.GIT_STATUS_CHANGED, + handler = wrap(manager.git_status_changed), + }) + elseif global_config.enable_git_status then + manager.subscribe(M.name, { + event = events.BEFORE_RENDER, + handler = function(state) + local this_state = get_state() + if state == this_state then + state.git_status_lookup = git.status(state.git_base) + end + end, + }) + end + + -- Respond to git events from git_status source or Fugitive + if global_config.enable_git_status then + manager.subscribe(M.name, { + event = events.GIT_EVENT, + handler = function() + manager.refresh(M.name) + end, + }) + end + + --Configure event handlers for file changes + if config.use_libuv_file_watcher then + manager.subscribe(M.name, { + event = events.FS_EVENT, + handler = wrap(manager.refresh), + }) + else + require("neo-tree.sources.filesystem.lib.fs_watch").unwatch_all() + if global_config.enable_refresh_on_write then + manager.subscribe(M.name, { + event = events.VIM_BUFFER_CHANGED, + handler = function(arg) + local afile = arg.afile or "" + if utils.is_real_file(afile) then + log.trace("refreshing due to vim_buffer_changed event: ", afile) + manager.refresh("filesystem") + else + log.trace("Ignoring vim_buffer_changed event for non-file: ", afile) + end + end, + }) + end + end + + --Configure event handlers for cwd changes + if config.bind_to_cwd then + manager.subscribe(M.name, { + event = events.VIM_DIR_CHANGED, + handler = wrap(manager.dir_changed), + }) + end + + --Configure event handlers for lsp diagnostic updates + if global_config.enable_diagnostics then + manager.subscribe(M.name, { + event = events.VIM_DIAGNOSTIC_CHANGED, + handler = wrap(manager.diagnostics_changed), + }) + end + + --Configure event handlers for modified files + if global_config.enable_modified_markers then + manager.subscribe(M.name, { + event = events.VIM_BUFFER_MODIFIED_SET, + handler = wrap(manager.opened_buffers_changed), + }) + end + + if global_config.enable_opened_markers then + for _, event in ipairs({ events.VIM_BUFFER_ADDED, events.VIM_BUFFER_DELETED }) do + manager.subscribe(M.name, { + event = event, + handler = wrap(manager.opened_buffers_changed), + }) + end + end + + -- Configure event handler for follow_current_file option + if config.follow_current_file.enabled then + manager.subscribe(M.name, { + event = events.VIM_BUFFER_ENTER, + handler = function(args) + if utils.is_real_file(args.afile) then + M.follow() + end + end, + }) + end +end + +---Expands or collapses the current node. +M.toggle_directory = function(state, node, path_to_reveal, skip_redraw, recursive, callback) + local tree = state.tree + if not node then + node = tree:get_node() + end + if node.type ~= "directory" then + return + end + state.explicitly_opened_directories = state.explicitly_opened_directories or {} + if node.loaded == false then + local id = node:get_id() + state.explicitly_opened_directories[id] = true + renderer.position.set(state, nil) + fs_scan.get_items(state, id, path_to_reveal, callback, false, recursive) + elseif node:has_children() then + local updated = false + if node:is_expanded() then + updated = node:collapse() + state.explicitly_opened_directories[node:get_id()] = false + else + updated = node:expand() + state.explicitly_opened_directories[node:get_id()] = true + end + if updated and not skip_redraw then + renderer.redraw(state) + end + if path_to_reveal then + renderer.focus_node(state, path_to_reveal) + end + elseif require("neo-tree").config.filesystem.scan_mode == "deep" then + node.empty_expanded = not node.empty_expanded + renderer.redraw(state) + end +end + +M.prefetcher = { + prefetch = function(state, node) + log.debug("Running fs prefetch for: " .. node:get_id()) + fs_scan.get_dir_items_async(state, node:get_id(), true) + end, + should_prefetch = function(node) + return not node.loaded + end, +} + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/filter.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/filter.lua new file mode 100644 index 00000000..90e7d456 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/filter.lua @@ -0,0 +1,241 @@ +-- This file holds all code for the search function. + +local vim = vim +local Input = require("nui.input") +local event = require("nui.utils.autocmd").event +local fs = require("neo-tree.sources.filesystem") +local popups = require("neo-tree.ui.popups") +local renderer = require("neo-tree.ui.renderer") +local utils = require("neo-tree.utils") +local log = require("neo-tree.log") +local manager = require("neo-tree.sources.manager") + +local M = {} + +local cmds = { + move_cursor_down = function(state, scroll_padding) + renderer.focus_node(state, nil, true, 1, scroll_padding) + end, + + move_cursor_up = function(state, scroll_padding) + renderer.focus_node(state, nil, true, -1, scroll_padding) + vim.cmd("redraw!") + end, +} + +local function create_input_mapping_handle(cmd, state, scroll_padding) + return function() + cmd(state, scroll_padding) + end +end + +M.show_filter = function(state, search_as_you_type, fuzzy_finder_mode, use_fzy) + local popup_options + local winid = vim.api.nvim_get_current_win() + local height = vim.api.nvim_win_get_height(winid) + local scroll_padding = 3 + local popup_msg = "Search:" + + if search_as_you_type then + if fuzzy_finder_mode == "directory" then + popup_msg = "Filter Directories:" + else + popup_msg = "Filter:" + end + end + if state.current_position == "float" then + scroll_padding = 0 + local width = vim.fn.winwidth(winid) + local row = height - 2 + vim.api.nvim_win_set_height(winid, row) + popup_options = popups.popup_options(popup_msg, width, { + relative = "win", + winid = winid, + position = { + row = row, + col = 0, + }, + size = width, + }) + else + local width = vim.fn.winwidth(0) - 2 + local row = height - 3 + popup_options = popups.popup_options(popup_msg, width, { + relative = "win", + winid = winid, + position = { + row = row, + col = 0, + }, + size = width, + }) + end + + local sort_by_score = function(a, b) + -- `state.fzy_sort_result_scores` should be defined in + -- `sources.filesystem.lib.filter_external.fzy_sort_files` + local result_scores = state.fzy_sort_result_scores or { foo = 0, baz = 0 } + local a_score = result_scores[a.path] + local b_score = result_scores[b.path] + if a_score == nil or b_score == nil then + log.debug(string.format([[Fzy: failed to compare %s: %s, %s: %s]], a.path, a_score, b.path, b_score)) + local config = require("neo-tree").config + if config.sort_function ~= nil then + return config.sort_function(a, b) + end + return nil + end + return a_score > b_score + end + + local select_first_file = function() + local is_file = function(node) + return node.type == "file" + end + local files = renderer.select_nodes(state.tree, is_file, 1) + if #files > 0 then + renderer.focus_node(state, files[1]:get_id(), true) + end + end + + local has_pre_search_folders = utils.truthy(state.open_folders_before_search) + if not has_pre_search_folders then + log.trace("No search or pre-search folders, recording pre-search folders now") + state.open_folders_before_search = renderer.get_expanded_nodes(state.tree) + end + + local waiting_for_default_value = utils.truthy(state.search_pattern) + local input = Input(popup_options, { + prompt = " ", + default_value = state.search_pattern, + on_submit = function(value) + if value == "" then + fs.reset_search(state) + else + if search_as_you_type and fuzzy_finder_mode then + fs.reset_search(state, true, true) + return + end + state.search_pattern = value + manager.refresh("filesystem", function() + -- focus first file + local nodes = renderer.get_all_visible_nodes(state.tree) + for _, node in ipairs(nodes) do + if node.type == "file" then + renderer.focus_node(state, node:get_id(), false) + break + end + end + end) + end + end, + --this can be bad in a deep folder structure + on_change = function(value) + if not search_as_you_type then + return + end + -- apparently when a default value is set, on_change fires for every character + if waiting_for_default_value then + if #value < #state.search_pattern then + return + else + waiting_for_default_value = false + end + end + if value == state.search_pattern then + return + elseif value == nil then + return + elseif value == "" then + if state.search_pattern == nil then + return + end + log.trace("Resetting search in on_change") + local original_open_folders = nil + if type(state.open_folders_before_search) == "table" then + original_open_folders = vim.deepcopy(state.open_folders_before_search, { noref = 1 }) + end + fs.reset_search(state) + state.open_folders_before_search = original_open_folders + else + log.trace("Setting search in on_change to: " .. value) + state.search_pattern = value + state.fuzzy_finder_mode = fuzzy_finder_mode + if use_fzy then + state.sort_function_override = sort_by_score + state.use_fzy = true + end + local callback = select_first_file + if fuzzy_finder_mode == "directory" then + callback = nil + end + + local len = #value + local delay = 500 + if len > 3 then + delay = 100 + elseif len > 2 then + delay = 200 + elseif len > 1 then + delay = 400 + end + + utils.debounce("filesystem_filter", function() + fs._navigate_internal(state, nil, nil, callback) + end, delay, utils.debounce_strategy.CALL_LAST_ONLY) + end + end, + }) + + input:mount() + + local restore_height = vim.schedule_wrap(function() + if vim.api.nvim_win_is_valid(winid) then + vim.api.nvim_win_set_height(winid, height) + end + end) + input:map("i", "", function(bufnr) + vim.cmd("stopinsert") + input:unmount() + if fuzzy_finder_mode and utils.truthy(state.search_pattern) then + fs.reset_search(state, true) + end + restore_height() + end, { noremap = true }) + + input:map("i", "", "", { noremap = true }) + + input:on({ event.BufLeave, event.BufDelete }, function() + vim.cmd("stopinsert") + input:unmount() + -- If this was closed due to submit, that function will handle the reset_search + vim.defer_fn(function() + if fuzzy_finder_mode and utils.truthy(state.search_pattern) then + fs.reset_search(state, true) + end + end, 100) + restore_height() + end, { once = true }) + + if fuzzy_finder_mode then + local config = require("neo-tree").config + for lhs, cmd_name in pairs(config.filesystem.window.fuzzy_finder_mappings) do + local t = type(cmd_name) + if t == "string" then + local cmd = cmds[cmd_name] + if cmd then + input:map("i", lhs, create_input_mapping_handle(cmd, state, scroll_padding), { noremap = true }) + else + log.warn(string.format("Invalid command in fuzzy_finder_mappings: %s = %s", lhs, cmd_name)) + end + elseif t == "function" then + input:map("i", lhs, create_input_mapping_handle(cmd_name, state, scroll_padding), + { noremap = true }) + else + log.warn(string.format("Invalid command in fuzzy_finder_mappings: %s = %s", lhs, cmd_name)) + end + end + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/filter_external.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/filter_external.lua new file mode 100644 index 00000000..a8f1ed0e --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/filter_external.lua @@ -0,0 +1,392 @@ +local vim = vim +local log = require("neo-tree.log") +local Job = require("plenary.job") +local utils = require("neo-tree.utils") +local Queue = require("neo-tree.collections").Queue + +local M = {} +local fd_supports_max_results = nil +local unpack = unpack or table.unpack + +local test_for_max_results = function(cmd) + if fd_supports_max_results == nil then + if cmd == "fd" or cmd == "fdfind" then + --test if it supports the max-results option + local test = vim.fn.system(cmd .. " this_is_only_a_test --max-depth=1 --max-results=1") + if test:match("^error:") then + fd_supports_max_results = false + log.debug(cmd, "does NOT support max-results") + else + fd_supports_max_results = true + log.debug(cmd, "supports max-results") + end + end + end +end + +local get_find_command = function(state) + if state.find_command then + test_for_max_results(state.find_command) + return state.find_command + end + + if 1 == vim.fn.executable("fdfind") then + state.find_command = "fdfind" + elseif 1 == vim.fn.executable("fd") then + state.find_command = "fd" + elseif 1 == vim.fn.executable("find") and vim.fn.has("win32") == 0 then + state.find_command = "find" + elseif 1 == vim.fn.executable("where") then + state.find_command = "where" + end + + test_for_max_results(state.find_command) + return state.find_command +end + +local running_jobs = Queue:new() +local kill_job = function(job) + local pid = job.pid + job:shutdown() + if pid ~= nil and pid > 0 then + if utils.is_windows then + vim.fn.system("taskkill /F /T /PID " .. pid) + else + vim.fn.system("kill -9 " .. pid) + end + end + return true +end + +M.cancel = function() + if running_jobs:is_empty() then + return + end + running_jobs:for_each(kill_job) +end + +---@class FileTypes +---@field file boolean +---@field directory boolean +---@field symlink boolean +---@field socket boolean +---@field pipe boolean +---@field executable boolean +---@field empty boolean +---@field block boolean Only for `find` +---@field character boolean Only for `find` + +---filter_files_external +-- Spawns a filter command based on `cmd` +---@param cmd string Command to execute. Use `get_find_command` most times. +---@param path string Base directory to start the search. +---@param glob string | nil If not nil, do glob search. Take precedence on `regex` +---@param regex string | nil If not nil, do regex search if command supports. if glob ~= nil, ignored +---@param full_path boolean If true, search agaist the absolute path +---@param types FileTypes | nil Return only true filetypes. If nil, all are returned. +---@param ignore { dotfiles: boolean?, gitignore: boolean? } If true, ignored from result. Default: false +---@param limit? integer | nil Maximim number of results. nil will return everything. +---@param find_args? string[] | table Any additional options passed to command if any. +---@param on_insert? fun(err: string, line: string): any Executed for each line of stdout and stderr. +---@param on_exit? fun(return_val: table): any Executed at the end. +M.filter_files_external = function( + cmd, + path, + glob, + regex, + full_path, + types, + ignore, + limit, + find_args, + on_insert, + on_exit +) + if glob ~= nil and regex ~= nil then + local log_msg = string.format([[glob: %s, regex: %s]], glob, regex) + log.warn("both glob and regex are set. glob will take precedence. " .. log_msg) + end + ignore = ignore or {} + types = types or {} + limit = limit or math.huge -- math.huge == no limit + local file_type_map = { + file = "f", + directory = "d", + symlink = "l", + socket = "s", + pipe = "p", + executable = "x", -- only for `fd` + empty = "e", -- only for `fd` + block = "b", -- only for `find` + character = "c", -- only for `find` + } + + local args = {} + local function append(...) + for _, v in pairs({ ... }) do + if v ~= nil then + args[#args + 1] = v + end + end + end + + local function append_find_args() + if find_args then + if type(find_args) == "string" then + append(find_args) + elseif type(find_args) == "table" then + if find_args[1] then + append(unpack(find_args)) + elseif find_args[cmd] then + append(unpack(find_args[cmd])) ---@diagnostic disable-line + end + elseif type(find_args) == "function" then + args = find_args(cmd, path, glob, args) + end + end + end + + if cmd == "fd" or cmd == "fdfind" then + if not ignore.dotfiles then + append("--hidden") + end + if not ignore.gitignore then + append("--no-ignore") + end + append("--color", "never") + if fd_supports_max_results and 0 < limit and limit < math.huge then + append("--max-results", limit) + end + for k, v in pairs(types) do + if v and file_type_map[k] ~= nil then + append("--type", k) + end + end + if full_path then + append("--full-path") + if glob ~= nil then + local words = utils.split(glob, " ") + regex = ".*" .. table.concat(words, ".*") .. ".*" + glob = nil + end + end + if glob ~= nil then + append("--glob") + end + append_find_args() + append("--", glob or regex or "") + append(path) + elseif cmd == "find" then + append(path) + local file_types = {} + for k, v in pairs(types) do + if v and file_type_map[k] ~= nil then + file_types[#file_types + 1] = file_type_map[k] + end + end + if #file_types > 0 then + append("-type", table.concat(file_types, ",")) + end + if types.empty then + append("-empty") + end + if types.executable then + append("-executable") + end + if not ignore.dotfiles then + append("-not", "-path", "*/.*") + end + if glob ~= nil and not full_path then + append("-iname", glob) + elseif glob ~= nil and full_path then + local words = utils.split(glob, " ") + regex = ".*" .. table.concat(words, ".*") .. ".*" + append("-regextype", "sed", "-regex", regex) + elseif regex ~= nil then + append("-regextype", "sed", "-regex", regex) + end + append_find_args() + elseif cmd == "fzf" then + -- This does not work yet, there's some kind of issue with how fzf uses stdout + error("fzf is not a supported find_command") + append_find_args() + append("--no-sort", "--no-expect", "--filter", glob or regex) -- using the raw term without glob patterns + elseif cmd == "where" then + append_find_args() + append("/r", path, glob or regex) + else + return { "No search command found!" } + end + + if fd_supports_max_results then + limit = math.huge -- `fd` manages limit on its own + end + local item_count = 0 + local job = Job:new({ + command = cmd, + cwd = path, + args = args, + enable_recording = false, + on_stdout = function(err, line) + if item_count < limit and on_insert then + on_insert(err, line) + item_count = item_count + 1 + end + end, + on_stderr = function(err, line) + if item_count < limit and on_insert then + on_insert(err or line, line) + -- item_count = item_count + 1 + end + end, + on_exit = function(_, return_val) + if on_exit then + on_exit(return_val) + end + end, + }) + + -- This ensures that only one job is running at a time + running_jobs:for_each(kill_job) + running_jobs:add(job) + job:start() +end + +local function fzy_sort_get_total_score(terms, path) + local fzy = require("neo-tree.sources.common.filters.filter_fzy") + local total_score = 0 + for _, term in ipairs(terms) do -- spaces in `opts.term` are treated as `and` + local score = fzy.score(term, path) + if score == fzy.get_score_min() then -- if any not found, end searching + return 0 + end + total_score = total_score + score + end + return total_score +end + +local function modify_parent_scores(result_scores, path, score) + local parent, _ = utils.split_path(path) + while parent ~= nil do -- back propagate the score to its ancesters + if score > (result_scores[parent] or 0) then + result_scores[parent] = score + parent, _ = utils.split_path(parent) + else + break + end + end +end + +M.fzy_sort_files = function(opts, state) + state = state or {} + local filters = opts.filtered_items + local limit = opts.limit or 100 + local full_path_words = opts.find_by_full_path_words + local fuzzy_finder_mode = opts.fuzzy_finder_mode + local pwd = opts.path + if pwd:sub(-1) ~= "/" then + pwd = pwd .. "/" + end + local pwd_length = #pwd + local terms = {} + for term in string.gmatch(opts.term, "[^%s]+") do -- space split opts.term + terms[#terms + 1] = term + end + + -- The base search is anything that contains the characters in the term + -- The fzy score is then used to sort the results + local chars = {} + local regex = ".*" + local chars_to_escape = + { "%", "+", "-", "?", "[", "^", "$", "(", ")", "{", "}", "=", "!", "<", ">", "|", ":", "#" } + for _, term in ipairs(terms) do + for c in term:gmatch(".") do + if not chars[c] then + chars[c] = true + if chars_to_escape[c] then + c = [[\]] .. c + end + regex = regex .. c .. ".*" + end + end + end + + local result_counter = 0 + + local index = 1 + state.fzy_sort_result_scores = {} + local function on_insert(err, path) + if not err then + local relative_path = path + if not full_path_words and #path > pwd_length and path:sub(1, pwd_length) == pwd then + relative_path = "./" .. path:sub(pwd_length + 1) + end + index = index + 1 + if state.fzy_sort_result_scores == nil then + state.fzy_sort_result_scores = {} + end + state.fzy_sort_result_scores[path] = 0 + local score = fzy_sort_get_total_score(terms, relative_path) + if score > 0 then + state.fzy_sort_result_scores[path] = score + result_counter = result_counter + 1 + modify_parent_scores(state.fzy_sort_result_scores, path, score) + opts.on_insert(nil, path) + if result_counter >= limit then + vim.schedule(M.cancel) + end + end + end + end + + M.filter_files_external( + get_find_command(state), + pwd, + nil, + regex, + true, + { directory = fuzzy_finder_mode == "directory", file = fuzzy_finder_mode ~= "directory" }, + { + dotfiles = not filters.visible and filters.hide_dotfiles, + gitignore = not filters.visible and filters.hide_gitignored, + }, + nil, + opts.find_args, + on_insert, + opts.on_exit + ) +end + +M.find_files = function(opts) + local filters = opts.filtered_items + local full_path_words = opts.find_by_full_path_words + local regex, glob = nil, nil + local fuzzy_finder_mode = opts.fuzzy_finder_mode + + glob = opts.term + if glob:sub(1) ~= "*" then + glob = "*" .. glob + end + if glob:sub(-1) ~= "*" then + glob = glob .. "*" + end + + M.filter_files_external( + get_find_command(opts), + opts.path, + glob, + regex, + full_path_words, + { directory = fuzzy_finder_mode == "directory" }, + { + dotfiles = not filters.visible and filters.hide_dotfiles, + gitignore = not filters.visible and filters.hide_gitignored, + }, + opts.limit or 200, + opts.find_args, + opts.on_insert, + opts.on_exit + ) +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/fs_actions.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/fs_actions.lua new file mode 100644 index 00000000..7746e501 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/fs_actions.lua @@ -0,0 +1,620 @@ +-- This file is for functions that mutate the filesystem. + +-- This code started out as a copy from: +-- https://github.com/mhartington/dotfiles +-- and modified to fit neo-tree's api. +-- Permalink: https://github.com/mhartington/dotfiles/blob/7560986378753e0c047d940452cb03a3b6439b11/config/nvim/lua/mh/filetree/init.lua +local vim = vim +local api = vim.api +local loop = vim.loop +local scan = require("plenary.scandir") +local utils = require("neo-tree.utils") +local inputs = require("neo-tree.ui.inputs") +local events = require("neo-tree.events") +local log = require("neo-tree.log") +local Path = require("plenary").path + +local M = {} + +local function find_replacement_buffer(for_buf) + local bufs = vim.api.nvim_list_bufs() + + -- make sure the alternate buffer is at the top of the list + local alt = vim.fn.bufnr("#") + if alt ~= -1 and alt ~= for_buf then + table.insert(bufs, 1, alt) + end + + -- find the first valid real file buffer + for _, buf in ipairs(bufs) do + if buf ~= for_buf then + local is_valid = vim.api.nvim_buf_is_valid(buf) + if is_valid then + local buftype = vim.api.nvim_buf_get_option(buf, "buftype") + if buftype == "" then + return buf + end + end + end + end + return -1 +end + +local function clear_buffer(path) + local buf = utils.find_buffer_by_name(path) + if buf < 1 then + return + end + local alt = find_replacement_buffer(buf) + -- Check all windows to see if they are using the buffer + for _, win in ipairs(vim.api.nvim_list_wins()) do + if vim.api.nvim_win_is_valid(win) and vim.api.nvim_win_get_buf(win) == buf then + -- if there is no alternate buffer yet, create a blank one now + if alt < 1 or alt == buf then + alt = vim.api.nvim_create_buf(true, false) + end + -- replace the buffer displayed in this window with the alternate buffer + vim.api.nvim_win_set_buf(win, alt) + end + end + local success, msg = pcall(vim.api.nvim_buf_delete, buf, { force = true }) + if not success then + log.error("Could not clear buffer: ", msg) + end +end + +---Opens new_buf in each window that has old_buf currently open. +---Useful during file rename. +---@param old_buf number +---@param new_buf number +local function replace_buffer_in_windows(old_buf, new_buf) + for _, win in ipairs(vim.api.nvim_list_wins()) do + if vim.api.nvim_win_is_valid(win) and vim.api.nvim_win_get_buf(win) == old_buf then + vim.api.nvim_win_set_buf(win, new_buf) + end + end +end + +local function rename_buffer(old_path, new_path) + local force_save = function() + vim.cmd("silent! write!") + end + + for _, buf in pairs(vim.api.nvim_list_bufs()) do + if vim.api.nvim_buf_is_loaded(buf) then + local buf_name = vim.api.nvim_buf_get_name(buf) + local new_buf_name = nil + if old_path == buf_name then + new_buf_name = new_path + elseif utils.is_subpath(old_path, buf_name) then + new_buf_name = new_path .. buf_name:sub(#old_path + 1) + end + if utils.truthy(new_buf_name) then + local new_buf = vim.fn.bufadd(new_buf_name) + vim.fn.bufload(new_buf) + vim.api.nvim_buf_set_option(new_buf, "buflisted", true) + replace_buffer_in_windows(buf, new_buf) + + if vim.api.nvim_buf_get_option(buf, "buftype") == "" then + local modified = vim.api.nvim_buf_get_option(buf, "modified") + if modified then + local old_buffer_lines = vim.api.nvim_buf_get_lines(buf, 0, -1, false) + vim.api.nvim_buf_set_lines(new_buf, 0, -1, false, old_buffer_lines) + + local msg = buf_name .. " has been modified. Save under new name? (y/n) " + inputs.confirm(msg, function(confirmed) + if confirmed then + vim.api.nvim_buf_call(new_buf, force_save) + log.trace("Force saving renamed buffer with changes") + else + vim.cmd("echohl WarningMsg") + vim.cmd( + [[echo "Skipping force save. You'll need to save it with `:w!` when you are ready to force writing with the new name."]] + ) + vim.cmd("echohl NONE") + end + end) + end + end + vim.api.nvim_buf_delete(buf, { force = true }) + end + end + end +end + +local function create_all_parents(path) + local create_all_as_folders + function create_all_as_folders(in_path) + if not loop.fs_stat(in_path) then + local parent, _ = utils.split_path(in_path) + if parent then + create_all_as_folders(parent) + end + loop.fs_mkdir(in_path, 493) + end + end + + local parent_path, _ = utils.split_path(path) + create_all_as_folders(parent_path) +end + +-- Gets a non-existing filename from the user and executes the callback with it. +local function get_unused_name( + destination, + using_root_directory, + name_chosen_callback, + first_message +) + if loop.fs_stat(destination) then + local parent_path, name + if not using_root_directory then + parent_path, name = utils.split_path(destination) + elseif #using_root_directory > 0 then + parent_path = destination:sub(1, #using_root_directory) + name = destination:sub(#using_root_directory + 2) + else + parent_path = nil + name = destination + end + + local message = first_message or name .. " already exists. Please enter a new name: " + inputs.input(message, name, function(new_name) + if new_name and string.len(new_name) > 0 then + local new_path = parent_path and parent_path .. utils.path_separator .. new_name or new_name + get_unused_name(new_path, using_root_directory, name_chosen_callback) + end + end) + else + name_chosen_callback(destination) + end +end + +-- Move Node +M.move_node = function(source, destination, callback, using_root_directory) + log.trace( + "Moving node: ", + source, + " to ", + destination, + ", using root directory: ", + using_root_directory + ) + local _, name = utils.split_path(source) + get_unused_name(destination or source, using_root_directory, function(dest) + local function move_file() + create_all_parents(dest) + loop.fs_rename(source, dest, function(err) + if err then + log.error("Could not move the files from", source, "to", dest, ":", err) + return + end + vim.schedule(function() + rename_buffer(source, dest) + end) + vim.schedule(function() + events.fire_event(events.FILE_MOVED, { + source = source, + destination = dest, + }) + if callback then + callback(source, dest) + end + end) + end) + end + local event_result = events.fire_event(events.BEFORE_FILE_MOVE, { + source = source, + destination = dest, + callback = move_file, + }) or {} + if event_result.handled then + return + end + move_file() + end, 'Move "' .. name .. '" to:') +end + +---Plenary path.copy() when used to copy a recursive structure, can return a nested +-- table with for each file a Path instance and the success result. +---@param copy_result table The output of Path.copy() +---@param flat_result table Return value containing the flattened results +local function flatten_path_copy_result(flat_result, copy_result) + if not copy_result then + return + end + for k, v in pairs(copy_result) do + if type(v) == "table" then + flatten_path_copy_result(flat_result, v) + else + table.insert(flat_result, { destination = k.filename, success = v }) + end + end +end + +-- Check if all files were copied successfully, using the flattened copy result +local function check_path_copy_result(flat_result) + if not flat_result then + return + end + for _, file_result in ipairs(flat_result) do + if not file_result.success then + return false + end + end + return true +end + +-- Copy Node +M.copy_node = function(source, _destination, callback, using_root_directory) + local _, name = utils.split_path(source) + get_unused_name(_destination or source, using_root_directory, function(destination) + local parent_path, _ = utils.split_path(destination) + if source == parent_path then + log.warn("Cannot copy a file/folder to itself") + return + end + local source_path = Path:new(source) + if source_path:is_file() then + -- When the source is a file, then Path.copy() currently doesn't create + -- the potential non-existing parent directories of the destination. + create_all_parents(destination) + end + local success, result = pcall(source_path.copy, source_path, { + destination = destination, + recursive = true, + parents = true, + }) + if not success then + log.error("Could not copy the file(s) from", source, "to", destination, ":", result) + return + end + + -- It can happen that the Path.copy() function returns successfully but + -- the copy action still failed. In this case the copy() result contains + -- a nested table of Path instances for each file copied, and the success + -- result. + local flat_result = {} + flatten_path_copy_result(flat_result, result) + if not check_path_copy_result(flat_result) then + log.error("Could not copy the file(s) from", source, "to", destination, ":", flat_result) + return + end + + vim.schedule(function() + events.fire_event(events.FILE_ADDED, destination) + if callback then + callback(source, destination) + end + end) + end, 'Copy "' .. name .. '" to:') +end + +--- Create a new directory +M.create_directory = function(in_directory, callback, using_root_directory) + local base + if type(using_root_directory) == "string" then + if in_directory == using_root_directory then + base = "" + elseif #using_root_directory > 0 then + base = in_directory:sub(#using_root_directory + 2) .. utils.path_separator + else + base = in_directory .. utils.path_separator + end + else + base = vim.fn.fnamemodify(in_directory .. utils.path_separator, ":~") + using_root_directory = false + end + + inputs.input("Enter name for new directory:", base, function(destinations) + if not destinations then + return + end + + for _, destination in ipairs(utils.brace_expand(destinations)) do + if not destination or destination == base then + return + end + + if using_root_directory then + destination = utils.path_join(using_root_directory, destination) + else + destination = vim.fn.fnamemodify(destination, ":p") + end + + if loop.fs_stat(destination) then + log.warn("Directory already exists") + return + end + + create_all_parents(destination) + loop.fs_mkdir(destination, 493) + + vim.schedule(function() + events.fire_event(events.FILE_ADDED, destination) + if callback then + callback(destination) + end + end) + end + end) +end + +--- Create Node +M.create_node = function(in_directory, callback, using_root_directory) + local base + if type(using_root_directory) == "string" then + if in_directory == using_root_directory then + base = "" + elseif #using_root_directory > 0 then + base = in_directory:sub(#using_root_directory + 2) .. utils.path_separator + else + base = in_directory .. utils.path_separator + end + else + base = vim.fn.fnamemodify(in_directory .. utils.path_separator, ":~") + using_root_directory = false + end + + local dir_ending = '"/"' + if utils.path_separator ~= '/' then + dir_ending = dir_ending .. string.format(' or "%s"', utils.path_separator) + end + local msg = 'Enter name for new file or directory (dirs end with a ' .. dir_ending .. '):' + inputs.input( + msg, + base, + function(destinations) + if not destinations then + return + end + + for _, destination in ipairs(utils.brace_expand(destinations)) do + if not destination or destination == base then + return + end + local is_dir = vim.endswith(destination, "/") or vim.endswith(destination, utils.path_separator) + + if using_root_directory then + destination = utils.path_join(using_root_directory, destination) + else + destination = vim.fn.fnamemodify(destination, ":p") + end + + if utils.is_windows then destination = utils.windowize_path(destination) end + if loop.fs_stat(destination) then + log.warn("File already exists") + return + end + + create_all_parents(destination) + if is_dir then + loop.fs_mkdir(destination, 493) + else + local open_mode = loop.constants.O_CREAT + + loop.constants.O_WRONLY + + loop.constants.O_TRUNC + local fd = loop.fs_open(destination, open_mode, 420) + if not fd then + if not loop.fs_stat(destination) then + api.nvim_err_writeln("Could not create file " .. destination) + return + else + log.warn("Failed to complete file creation of " .. destination) + end + else + loop.fs_close(fd) + end + end + + vim.schedule(function() + events.fire_event(events.FILE_ADDED, destination) + if callback then + callback(destination) + end + end) + end + end + ) +end + +-- Delete Node +M.delete_node = function(path, callback, noconfirm) + local _, name = utils.split_path(path) + local msg = string.format("Are you sure you want to delete '%s'?", name) + + log.trace("Deleting node: ", path) + local _type = "unknown" + local stat = loop.fs_stat(path) + if stat then + _type = stat.type + if _type == "link" then + local link_to = loop.fs_readlink(path) + if not link_to then + log.error("Could not read link") + return + end + _type = loop.fs_stat(link_to) + end + if _type == "directory" then + local children = scan.scan_dir(path, { + hidden = true, + respect_gitignore = false, + add_dirs = true, + depth = 1, + }) + if #children > 0 then + msg = "WARNING: Dir not empty! " .. msg + end + end + else + log.warn("Could not read file/dir:", path, stat, ", attempting to delete anyway...") + -- Guess the type by whether it appears to have an extension + if path:match("%.(.+)$") then + _type = "file" + else + _type = "directory" + end + return + end + + local do_delete = function(confirmed) + if not confirmed then + return + end + + local function delete_dir(dir_path) + local handle = loop.fs_scandir(dir_path) + if type(handle) == "string" then + return api.nvim_err_writeln(handle) + end + + while true do + local child_name, t = loop.fs_scandir_next(handle) + if not child_name then + break + end + + local child_path = dir_path .. "/" .. child_name + if t == "directory" then + local success = delete_dir(child_path) + if not success then + log.error("failed to delete ", child_path) + return false + end + else + local success = loop.fs_unlink(child_path) + if not success then + return false + end + clear_buffer(child_path) + end + end + return loop.fs_rmdir(dir_path) + end + + if _type == "directory" then + -- first try using native system commands, which are recursive + local success = false + if utils.is_windows then + local result = vim.fn.system({ "cmd.exe", "/c", "rmdir", "/s", "/q", vim.fn.shellescape(path) }) + local error = vim.v.shell_error + if error ~= 0 then + log.debug("Could not delete directory '", path, "' with rmdir: ", result) + else + log.info("Deleted directory ", path) + success = true + end + else + local result = vim.fn.system({ "rm", "-Rf", path }) + local error = vim.v.shell_error + if error ~= 0 then + log.debug("Could not delete directory '", path, "' with rm: ", result) + else + log.info("Deleted directory ", path) + success = true + end + end + -- Fallback to using libuv if native commands fail + if not success then + success = delete_dir(path) + if not success then + return api.nvim_err_writeln("Could not remove directory: " .. path) + end + end + else + local success = loop.fs_unlink(path) + if not success then + return api.nvim_err_writeln("Could not remove file: " .. path) + end + clear_buffer(path) + end + + vim.schedule(function() + events.fire_event(events.FILE_DELETED, path) + if callback then + callback(path) + end + end) + end + + if noconfirm then + do_delete(true) + else + inputs.confirm(msg, do_delete) + end +end + +M.delete_nodes = function(paths_to_delete, callback) + local msg = "Are you sure you want to delete " .. #paths_to_delete .. " items?" + inputs.confirm(msg, function(confirmed) + if not confirmed then + return + end + + for _, path in ipairs(paths_to_delete) do + M.delete_node(path, nil, true) + end + + if callback then + vim.schedule(function() + callback(paths_to_delete[#paths_to_delete]) + end) + end + end) +end + +-- Rename Node +M.rename_node = function(path, callback) + local parent_path, name = utils.split_path(path) + local msg = string.format('Enter new name for "%s":', name) + + inputs.input(msg, name, function(new_name) + -- If cancelled + if not new_name or new_name == "" then + log.info("Operation canceled") + return + end + + local destination = parent_path .. utils.path_separator .. new_name + -- If aleady exists + if loop.fs_stat(destination) then + log.warn(destination, " already exists") + return + end + + local complete = vim.schedule_wrap(function() + rename_buffer(path, destination) + events.fire_event(events.FILE_RENAMED, { + source = path, + destination = destination, + }) + if callback then + callback(path, destination) + end + log.info("Renamed " .. new_name .. " successfully") + end) + + local function fs_rename() + loop.fs_rename(path, destination, function(err) + if err then + log.warn("Could not rename the files") + return + else + complete() + end + end) + end + + local event_result = events.fire_event(events.BEFORE_FILE_RENAME, { + source = path, + destination = destination, + callback = fs_rename, + }) or {} + if event_result.handled then + return + end + fs_rename() + end) +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/fs_scan.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/fs_scan.lua new file mode 100644 index 00000000..86dc4d35 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/fs_scan.lua @@ -0,0 +1,664 @@ +-- This files holds code for scanning the filesystem to build the tree. +local uv = vim.loop + +local renderer = require("neo-tree.ui.renderer") +local utils = require("neo-tree.utils") +local filter_external = require("neo-tree.sources.filesystem.lib.filter_external") +local file_items = require("neo-tree.sources.common.file-items") +local file_nesting = require("neo-tree.sources.common.file-nesting") +local log = require("neo-tree.log") +local fs_watch = require("neo-tree.sources.filesystem.lib.fs_watch") +local git = require("neo-tree.git") +local events = require("neo-tree.events") +local async = require("plenary.async") + +local M = {} + +local on_directory_loaded = function(context, dir_path) + local state = context.state + local scanned_folder = context.folders[dir_path] + if scanned_folder then + scanned_folder.loaded = true + end + if state.use_libuv_file_watcher then + local root = context.folders[dir_path] + if root then + local target_path = root.is_link and root.link_to or root.path + local fs_watch_callback = vim.schedule_wrap(function(err, fname) + if err then + log.error("file_event_callback: ", err) + return + end + if context.is_a_never_show_file(fname) then + -- don't fire events for nodes that are designated as "never show" + return + else + events.fire_event(events.FS_EVENT, { afile = target_path }) + end + end) + + log.trace("Adding fs watcher for ", target_path) + fs_watch.watch_folder(target_path, fs_watch_callback) + end + end +end + +local dir_complete = function(context, dir_path) + local paths_to_load = context.paths_to_load + local folders = context.folders + + on_directory_loaded(context, dir_path) + + -- check to see if there are more folders to load + local next_path = nil + while #paths_to_load > 0 and not next_path do + next_path = table.remove(paths_to_load) + -- ensure that the path is still valid + local success, result = pcall(vim.loop.fs_stat, next_path) + -- ensure that the result is a directory + if success and result and result.type == "directory" then + -- ensure that it is not already loaded + local existing = folders[next_path] + if existing and existing.loaded then + next_path = nil + end + else + -- if the path doesn't exist, skip it + next_path = nil + end + end + return next_path +end + +local render_context = function(context) + local state = context.state + local root = context.root + local parent_id = context.parent_id + + if not parent_id and state.use_libuv_file_watcher and state.enable_git_status then + log.trace("Starting .git folder watcher") + local path = root.path + if root.is_link then + path = root.link_to + end + fs_watch.watch_git_index(path, require("neo-tree").config.git_status_async) + end + fs_watch.updated_watched() + + if root and root.children then + file_items.advanced_sort(root.children, state) + end + if parent_id then + -- lazy loading a child folder + renderer.show_nodes(root.children, state, parent_id, context.callback) + else + -- full render of the tree + renderer.show_nodes({ root }, state, nil, context.callback) + end + + context.state = nil + context.callback = nil + context.all_items = nil + context.root = nil + context.parent_id = nil + context = nil +end + +local should_check_gitignore = function (context) + local state = context.state + if #context.all_items == 0 then + log.info("No items, skipping git ignored/status lookups") + return false + end + if state.search_pattern and state.check_gitignore_in_search == false then + return false + end + if state.filtered_items.hide_gitignored then + return true + end + if state.enable_git_status == false then + return false + end + return true +end + +local job_complete_async = function(context) + local state = context.state + local parent_id = context.parent_id + + file_nesting.nest_items(context) + + -- if state.search_pattern and #context.all_items > 50 then + -- -- don't do git ignored/status lookups when searching unless we are down to a reasonable number of items + -- return context + -- end + if should_check_gitignore(context) then + local mark_ignored_async = async.wrap(function (_state, _all_items, _callback) + git.mark_ignored(_state, _all_items, _callback) + end, 3) + local all_items = mark_ignored_async(state, context.all_items) + + if parent_id then + vim.list_extend(state.git_ignored, all_items) + else + state.git_ignored = all_items + end + end + return context +end + +local job_complete = function(context) + local state = context.state + local parent_id = context.parent_id + + file_nesting.nest_items(context) + + if should_check_gitignore(context) then + if require("neo-tree").config.git_status_async then + git.mark_ignored(state, context.all_items, function(all_items) + if parent_id then + vim.list_extend(state.git_ignored, all_items) + else + state.git_ignored = all_items + end + vim.schedule(function() + render_context(context) + end) + end) + return + else + local all_items = git.mark_ignored(state, context.all_items) + if parent_id then + vim.list_extend(state.git_ignored, all_items) + else + state.git_ignored = all_items + end + end + render_context(context) + else + render_context(context) + end +end + +local function create_node(context, node) + local success3, item = pcall(file_items.create_item, context, node.path, node.type) +end + +local function process_node(context, path) + on_directory_loaded(context, path) +end + +---@param err string libuv error +---@return boolean is_permission_error +local function is_permission_error(err) + -- Permission errors may be common when scanning over lots of folders; + -- this is used to check for them and log to `debug` instead of `error`. + return vim.startswith(err, "EPERM") or vim.startswith(err, "EACCES") +end + +local function get_children_sync(path) + local children = {} + local dir, err = uv.fs_opendir(path, nil, 1000) + if err then + if is_permission_error(err) then + log.debug(err) + else + log.error(err) + end + return children + end + local stats = uv.fs_readdir(dir) + if stats then + for _, stat in ipairs(stats) do + local child_path = utils.path_join(path, stat.name) + table.insert(children, { path = child_path, type = stat.type }) + end + end + uv.fs_closedir(dir) + return children +end + +local function get_children_async(path, callback) + local children = {} + uv.fs_opendir(path, function(err, dir) + if err then + if is_permission_error(err) then + log.debug(err) + else + log.error(err) + end + callback(children) + return + end + uv.fs_readdir(dir, function(_, stats) + if stats then + for _, stat in ipairs(stats) do + local child_path = utils.path_join(path, stat.name) + table.insert(children, { path = child_path, type = stat.type }) + end + end + uv.fs_closedir(dir) + callback(children) + end) + end, 1000) +end + +local function scan_dir_sync(context, path) + process_node(context, path) + local children = get_children_sync(path) + for _, child in ipairs(children) do + create_node(context, child) + if child.type == "directory" then + local grandchild_nodes = get_children_sync(child.path) + if + grandchild_nodes == nil + or #grandchild_nodes == 0 + or (#grandchild_nodes == 1 and grandchild_nodes[1].type == "directory") + or context.recursive + then + scan_dir_sync(context, child.path) + end + end + end +end + +--- async method +local function scan_dir_async(context, path) + log.debug("scan_dir_async - start " .. path) + + local get_children = async.wrap(function (_path, callback) + return get_children_async(_path, callback) + end, 2) + + local children = get_children(path) + for _, child in ipairs(children) do + create_node(context, child) + if child.type == "directory" then + local grandchild_nodes = get_children(child.path) + if + grandchild_nodes == nil + or #grandchild_nodes == 0 + or (#grandchild_nodes == 1 and grandchild_nodes[1].type == "directory") + or context.recursive + then + scan_dir_async(context, child.path) + end + end + end + + process_node(context, path) + log.debug("scan_dir_async - finish " .. path) + return path +end + + +-- async_scan scans all the directories in context.paths_to_load +-- and adds them as items to render in the UI. +local function async_scan(context, path) + log.trace("async_scan: ", path) + local scan_mode = require("neo-tree").config.filesystem.scan_mode + + if scan_mode == "deep" then + local scan_tasks = {} + for _, p in ipairs(context.paths_to_load) do + local scan_task = function () + scan_dir_async(context, p) + end + table.insert(scan_tasks, scan_task) + end + + async.util.run_all( + scan_tasks, + vim.schedule_wrap(function() + job_complete(context) + end) + ) + return + end + + -- scan_mode == "shallow" + context.directories_scanned = 0 + context.directories_to_scan = #context.paths_to_load + + context.on_exit = vim.schedule_wrap(function() + job_complete(context) + end) + + -- from https://github.com/nvim-lua/plenary.nvim/blob/master/lua/plenary/scandir.lua + local function read_dir(current_dir, ctx) + uv.fs_opendir(current_dir, function(err, dir) + if err then + log.error(current_dir, ": ", err) + return + end + local function on_fs_readdir(err, entries) + if err then + log.error(current_dir, ": ", err) + return + end + if entries then + for _, entry in ipairs(entries) do + local success, item = pcall( + file_items.create_item, + ctx, + utils.path_join(current_dir, entry.name), + entry.type + ) + if success then + if ctx.recursive and item.type == "directory" then + ctx.directories_to_scan = ctx.directories_to_scan + 1 + table.insert(ctx.paths_to_load, item.path) + end + else + log.error("error creating item for ", path) + end + end + + uv.fs_readdir(dir, on_fs_readdir) + return + end + uv.fs_closedir(dir) + on_directory_loaded(ctx, current_dir) + ctx.directories_scanned = ctx.directories_scanned + 1 + if ctx.directories_scanned == #ctx.paths_to_load then + ctx.on_exit() + end + + --local next_path = dir_complete(ctx, current_dir) + --if next_path then + -- local success, error = pcall(read_dir, next_path) + -- if not success then + -- log.error(next_path, ": ", error) + -- end + --else + -- on_exit() + --end + end + + uv.fs_readdir(dir, on_fs_readdir) + end) + end + + --local first = table.remove(context.paths_to_load) + --local success, err = pcall(read_dir, first) + --if not success then + -- log.error(first, ": ", err) + --end + for i = 1, context.directories_to_scan do + read_dir(context.paths_to_load[i], context) + end +end + +local function sync_scan(context, path_to_scan) + log.trace("sync_scan: ", path_to_scan) + local scan_mode = require("neo-tree").config.filesystem.scan_mode + if scan_mode == "deep" then + for _, path in ipairs(context.paths_to_load) do + scan_dir_sync(context, path) + -- scan_dir(context, path) + end + job_complete(context) + else -- scan_mode == "shallow" + local success, dir = pcall(vim.loop.fs_opendir, path_to_scan, nil, 1000) + if not success then + log.error("Error opening dir:", dir) + end + local success2, stats = pcall(vim.loop.fs_readdir, dir) + if success2 and stats then + for _, stat in ipairs(stats) do + local path = utils.path_join(path_to_scan, stat.name) + local success3, item = pcall(file_items.create_item, context, path, stat.type) + if success3 then + if context.recursive and stat.type == "directory" then + table.insert(context.paths_to_load, path) + end + else + log.error("error creating item for ", path) + end + end + end + vim.loop.fs_closedir(dir) + + local next_path = dir_complete(context, path_to_scan) + if next_path then + sync_scan(context, next_path) + else + job_complete(context) + end + end +end + +M.get_items_sync = function(state, parent_id, path_to_reveal, callback) + return M.get_items(state, parent_id, path_to_reveal, callback, false) +end + +M.get_items_async = function(state, parent_id, path_to_reveal, callback) + M.get_items(state, parent_id, path_to_reveal, callback, true) +end + +local handle_search_pattern = function (context) + local state = context.state + local root = context.root + local search_opts = { + filtered_items = state.filtered_items, + find_command = state.find_command, + limit = state.search_limit or 50, + path = root.path, + term = state.search_pattern, + find_args = state.find_args, + find_by_full_path_words = state.find_by_full_path_words, + fuzzy_finder_mode = state.fuzzy_finder_mode, + on_insert = function(err, path) + if err then + log.debug(err) + else + file_items.create_item(context, path) + end + end, + on_exit = vim.schedule_wrap(function() + job_complete(context) + end), + } + if state.use_fzy then + filter_external.fzy_sort_files(search_opts, state) + else + -- Use the external command because the plenary search is slow + filter_external.find_files(search_opts) + end +end + +local handle_refresh_or_up = function (context, async) + local parent_id = context.parent_id + local path_to_reveal = context.path_to_reveal + local state = context.state + local path = parent_id or state.path + context.paths_to_load = {} + if parent_id == nil then + if utils.truthy(state.force_open_folders) then + for _, f in ipairs(state.force_open_folders) do + table.insert(context.paths_to_load, f) + end + elseif state.tree then + context.paths_to_load = renderer.get_expanded_nodes(state.tree, state.path) + end + -- Ensure parents of all expanded nodes are also scanned + if #context.paths_to_load > 0 and state.tree then + local seen = {} + for _, p in ipairs(context.paths_to_load) do + local current = p + while current do + if seen[current] then + break + end + seen[current] = true + local current_node = state.tree:get_node(current) + current = current_node and current_node:get_parent_id() + end + end + context.paths_to_load = vim.tbl_keys(seen) + end + -- Ensure that there are no nested files in the list of folders to load + context.paths_to_load = vim.tbl_filter(function(p) + local stats = vim.loop.fs_stat(p) + return stats and stats.type == "directory" or false + end, context.paths_to_load) + if path_to_reveal then + -- be sure to load all of the folders leading up to the path to reveal + local path_to_reveal_parts = utils.split(path_to_reveal, utils.path_separator) + table.remove(path_to_reveal_parts) -- remove the file name + -- add all parent folders to the list of paths to load + utils.reduce(path_to_reveal_parts, "", function(acc, part) + local current_path = utils.path_join(acc, part) + if #current_path > #path then -- within current root + table.insert(context.paths_to_load, current_path) + table.insert(state.default_expanded_nodes, current_path) + end + return current_path + end) + context.paths_to_load = utils.unique(context.paths_to_load) + end + end + + local filtered_items = state.filtered_items or {} + context.is_a_never_show_file = function(fname) + if fname then + local _, name = utils.split_path(fname) + if name then + if filtered_items.never_show and filtered_items.never_show[name] then + return true + end + if utils.is_filtered_by_pattern(filtered_items.never_show_by_pattern, fname, name) then + return true + end + end + end + return false + end + table.insert(context.paths_to_load, path) + if async then + async_scan(context, path) + else + sync_scan(context, path) + end +end + +M.get_items = function(state, parent_id, path_to_reveal, callback, async, recursive) + renderer.acquire_window(state) + if state.async_directory_scan == "always" then + async = true + elseif state.async_directory_scan == "never" then + async = false + elseif type(async) == "nil" then + async = (state.async_directory_scan == "auto") or state.async_directory_scan + end + + if not parent_id then + M.stop_watchers(state) + end + local context = file_items.create_context() + context.state = state + context.parent_id = parent_id + context.path_to_reveal = path_to_reveal + context.recursive = recursive + context.callback = callback + -- Create root folder + local root = file_items.create_item(context, parent_id or state.path, "directory") + root.name = vim.fn.fnamemodify(root.path, ":~") + root.loaded = true + root.search_pattern = state.search_pattern + context.root = root + context.folders[root.path] = root + state.default_expanded_nodes = state.force_open_folders or { state.path } + + if state.search_pattern then + handle_search_pattern(context) + else + -- In the case of a refresh or navigating up, we need to make sure that all + -- open folders are loaded. + handle_refresh_or_up(context, async) + end +end + +-- async method +M.get_dir_items_async = function(state, parent_id, recursive) + local context = file_items.create_context() + context.state = state + context.parent_id = parent_id + context.path_to_reveal = nil + context.recursive = recursive + context.callback = nil + context.paths_to_load = {} + + -- Create root folder + local root = file_items.create_item(context, parent_id or state.path, "directory") + root.name = vim.fn.fnamemodify(root.path, ":~") + root.loaded = true + root.search_pattern = state.search_pattern + context.root = root + context.folders[root.path] = root + state.default_expanded_nodes = state.force_open_folders or { state.path } + + local filtered_items = state.filtered_items or {} + context.is_a_never_show_file = function(fname) + if fname then + local _, name = utils.split_path(fname) + if name then + if filtered_items.never_show and filtered_items.never_show[name] then + return true + end + if utils.is_filtered_by_pattern(filtered_items.never_show_by_pattern, fname, name) then + return true + end + end + end + return false + end + table.insert(context.paths_to_load, parent_id) + + local scan_tasks = {} + for _, p in ipairs(context.paths_to_load) do + local scan_task = function () + scan_dir_async(context, p) + end + table.insert(scan_tasks, scan_task) + end + async.util.join(scan_tasks) + + job_complete_async(context) + + local finalize = async.wrap(function (_context, _callback) + vim.schedule(function () + render_context(_context) + _callback() + end) + end, 2) + finalize(context) +end + +M.stop_watchers = function(state) + if state.use_libuv_file_watcher and state.tree then + -- We are loaded a new root or refreshing, unwatch any folders that were + -- previously being watched. + local loaded_folders = renderer.select_nodes(state.tree, function(node) + return node.type == "directory" and node.loaded + end) + fs_watch.unwatch_git_index(state.path, require("neo-tree").config.git_status_async) + for _, folder in ipairs(loaded_folders) do + log.trace("Unwatching folder ", folder.path) + if folder.is_link then + fs_watch.unwatch_folder(folder.link_to) + else + fs_watch.unwatch_folder(folder:get_id()) + end + end + else + log.debug( + "Not unwatching folders... use_libuv_file_watcher is ", + state.use_libuv_file_watcher, + " and state.tree is ", + utils.truthy(state.tree) + ) + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/fs_watch.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/fs_watch.lua new file mode 100644 index 00000000..23fdde38 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/fs_watch.lua @@ -0,0 +1,177 @@ +local vim = vim +local events = require("neo-tree.events") +local log = require("neo-tree.log") +local git = require("neo-tree.git") +local utils = require("neo-tree.utils") + +local M = {} + +local flags = { + watch_entry = false, + stat = false, + recursive = false, +} + +local watched = {} + +local get_dot_git_folder = function(path, callback) + if type(callback) == "function" then + git.get_repository_root(path, function(git_root) + if git_root then + local git_folder = utils.path_join(git_root, ".git") + local stat = vim.loop.fs_stat(git_folder) + if stat and stat.type == "directory" then + callback(git_folder, git_root) + end + else + callback(nil, nil) + end + end) + else + local git_root = git.get_repository_root(path) + if git_root then + local git_folder = utils.path_join(git_root, ".git") + local stat = vim.loop.fs_stat(git_folder) + if stat and stat.type == "directory" then + return git_folder, git_root + end + end + return nil, nil + end +end + +M.show_watched = function() + local items = {} + for _, handle in pairs(watched) do + items[handle.path] = handle.references + end + log.info("Watched Folders: ", vim.inspect(items)) +end + +---Watch a directory for changes to it's children. Not recursive. +---@param path string The directory to watch. +---@param custom_callback? function The callback to call when a change is detected. +---@param allow_git_watch? boolean Allow watching of git folders. +M.watch_folder = function(path, custom_callback, allow_git_watch) + if not allow_git_watch then + if path:find("/%.git$") or path:find("/%.git/") then + -- git folders seem to throw off fs events constantly. + log.debug("watch_folder(path): Skipping git folder: ", path) + return + end + end + local h = watched[path] + if h == nil then + log.trace("Starting new fs watch on: ", path) + local callback = custom_callback + or vim.schedule_wrap(function(err, fname) + if fname and fname:match("^%.null[-]ls_.+") then + -- null-ls temp file: https://github.com/jose-elias-alvarez/null-ls.nvim/pull/1075 + return + end + if err then + log.error("file_event_callback: ", err) + return + end + events.fire_event(events.FS_EVENT, { afile = path }) + end) + h = { + handle = vim.loop.new_fs_event(), + path = path, + references = 0, + active = false, + callback = callback, + } + watched[path] = h + --w:start(path, flags, callback) + else + log.trace("Incrementing references for fs watch on: ", path) + end + h.references = h.references + 1 +end + +M.watch_git_index = function(path, async) + local function watch_git_folder(git_folder, git_root) + if git_folder then + local git_event_callback = vim.schedule_wrap(function(err, fname) + if fname and fname:match("^.+%.lock$") then + return + end + if fname and fname:match("^%._null-ls_.+") then + -- null-ls temp file: https://github.com/jose-elias-alvarez/null-ls.nvim/pull/1075 + return + end + if err then + log.error("git_event_callback: ", err) + return + end + events.fire_event(events.GIT_EVENT, { path = fname, repository = git_root }) + end) + + M.watch_folder(git_folder, git_event_callback, true) + end + end + + if async then + get_dot_git_folder(path, watch_git_folder) + else + watch_git_folder(get_dot_git_folder(path)) + end +end + +M.updated_watched = function() + for path, w in pairs(watched) do + if w.references > 0 then + if not w.active then + log.trace("References added for fs watch on: ", path, ", starting.") + w.handle:start(path, flags, w.callback) + w.active = true + end + else + if w.active then + log.trace("No more references for fs watch on: ", path, ", stopping.") + w.handle:stop() + w.active = false + end + end + end +end + +---Stop watching a directory. If there are no more references to the handle, +---it will be destroyed. Otherwise, the reference count will be decremented. +---@param path string The directory to stop watching. +M.unwatch_folder = function(path, callback_id) + local h = watched[path] + if h then + log.trace("Decrementing references for fs watch on: ", path, callback_id) + h.references = h.references - 1 + else + log.trace("(unwatch_folder) No fs watch found for: ", path) + end +end + +M.unwatch_git_index = function(path, async) + local function unwatch_git_folder(git_folder, _) + if git_folder then + M.unwatch_folder(git_folder) + end + end + + if async then + get_dot_git_folder(path, unwatch_git_folder) + else + unwatch_git_folder(get_dot_git_folder(path)) + end +end + +---Stop watching all directories. This is the nuclear option and it affects all +---sources. +M.unwatch_all = function() + for _, h in pairs(watched) do + h.handle:stop() + h.handle = nil + end + watched = {} +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/globtopattern.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/globtopattern.lua new file mode 100644 index 00000000..8f94985d --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/globtopattern.lua @@ -0,0 +1,157 @@ +--(c) 2008-2011 David Manura. Licensed under the same terms as Lua (MIT). + +--Permission is hereby granted, free of charge, to any person obtaining a copy +--of this software and associated documentation files (the "Software"), to deal +--in the Software without restriction, including without limitation the rights +--to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +--copies of the Software, and to permit persons to whom the Software is +--furnished to do so, subject to the following conditions: + +--The above copyright notice and this permission notice shall be included in +--all copies or substantial portions of the Software. + +--THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +--IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +--FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +--AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +--LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +--OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +--THE SOFTWARE. +--(end license) + +local M = { _TYPE = "module", _NAME = "globtopattern", _VERSION = "0.2.1.20120406" } + +function M.globtopattern(g) + -- Some useful references: + -- - apr_fnmatch in Apache APR. For example, + -- http://apr.apache.org/docs/apr/1.3/group__apr__fnmatch.html + -- which cites POSIX 1003.2-1992, section B.6. + + local p = "^" -- pattern being built + local i = 0 -- index in g + local c -- char at index i in g. + + -- unescape glob char + local function unescape() + if c == "\\" then + i = i + 1 + c = g:sub(i, i) + if c == "" then + p = "[^]" + return false + end + end + return true + end + + -- escape pattern char + local function escape(c) + return c:match("^%w$") and c or "%" .. c + end + + -- Convert tokens at end of charset. + local function charset_end() + while 1 do + if c == "" then + p = "[^]" + return false + elseif c == "]" then + p = p .. "]" + break + else + if not unescape() then + break + end + local c1 = c + i = i + 1 + c = g:sub(i, i) + if c == "" then + p = "[^]" + return false + elseif c == "-" then + i = i + 1 + c = g:sub(i, i) + if c == "" then + p = "[^]" + return false + elseif c == "]" then + p = p .. escape(c1) .. "%-]" + break + else + if not unescape() then + break + end + p = p .. escape(c1) .. "-" .. escape(c) + end + elseif c == "]" then + p = p .. escape(c1) .. "]" + break + else + p = p .. escape(c1) + i = i - 1 -- put back + end + end + i = i + 1 + c = g:sub(i, i) + end + return true + end + + -- Convert tokens in charset. + local function charset() + i = i + 1 + c = g:sub(i, i) + if c == "" or c == "]" then + p = "[^]" + return false + elseif c == "^" or c == "!" then + i = i + 1 + c = g:sub(i, i) + if c == "]" then + -- ignored + else + p = p .. "[^" + if not charset_end() then + return false + end + end + else + p = p .. "[" + if not charset_end() then + return false + end + end + return true + end + + -- Convert tokens. + while 1 do + i = i + 1 + c = g:sub(i, i) + if c == "" then + p = p .. "$" + break + elseif c == "?" then + p = p .. "." + elseif c == "*" then + p = p .. ".*" + elseif c == "[" then + if not charset() then + break + end + elseif c == "\\" then + i = i + 1 + c = g:sub(i, i) + if c == "" then + p = p .. "\\$" + break + end + p = p .. escape(c) + else + p = p .. escape(c) + end + end + return p +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/git_status/commands.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/git_status/commands.lua new file mode 100644 index 00000000..7b4594c8 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/git_status/commands.lua @@ -0,0 +1,71 @@ +--This file should contain all commands meant to be used by mappings. + +local vim = vim +local cc = require("neo-tree.sources.common.commands") +local utils = require("neo-tree.utils") +local manager = require("neo-tree.sources.manager") + +local M = {} + +local refresh = utils.wrap(manager.refresh, "git_status") +local redraw = utils.wrap(manager.redraw, "git_status") + +-- ---------------------------------------------------------------------------- +-- Common commands +-- ---------------------------------------------------------------------------- +M.add = function(state) + cc.add(state, refresh) +end + +M.add_directory = function(state) + cc.add_directory(state, refresh) +end + +---Marks node as copied, so that it can be pasted somewhere else. +M.copy_to_clipboard = function(state) + cc.copy_to_clipboard(state, redraw) +end + +M.copy_to_clipboard_visual = function(state, selected_nodes) + cc.copy_to_clipboard_visual(state, selected_nodes, redraw) +end + +---Marks node as cut, so that it can be pasted (moved) somewhere else. +M.cut_to_clipboard = function(state) + cc.cut_to_clipboard(state, redraw) +end + +M.cut_to_clipboard_visual = function(state, selected_nodes) + cc.cut_to_clipboard_visual(state, selected_nodes, redraw) +end + +M.copy = function(state) + cc.copy(state, redraw) +end + +M.move = function(state) + cc.move(state, redraw) +end + +---Pastes all items from the clipboard to the current directory. +M.paste_from_clipboard = function(state) + cc.paste_from_clipboard(state, refresh) +end + +M.delete = function(state) + cc.delete(state, refresh) +end + +M.delete_visual = function(state, selected_nodes) + cc.delete_visual(state, selected_nodes, refresh) +end + +M.refresh = refresh + +M.rename = function(state) + cc.rename(state, refresh) +end + +cc._add_common_commands(M) + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/git_status/components.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/git_status/components.lua new file mode 100644 index 00000000..7d1c1f72 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/git_status/components.lua @@ -0,0 +1,44 @@ +-- This file contains the built-in components. Each componment is a function +-- that takes the following arguments: +-- config: A table containing the configuration provided by the user +-- when declaring this component in their renderer config. +-- node: A NuiNode object for the currently focused node. +-- state: The current state of the source providing the items. +-- +-- The function should return either a table, or a list of tables, each of which +-- contains the following keys: +-- text: The text to display for this item. +-- highlight: The highlight group to apply to this text. + +local highlights = require("neo-tree.ui.highlights") +local common = require("neo-tree.sources.common.components") + +local M = {} + +M.name = function(config, node, state) + local highlight = config.highlight or highlights.FILE_NAME_OPENED + local name = node.name + if node.type == "directory" then + if node:get_depth() == 1 then + highlight = highlights.ROOT_NAME + if node:has_children() then + name = "GIT STATUS for " .. name + else + name = "GIT STATUS (working tree clean) for " .. name + end + else + highlight = highlights.DIRECTORY_NAME + end + elseif config.use_git_status_colors then + local git_status = state.components.git_status({}, node, state) + if git_status and git_status.highlight then + highlight = git_status.highlight + end + end + return { + text = name, + highlight = highlight, + } +end + +return vim.tbl_deep_extend("force", common, M) diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/git_status/init.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/git_status/init.lua new file mode 100644 index 00000000..8cd9dc90 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/git_status/init.lua @@ -0,0 +1,104 @@ +--This file should have all functions that are in the public api and either set +--or read the state of this source. + +local vim = vim +local utils = require("neo-tree.utils") +local renderer = require("neo-tree.ui.renderer") +local items = require("neo-tree.sources.git_status.lib.items") +local events = require("neo-tree.events") +local manager = require("neo-tree.sources.manager") + +local M = { + name = "git_status", + display_name = " 󰊢 Git " +} + +local wrap = function(func) + return utils.wrap(func, M.name) +end + +local get_state = function() + return manager.get_state(M.name) +end + +---Navigate to the given path. +---@param path string Path to navigate to. If empty, will navigate to the cwd. +M.navigate = function(state, path, path_to_reveal, callback, async) + state.dirty = false + if path_to_reveal then + renderer.position.set(state, path_to_reveal) + end + items.get_git_status(state) + + if type(callback) == "function" then + vim.schedule(callback) + end +end + +M.refresh = function() + manager.refresh(M.name) +end + +---Configures the plugin, should be called before the plugin is used. +---@param config table Configuration table containing any keys that the user +--wants to change from the defaults. May be empty to accept default values. +M.setup = function(config, global_config) + if config.before_render then + --convert to new event system + manager.subscribe(M.name, { + event = events.BEFORE_RENDER, + handler = function(state) + local this_state = get_state() + if state == this_state then + config.before_render(this_state) + end + end, + }) + end + + if global_config.enable_refresh_on_write then + manager.subscribe(M.name, { + event = events.VIM_BUFFER_CHANGED, + handler = function(args) + if utils.is_real_file(args.afile) then + M.refresh() + end + end, + }) + end + + if config.bind_to_cwd then + manager.subscribe(M.name, { + event = events.VIM_DIR_CHANGED, + handler = M.refresh, + }) + end + + if global_config.enable_diagnostics then + manager.subscribe(M.name, { + event = events.STATE_CREATED, + handler = function(state) + state.diagnostics_lookup = utils.get_diagnostic_counts() + end, + }) + manager.subscribe(M.name, { + event = events.VIM_DIAGNOSTIC_CHANGED, + handler = wrap(manager.diagnostics_changed), + }) + end + + --Configure event handlers for modified files + if global_config.enable_modified_markers then + manager.subscribe(M.name, { + event = events.VIM_BUFFER_MODIFIED_SET, + handler = wrap(manager.opened_buffers_changed), + }) + end + + manager.subscribe(M.name, { + event = events.GIT_EVENT, + handler = M.refresh, + }) +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/git_status/lib/items.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/git_status/lib/items.lua new file mode 100644 index 00000000..38d5ba87 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/git_status/lib/items.lua @@ -0,0 +1,49 @@ +local vim = vim +local renderer = require("neo-tree.ui.renderer") +local file_items = require("neo-tree.sources.common.file-items") +local log = require("neo-tree.log") +local git = require("neo-tree.git") + +local M = {} + +---Get a table of all open buffers, along with all parent paths of those buffers. +---The paths are the keys of the table, and all the values are 'true'. +M.get_git_status = function(state) + if state.loading then + return + end + state.loading = true + local status_lookup, project_root = git.status(state.git_base, true) + state.path = project_root or state.path or vim.fn.getcwd() + local context = file_items.create_context() + context.state = state + -- Create root folder + local root = file_items.create_item(context, state.path, "directory") + root.name = vim.fn.fnamemodify(root.path, ":~") + root.loaded = true + root.search_pattern = state.search_pattern + context.folders[root.path] = root + + for path, status in pairs(status_lookup) do + local success, item = pcall(file_items.create_item, context, path, "file") + item.status = status + if success then + item.extra = { + git_status = status, + } + else + log.error("Error creating item for " .. path .. ": " .. item) + end + end + + state.git_status_lookup = status_lookup + state.default_expanded_nodes = {} + for id, _ in pairs(context.folders) do + table.insert(state.default_expanded_nodes, id) + end + file_items.advanced_sort(root.children, state) + renderer.show_nodes({ root }, state) + state.loading = false +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/manager.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/manager.lua new file mode 100644 index 00000000..31a06760 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/sources/manager.lua @@ -0,0 +1,652 @@ +--This file should have all functions that are in the public api and either set +--or read the state of this source. + +local vim = vim +local utils = require("neo-tree.utils") +local fs_scan = require("neo-tree.sources.filesystem.lib.fs_scan") +local renderer = require("neo-tree.ui.renderer") +local inputs = require("neo-tree.ui.inputs") +local events = require("neo-tree.events") +local log = require("neo-tree.log") +local fs_watch = require("neo-tree.sources.filesystem.lib.fs_watch") + +local M = {} +local source_data = {} +local all_states = {} +local default_configs = {} + +local get_source_data = function(source_name) + if source_name == nil then + error("get_source_data: source_name cannot be nil") + end + local sd = source_data[source_name] + if sd then + return sd + end + sd = { + name = source_name, + state_by_tab = {}, + state_by_win = {}, + subscriptions = {}, + } + source_data[source_name] = sd + return sd +end + +local function create_state(tabid, sd, winid) + local default_config = default_configs[sd.name] + local state = vim.deepcopy(default_config, { noref = 1 }) + state.tabid = tabid + state.id = winid or tabid + state.dirty = true + state.position = {} + state.git_base = "HEAD" + events.fire_event(events.STATE_CREATED, state) + table.insert(all_states, state) + return state +end + +M._get_all_states = function() + return all_states +end + +M._for_each_state = function(source_name, action) + for _, state in ipairs(all_states) do + if source_name == nil or state.name == source_name then + action(state) + end + end +end + +---For use in tests only, completely resets the state of all sources. +---This closes all windows as well since they would be broken by this action. +M._clear_state = function() + fs_watch.unwatch_all() + renderer.close_all_floating_windows() + for _, data in pairs(source_data) do + for _, state in pairs(data.state_by_tab) do + renderer.close(state) + end + for _, state in pairs(data.state_by_win) do + renderer.close(state) + end + end + source_data = {} +end + +M.set_default_config = function(source_name, config) + if source_name == nil then + error("set_default_config: source_name cannot be nil") + end + default_configs[source_name] = config + local sd = get_source_data(source_name) + for tabid, tab_config in pairs(sd.state_by_tab) do + sd.state_by_tab[tabid] = vim.tbl_deep_extend("force", tab_config, config) + end +end + +--TODO: we need to track state per window when working with netwrw style "current" +--position. How do we know which one to return when this is called? +M.get_state = function(source_name, tabid, winid) + if source_name == nil then + error("get_state: source_name cannot be nil") + end + tabid = tabid or vim.api.nvim_get_current_tabpage() + local sd = get_source_data(source_name) + if type(winid) == "number" then + local win_state = sd.state_by_win[winid] + if not win_state then + win_state = create_state(tabid, sd, winid) + sd.state_by_win[winid] = win_state + end + return win_state + else + local tab_state = sd.state_by_tab[tabid] + if tab_state and tab_state.winid then + -- just in case tab and window get tangled up, tab state replaces window + sd.state_by_win[tab_state.winid] = nil + end + if not tab_state then + tab_state = create_state(tabid, sd) + sd.state_by_tab[tabid] = tab_state + end + return tab_state + end +end + +---Returns the state for the current buffer, assuming it is a neo-tree buffer. +---@param winid number|nil The window id to use, if nil, the current window is used. +---@return table|nil The state for the current buffer, or nil if it is not a +---neo-tree buffer. +M.get_state_for_window = function(winid) + local winid = winid or vim.api.nvim_get_current_win() + local bufnr = vim.api.nvim_win_get_buf(winid) + local source_status, source_name = pcall(vim.api.nvim_buf_get_var, bufnr, "neo_tree_source") + local position_status, position = pcall(vim.api.nvim_buf_get_var, bufnr, "neo_tree_position") + if not source_status or not position_status then + return nil + end + + local tabid = vim.api.nvim_get_current_tabpage() + if position == "current" then + return M.get_state(source_name, tabid, winid) + else + return M.get_state(source_name, tabid, nil) + end +end + +M.get_path_to_reveal = function(include_terminals) + local win_id = vim.api.nvim_get_current_win() + local cfg = vim.api.nvim_win_get_config(win_id) + if cfg.relative > "" or cfg.external then + -- floating window, ignore + return nil + end + if vim.bo.filetype == "neo-tree" then + return nil + end + local path = vim.fn.expand("%:p") + if not utils.truthy(path) then + return nil + end + if not include_terminals and path:match("term://") then + return nil + end + return path +end + +M.subscribe = function(source_name, event) + if source_name == nil then + error("subscribe: source_name cannot be nil") + end + local sd = get_source_data(source_name) + if not sd.subscriptions then + sd.subscriptions = {} + end + if not utils.truthy(event.id) then + event.id = sd.name .. "." .. event.event + end + log.trace("subscribing to event: " .. event.id) + sd.subscriptions[event] = true + events.subscribe(event) +end + +M.unsubscribe = function(source_name, event) + if source_name == nil then + error("unsubscribe: source_name cannot be nil") + end + local sd = get_source_data(source_name) + log.trace("unsubscribing to event: " .. event.id or event.event) + if sd.subscriptions then + for sub, _ in pairs(sd.subscriptions) do + if sub.event == event.event and sub.id == event.id then + sd.subscriptions[sub] = false + events.unsubscribe(sub) + end + end + end + events.unsubscribe(event) +end + +M.unsubscribe_all = function(source_name) + if source_name == nil then + error("unsubscribe_all: source_name cannot be nil") + end + local sd = get_source_data(source_name) + if sd.subscriptions then + for event, subscribed in pairs(sd.subscriptions) do + if subscribed then + events.unsubscribe(event) + end + end + end + sd.subscriptions = {} +end + +M.close = function(source_name, at_position) + local state = M.get_state(source_name) + if at_position then + if state.current_position == at_position then + return renderer.close(state) + else + return false + end + else + return renderer.close(state) + end +end + +M.close_all = function(at_position) + local tabid = vim.api.nvim_get_current_tabpage() + for source_name, _ in pairs(source_data) do + M._for_each_state(source_name, function(state) + if state.tabid == tabid then + if at_position then + if state.current_position == at_position then + log.trace("Closing " .. source_name .. " at position " .. at_position) + pcall(renderer.close, state) + end + else + log.trace("Closing " .. source_name) + pcall(renderer.close, state) + end + end + end) + end +end + +M.close_all_except = function(except_source_name) + local tabid = vim.api.nvim_get_current_tabpage() + for source_name, _ in pairs(source_data) do + M._for_each_state(source_name, function(state) + if state.tabid == tabid and source_name ~= except_source_name then + log.trace("Closing " .. source_name) + pcall(renderer.close, state) + end + end) + end +end + +---Redraws the tree with updated diagnostics without scanning the filesystem again. +M.diagnostics_changed = function(source_name, args) + if not type(args) == "table" then + error("diagnostics_changed: args must be a table") + end + M._for_each_state(source_name, function(state) + state.diagnostics_lookup = args.diagnostics_lookup + renderer.redraw(state) + end) +end + +---Called by autocmds when the cwd dir is changed. This will change the root. +M.dir_changed = function(source_name) + M._for_each_state(source_name, function(state) + local cwd = M.get_cwd(state) + if state.path and cwd == state.path then + return + end + if renderer.window_exists(state) then + M.navigate(state, cwd) + else + state.path = nil + state.dirty = true + end + end) +end +-- +---Redraws the tree with updated git_status without scanning the filesystem again. +M.git_status_changed = function(source_name, args) + if not type(args) == "table" then + error("git_status_changed: args must be a table") + end + M._for_each_state(source_name, function(state) + if utils.is_subpath(args.git_root, state.path) then + state.git_status_lookup = args.git_status + renderer.redraw(state) + end + end) +end + +-- Vimscript functions like vim.fn.getcwd take tabpage number (tab position counting from left) +-- but API functions operate on tabpage id (as returned by nvim_tabpage_get_number). These values +-- get out of sync when tabs are being moved and we want to track state according to tabpage id. +local to_tabnr = function(tabid) + return tabid > 0 and vim.api.nvim_tabpage_get_number(tabid) or tabid +end + +local get_params_for_cwd = function(state) + local tabid = state.tabid + -- the id is either the tabid for sidebars or the winid for splits + local winid = state.id == tabid and -1 or state.id + + if state.cwd_target then + local target = state.cwd_target.sidebar + if state.current_position == "current" then + target = state.cwd_target.current + end + if target == "window" then + return winid, to_tabnr(tabid) + elseif target == "global" then + return -1, -1 + elseif target == "none" then + return nil, nil + else -- default to tab + return -1, to_tabnr(tabid) + end + else + return winid, to_tabnr(tabid) + end +end + +M.get_cwd = function(state) + local winid, tabnr = get_params_for_cwd(state) + local success, cwd = false, "" + if winid or tabnr then + success, cwd = pcall(vim.fn.getcwd, winid, tabnr) + end + if success then + return cwd + else + success, cwd = pcall(vim.fn.getcwd) + if success then + return cwd + else + return state.path + end + end +end + +M.set_cwd = function(state) + if not state.path then + return + end + + local winid, tabnr = get_params_for_cwd(state) + + if winid == nil and tabnr == nil then + return + end + + local _, cwd = pcall(vim.fn.getcwd, winid, tabnr) + if state.path ~= cwd then + local path = utils.escape_path_for_cmd(state.path) + if winid > 0 then + vim.cmd("lcd " .. path) + elseif tabnr > 0 then + vim.cmd("tcd " .. path) + else + vim.cmd("cd " .. path) + end + end +end + +local dispose_state = function(state) + pcall(fs_scan.stop_watchers, state) + pcall(renderer.close, state) + source_data[state.name].state_by_tab[state.id] = nil + source_data[state.name].state_by_win[state.id] = nil + state.disposed = true +end + +M.dispose = function(source_name, tabid) + -- Iterate in reverse because we are removing items during loop + for i = #all_states, 1, -1 do + local state = all_states[i] + if source_name == nil or state.name == source_name then + if not tabid or tabid == state.tabid then + log.trace(state.name, " disposing of tab: ", tabid) + dispose_state(state) + table.remove(all_states, i) + end + end + end +end + +M.dispose_tab = function(tabid) + if not tabid then + error("dispose_tab: tabid cannot be nil") + end + -- Iterate in reverse because we are removing items during loop + for i = #all_states, 1, -1 do + local state = all_states[i] + if tabid == state.tabid then + log.trace(state.name, " disposing of tab: ", tabid, state.name) + dispose_state(state) + table.remove(all_states, i) + end + end +end + +M.dispose_invalid_tabs = function() + -- Iterate in reverse because we are removing items during loop + for i = #all_states, 1, -1 do + local state = all_states[i] + -- if not valid_tabs[state.tabid] then + if not vim.api.nvim_tabpage_is_valid(state.tabid) then + log.trace(state.name, " disposing of tab: ", state.tabid, state.name) + dispose_state(state) + table.remove(all_states, i) + end + end +end + +M.dispose_window = function(winid) + if not winid then + error("dispose_window: winid cannot be nil") + end + -- Iterate in reverse because we are removing items during loop + for i = #all_states, 1, -1 do + local state = all_states[i] + if state.id == winid then + log.trace(state.name, " disposing of window: ", winid, state.name) + dispose_state(state) + table.remove(all_states, i) + end + end +end + +M.float = function(source_name) + local state = M.get_state(source_name) + state.current_position = "float" + local path_to_reveal = M.get_path_to_reveal() + M.navigate(source_name, state.path, path_to_reveal) +end + +---Focus the window, opening it if it is not already open. +---@param source_name string Source name. +---@param path_to_reveal string|nil Node to focus after the items are loaded. +---@param callback function|nil Callback to call after the items are loaded. +M.focus = function(source_name, path_to_reveal, callback) + local state = M.get_state(source_name) + state.current_position = nil + if path_to_reveal then + M.navigate(source_name, state.path, path_to_reveal, callback) + else + if not state.dirty and renderer.window_exists(state) then + vim.api.nvim_set_current_win(state.winid) + else + M.navigate(source_name, state.path, nil, callback) + end + end +end + +---Redraws the tree with updated modified markers without scanning the filesystem again. +M.opened_buffers_changed = function(source_name, args) + if not type(args) == "table" then + error("opened_buffers_changed: args must be a table") + end + if type(args.opened_buffers) == "table" then + M._for_each_state(source_name, function(state) + if utils.tbl_equals(args.opened_buffers, state.opened_buffers) then + -- no changes, no need to redraw + return + end + state.opened_buffers = args.opened_buffers + renderer.redraw(state) + end) + end +end + +---Navigate to the given path. +---@param state_or_source_name string|table The state or source name to navigate. +---@param path string? Path to navigate to. If empty, will navigate to the cwd. +---@param path_to_reveal string? Node to focus after the items are loaded. +---@param callback function? Callback to call after the items are loaded. +---@param async boolean? Whether to load the items asynchronously, may not be respected by all sources. +M.navigate = function(state_or_source_name, path, path_to_reveal, callback, async) + require("neo-tree").ensure_config() + local state, source_name + if type(state_or_source_name) == "string" then + state = M.get_state(state_or_source_name) + source_name = state_or_source_name + elseif type(state_or_source_name) == "table" then + state = state_or_source_name + source_name = state.name + else + log.error("navigate: state_or_source_name must be a string or a table") + end + log.trace("navigate", source_name, path, path_to_reveal) + local mod = get_source_data(source_name).module + if not mod then + mod = require("neo-tree.sources." .. source_name) + end + mod.navigate(state, path, path_to_reveal, callback, async) +end + +---Redraws the tree without scanning the filesystem again. Use this after +-- making changes to the nodes that would affect how their components are +-- rendered. +M.redraw = function(source_name) + M._for_each_state(source_name, function(state) + renderer.redraw(state) + end) +end + +---Refreshes the tree by scanning the filesystem again. +M.refresh = function(source_name, callback) + if type(callback) ~= "function" then + callback = nil + end + local current_tabid = vim.api.nvim_get_current_tabpage() + log.trace(source_name, "refresh") + for i = 1, #all_states, 1 do + local state = all_states[i] + if state.tabid == current_tabid and state.path and renderer.window_exists(state) then + local success, err = pcall(M.navigate, state, state.path, nil, callback) + if not success then + log.error(err) + end + else + state.dirty = true + end + end +end + +--- DEPRECATED: To be removed in 4.0 +--- use `require("neo-tree.command").execute({ source_name = source_name, action = "focus", reveal = true })` instead +M.reveal_current_file = function(source_name, callback, force_cwd) + log.warn([[DEPRECATED: use `require("neo-tree.command").execute({ source_name = source_name, action = "focus", reveal = true })` instead]]) + + log.trace("Revealing current file") + local state = M.get_state(source_name) + state.current_position = nil + + local path = M.get_path_to_reveal() + if not path then + M.focus(source_name) + return + end + local cwd = state.path + if cwd == nil then + cwd = M.get_cwd(state) + end + if force_cwd then + if not utils.is_subpath(cwd, path) then + state.path, _ = utils.split_path(path) + end + elseif not utils.is_subpath(cwd, path) then + cwd, _ = utils.split_path(path) + inputs.confirm("File not in cwd. Change cwd to " .. cwd .. "?", function(response) + if response == true then + state.path = cwd + M.focus(source_name, path, callback) + else + M.focus(source_name, nil, callback) + end + end) + return + end + if path then + if not renderer.focus_node(state, path) then + M.focus(source_name, path, callback) + end + end +end + +--- DEPRECATED: To be removed in 4.0 +--- use `require("neo-tree.command").execute({ source_name = source_name, action = "focus", reveal = true, position = "current" })` instead +M.reveal_in_split = function(source_name, callback) + log.warn([[DEPRECATED: use `require("neo-tree.command").execute({ source_name = source_name, action = "focus", reveal = true, position = "current" })` instead]]) + + local state = M.get_state(source_name, nil, vim.api.nvim_get_current_win()) + state.current_position = "current" + local path_to_reveal = M.get_path_to_reveal() + if not path_to_reveal then + M.navigate(state, nil, nil, callback) + return + end + local cwd = state.path + if cwd == nil then + cwd = M.get_cwd(state) + end + if cwd and not utils.is_subpath(cwd, path_to_reveal) then + state.path, _ = utils.split_path(path_to_reveal) + end + M.navigate(state, state.path, path_to_reveal, callback) +end + +---Opens the tree and displays the current path or cwd, without focusing it. +M.show = function(source_name) + local state = M.get_state(source_name) + state.current_position = nil + if not renderer.window_exists(state) then + local current_win = vim.api.nvim_get_current_win() + M.navigate(source_name, state.path, nil, function() + vim.api.nvim_set_current_win(current_win) + end) + end +end + +M.show_in_split = function(source_name, callback) + local state = M.get_state(source_name, nil, vim.api.nvim_get_current_win()) + state.current_position = "current" + M.navigate(state, state.path, nil, callback) +end + +M.validate_source = function(source_name, module) + if source_name == nil then + error("register_source: source_name cannot be nil") + end + if module == nil then + error("register_source: module cannot be nil") + end + if type(module) ~= "table" then + error("register_source: module must be a table") + end + local required_functions = { + "navigate", + "setup", + } + for _, name in ipairs(required_functions) do + if type(module[name]) ~= "function" then + error("Source " .. source_name .. " must have a " .. name .. " function") + end + end +end + +---Configures the plugin, should be called before the plugin is used. +---@param source_name string Name of the source. +---@param config table Configuration table containing merged configuration for the source. +---@param global_config table Global configuration table, shared between all sources. +---@param module table Module containing the source's code. +M.setup = function(source_name, config, global_config, module) + log.debug(source_name, " setup ", config) + M.unsubscribe_all(source_name) + M.set_default_config(source_name, config) + if module == nil then + module = require("neo-tree.sources." .. source_name) + end + local success, err = pcall(M.validate_source, source_name, module) + if success then + success, err = pcall(module.setup, config, global_config) + if success then + get_source_data(source_name).module = module + else + log.error("Source " .. source_name .. " setup failed: " .. err) + end + else + log.error("Source " .. source_name .. " is invalid: " .. err) + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/highlights.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/highlights.lua new file mode 100644 index 00000000..ee82680b --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/highlights.lua @@ -0,0 +1,292 @@ +local log = require("neo-tree.log") +local utils = require("neo-tree.utils") +local vim = vim +local M = {} + +---@type integer +M.ns_id = vim.api.nvim_create_namespace("neo-tree.nvim") + +M.BUFFER_NUMBER = "NeoTreeBufferNumber" +M.CURSOR_LINE = "NeoTreeCursorLine" +M.DIM_TEXT = "NeoTreeDimText" +M.DIRECTORY_ICON = "NeoTreeDirectoryIcon" +M.DIRECTORY_NAME = "NeoTreeDirectoryName" +M.DOTFILE = "NeoTreeDotfile" +M.FADE_TEXT_1 = "NeoTreeFadeText1" +M.FADE_TEXT_2 = "NeoTreeFadeText2" +M.FILE_ICON = "NeoTreeFileIcon" +M.FILE_NAME = "NeoTreeFileName" +M.FILE_NAME_OPENED = "NeoTreeFileNameOpened" +M.FILE_STATS = "NeoTreeFileStats" +M.FILE_STATS_HEADER = "NeoTreeFileStatsHeader" +M.FILTER_TERM = "NeoTreeFilterTerm" +M.FLOAT_BORDER = "NeoTreeFloatBorder" +M.FLOAT_NORMAL = "NeoTreeFloatNormal" +M.FLOAT_TITLE = "NeoTreeFloatTitle" +M.GIT_ADDED = "NeoTreeGitAdded" +M.GIT_CONFLICT = "NeoTreeGitConflict" +M.GIT_DELETED = "NeoTreeGitDeleted" +M.GIT_IGNORED = "NeoTreeGitIgnored" +M.GIT_MODIFIED = "NeoTreeGitModified" +M.GIT_RENAMED = "NeoTreeGitRenamed" +M.GIT_STAGED = "NeoTreeGitStaged" +M.GIT_UNTRACKED = "NeoTreeGitUntracked" +M.GIT_UNSTAGED = "NeoTreeGitUnstaged" +M.HIDDEN_BY_NAME = "NeoTreeHiddenByName" +M.INDENT_MARKER = "NeoTreeIndentMarker" +M.MESSAGE = "NeoTreeMessage" +M.MODIFIED = "NeoTreeModified" +M.NORMAL = "NeoTreeNormal" +M.NORMALNC = "NeoTreeNormalNC" +M.SIGNCOLUMN = "NeoTreeSignColumn" +M.STATUS_LINE = "NeoTreeStatusLine" +M.STATUS_LINE_NC = "NeoTreeStatusLineNC" +M.TAB_ACTIVE = "NeoTreeTabActive" +M.TAB_INACTIVE = "NeoTreeTabInactive" +M.TAB_SEPARATOR_ACTIVE = "NeoTreeTabSeparatorActive" +M.TAB_SEPARATOR_INACTIVE = "NeoTreeTabSeparatorInactive" +M.VERTSPLIT = "NeoTreeVertSplit" +M.WINSEPARATOR = "NeoTreeWinSeparator" +M.END_OF_BUFFER = "NeoTreeEndOfBuffer" +M.ROOT_NAME = "NeoTreeRootName" +M.SYMBOLIC_LINK_TARGET = "NeoTreeSymbolicLinkTarget" +M.TITLE_BAR = "NeoTreeTitleBar" +M.INDENT_MARKER = "NeoTreeIndentMarker" +M.EXPANDER = "NeoTreeExpander" +M.WINDOWS_HIDDEN = "NeoTreeWindowsHidden" +M.PREVIEW = "NeoTreePreview" + +local function dec_to_hex(n, chars) + chars = chars or 6 + local hex = string.format("%0" .. chars .. "x", n) + while #hex < chars do + hex = "0" .. hex + end + return hex +end + +---If the given highlight group is not defined, define it. +---@param hl_group_name string The name of the highlight group. +---@param link_to_if_exists table A list of highlight groups to link to, in +--order of priority. The first one that exists will be used. +---@param background string|nil The background color to use, in hex, if the highlight group +--is not defined and it is not linked to another group. +---@param foreground string|nil The foreground color to use, in hex, if the highlight group +--is not defined and it is not linked to another group. +---@gui string|nil The gui to use, if the highlight group is not defined and it is not linked +--to another group. +---@return table table The highlight group values. +M.create_highlight_group = function(hl_group_name, link_to_if_exists, background, foreground, gui) + local success, hl_group = pcall(vim.api.nvim_get_hl_by_name, hl_group_name, true) + if not success or not hl_group.foreground or not hl_group.background then + for _, link_to in ipairs(link_to_if_exists) do + success, hl_group = pcall(vim.api.nvim_get_hl_by_name, link_to, true) + if success then + local new_group_has_settings = background or foreground or gui + local link_to_has_settings = hl_group.foreground or hl_group.background + if link_to_has_settings or not new_group_has_settings then + vim.cmd("highlight default link " .. hl_group_name .. " " .. link_to) + return hl_group + end + end + end + + if type(background) == "number" then + background = dec_to_hex(background) + end + if type(foreground) == "number" then + foreground = dec_to_hex(foreground) + end + + local cmd = "highlight default " .. hl_group_name + if background then + cmd = cmd .. " guibg=#" .. background + end + if foreground then + cmd = cmd .. " guifg=#" .. foreground + else + cmd = cmd .. " guifg=NONE" + end + if gui then + cmd = cmd .. " gui=" .. gui + end + vim.cmd(cmd) + + return { + background = background and tonumber(background, 16) or nil, + foreground = foreground and tonumber(foreground, 16) or nil, + } + end + return hl_group +end + +local calculate_faded_highlight_group = function (hl_group_name, fade_percentage) + local normal = vim.api.nvim_get_hl_by_name("Normal", true) + if type(normal.foreground) ~= "number" then + if vim.api.nvim_get_option("background") == "dark" then + normal.foreground = 0xffffff + else + normal.foreground = 0x000000 + end + end + if type(normal.background) ~= "number" then + if vim.api.nvim_get_option("background") == "dark" then + normal.background = 0x000000 + else + normal.background = 0xffffff + end + end + local foreground = dec_to_hex(normal.foreground) + local background = dec_to_hex(normal.background) + + local hl_group = vim.api.nvim_get_hl_by_name(hl_group_name, true) + if type(hl_group.foreground) == "number" then + foreground = dec_to_hex(hl_group.foreground) + end + if type(hl_group.background) == "number" then + background = dec_to_hex(hl_group.background) + end + + local gui = {} + if hl_group.bold then + table.insert(gui, "bold") + end + if hl_group.italic then + table.insert(gui, "italic") + end + if hl_group.underline then + table.insert(gui, "underline") + end + if hl_group.undercurl then + table.insert(gui, "undercurl") + end + if #gui > 0 then + gui = table.concat(gui, ",") + else + gui = nil + end + + local f_red = tonumber(foreground:sub(1, 2), 16) + local f_green = tonumber(foreground:sub(3, 4), 16) + local f_blue = tonumber(foreground:sub(5, 6), 16) + + local b_red = tonumber(background:sub(1, 2), 16) + local b_green = tonumber(background:sub(3, 4), 16) + local b_blue = tonumber(background:sub(5, 6), 16) + + local red = (f_red * fade_percentage) + (b_red * (1 - fade_percentage)) + local green = (f_green * fade_percentage) + (b_green * (1 - fade_percentage)) + local blue = (f_blue * fade_percentage) + (b_blue * (1 - fade_percentage)) + + local new_foreground = + string.format("%s%s%s", dec_to_hex(red, 2), dec_to_hex(green, 2), dec_to_hex(blue, 2)) + + return { + background = hl_group.background, + foreground = new_foreground, + gui = gui, + } +end + +local faded_highlight_group_cache = {} +M.get_faded_highlight_group = function(hl_group_name, fade_percentage) + if type(hl_group_name) ~= "string" then + error("hl_group_name must be a string") + end + if type(fade_percentage) ~= "number" then + error("hl_group_name must be a number") + end + if fade_percentage < 0 or fade_percentage > 1 then + error("fade_percentage must be between 0 and 1") + end + + local key = hl_group_name .. "_" .. tostring(math.floor(fade_percentage * 100)) + if faded_highlight_group_cache[key] then + return faded_highlight_group_cache[key] + end + + local faded = calculate_faded_highlight_group(hl_group_name, fade_percentage) + + M.create_highlight_group(key, {}, faded.background, faded.foreground, faded.gui) + faded_highlight_group_cache[key] = key + return key +end + +M.setup = function() + -- Reset this here in case of color scheme change + faded_highlight_group_cache = {} + + local normal_hl = M.create_highlight_group(M.NORMAL, { "Normal" }) + local normalnc_hl = M.create_highlight_group(M.NORMALNC, { "NormalNC", M.NORMAL }) + + M.create_highlight_group(M.SIGNCOLUMN, { "SignColumn", M.NORMAL }) + + M.create_highlight_group(M.STATUS_LINE, { "StatusLine" }) + M.create_highlight_group(M.STATUS_LINE_NC, { "StatusLineNC" }) + + M.create_highlight_group(M.VERTSPLIT, { "VertSplit" }) + M.create_highlight_group(M.WINSEPARATOR, { "WinSeparator" }) + + M.create_highlight_group(M.END_OF_BUFFER, { "EndOfBuffer" }) + + local float_border_hl = + M.create_highlight_group(M.FLOAT_BORDER, { "FloatBorder" }, normalnc_hl.background, "444444") + + M.create_highlight_group(M.FLOAT_NORMAL, { "NormalFloat", M.NORMAL }) + + M.create_highlight_group(M.FLOAT_TITLE, {}, float_border_hl.background, normal_hl.foreground) + + local title_fg = normal_hl.background + if title_fg == float_border_hl.foreground then + title_fg = normal_hl.foreground + end + M.create_highlight_group(M.TITLE_BAR, {}, float_border_hl.foreground, title_fg) + + local dim_text = calculate_faded_highlight_group("NeoTreeNormal", 0.3) + + M.create_highlight_group(M.BUFFER_NUMBER, { "SpecialChar" }) + --M.create_highlight_group(M.DIM_TEXT, {}, nil, "505050") + M.create_highlight_group(M.MESSAGE, {}, nil, dim_text.foreground, "italic") + M.create_highlight_group(M.FADE_TEXT_1, {}, nil, "626262") + M.create_highlight_group(M.FADE_TEXT_2, {}, nil, "444444") + M.create_highlight_group(M.DOTFILE, {}, nil, "626262") + M.create_highlight_group(M.HIDDEN_BY_NAME, { M.DOTFILE }, nil, nil) + M.create_highlight_group(M.CURSOR_LINE, { "CursorLine" }, nil, nil, "bold") + M.create_highlight_group(M.DIM_TEXT, {}, nil, dim_text.foreground) + M.create_highlight_group(M.DIRECTORY_NAME, { "Directory" }, "NONE", "NONE") + M.create_highlight_group(M.DIRECTORY_ICON, { "Directory" }, nil, "73cef4") + M.create_highlight_group(M.FILE_ICON, { M.DIRECTORY_ICON }) + M.create_highlight_group(M.FILE_NAME, {}, "NONE", "NONE") + M.create_highlight_group(M.FILE_NAME_OPENED, {}, nil, nil, "bold") + M.create_highlight_group(M.SYMBOLIC_LINK_TARGET, { M.FILE_NAME }) + M.create_highlight_group(M.FILTER_TERM, { "SpecialChar", "Normal" }) + M.create_highlight_group(M.ROOT_NAME, {}, nil, nil, "bold,italic") + M.create_highlight_group(M.INDENT_MARKER, { M.DIM_TEXT }) + M.create_highlight_group(M.EXPANDER, { M.DIM_TEXT }) + M.create_highlight_group(M.MODIFIED, {}, nil, "d7d787") + M.create_highlight_group(M.WINDOWS_HIDDEN, { M.DOTFILE }, nil, nil) + M.create_highlight_group(M.PREVIEW, { "Search" }, nil, nil) + + M.create_highlight_group(M.GIT_ADDED, { "GitGutterAdd", "GitSignsAdd" }, nil, "5faf5f") + M.create_highlight_group(M.GIT_DELETED, { "GitGutterDelete", "GitSignsDelete" }, nil, "ff5900") + M.create_highlight_group(M.GIT_MODIFIED, { "GitGutterChange", "GitSignsChange" }, nil, "d7af5f") + local conflict = M.create_highlight_group(M.GIT_CONFLICT, {}, nil, "ff8700", "italic,bold") + M.create_highlight_group(M.GIT_IGNORED, { M.DOTFILE }, nil, nil) + M.create_highlight_group(M.GIT_RENAMED, { M.GIT_MODIFIED }, nil, nil) + M.create_highlight_group(M.GIT_STAGED, { M.GIT_ADDED }, nil, nil) + M.create_highlight_group(M.GIT_UNSTAGED, { M.GIT_CONFLICT }, nil, nil) + M.create_highlight_group(M.GIT_UNTRACKED, {}, nil, conflict.foreground, "italic") + + M.create_highlight_group(M.TAB_ACTIVE, {}, nil, nil, "bold") + M.create_highlight_group(M.TAB_INACTIVE, {}, "141414", "777777") + M.create_highlight_group(M.TAB_SEPARATOR_ACTIVE, {}, nil, "0a0a0a") + M.create_highlight_group(M.TAB_SEPARATOR_INACTIVE, {}, "141414", "101010") + + local faded_normal = calculate_faded_highlight_group("NeoTreeNormal", 0.4) + M.create_highlight_group(M.FILE_STATS, {}, nil, faded_normal.foreground) + + local faded_root = calculate_faded_highlight_group("NeoTreeRootName", 0.5) + M.create_highlight_group(M.FILE_STATS_HEADER, {}, nil, faded_root.foreground, faded_root.gui) +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/inputs.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/inputs.lua new file mode 100644 index 00000000..4b82036e --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/inputs.lua @@ -0,0 +1,99 @@ +local vim = vim +local Input = require("nui.input") +local popups = require("neo-tree.ui.popups") +local utils = require("neo-tree.utils") +local events = require("neo-tree.events") + +local M = {} + +local should_use_popup_input = function() + local nt = require("neo-tree") + return utils.get_value(nt.config, "use_popups_for_input", true, false) +end + +M.show_input = function(input, callback) + input:mount() + + input:map("i", "", function() + vim.cmd("stopinsert") + input:unmount() + end, { noremap = true }) + + input:map("n", "", function() + input:unmount() + end, { noremap = true }) + + input:map("n", "q", function() + input:unmount() + end, { noremap = true }) + + input:map("i", "", "", { noremap = true }) + + local event = require("nui.utils.autocmd").event + input:on({ event.BufLeave, event.BufDelete }, function() + input:unmount() + if callback then + callback() + end + end, { once = true }) + + if input.prompt_type ~= "confirm" then + vim.schedule(function() + events.fire_event(events.NEO_TREE_POPUP_INPUT_READY, { + bufnr = input.bufnr, + winid = input.winid, + }) + end) + end +end + +M.input = function(message, default_value, callback, options, completion) + if should_use_popup_input() then + local popup_options = popups.popup_options(message, 10, options) + + local input = Input(popup_options, { + prompt = " ", + default_value = default_value, + on_submit = callback, + }) + + M.show_input(input) + else + local opts = { + prompt = message .. "\n", + default = default_value, + } + if vim.opt.cmdheight:get() == 0 then + -- NOTE: I really don't know why but letters before the first '\n' is not rendered execpt in noice.nvim + -- when vim.opt.cmdheight = 0 <2023-10-24, pysan3> + opts.prompt = "Neo-tree Popup\n" .. opts.prompt + end + if completion then + opts.completion = completion + end + vim.ui.input(opts, callback) + end +end + +M.confirm = function(message, callback) + if should_use_popup_input() then + local popup_options = popups.popup_options(message, 10) + + local input = Input(popup_options, { + prompt = " y/n: ", + on_close = function() + callback(false) + end, + on_submit = function(value) + callback(value == "y" or value == "Y") + end, + }) + + input.prompt_type = "confirm" + M.show_input(input) + else + callback(vim.fn.confirm(message, "&Yes\n&No") == 1) + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/popups.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/popups.lua new file mode 100644 index 00000000..85362f36 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/popups.lua @@ -0,0 +1,126 @@ +local vim = vim +local NuiText = require("nui.text") +local NuiPopup = require("nui.popup") +local highlights = require("neo-tree.ui.highlights") +local log = require("neo-tree.log") + +local M = {} + +M.popup_options = function(title, min_width, override_options) + min_width = min_width or 30 + local width = string.len(title) + 2 + + local nt = require("neo-tree") + local popup_border_style = nt.config.popup_border_style + local popup_border_text = NuiText(" " .. title .. " ", highlights.FLOAT_TITLE) + local col = 0 + -- fix popup position when using multigrid + local popup_last_col = vim.api.nvim_win_get_position(0)[2] + width + 2 + if popup_last_col >= vim.o.columns then + col = vim.o.columns - popup_last_col + end + local popup_options = { + ns_id = highlights.ns_id, + relative = "cursor", + position = { + row = 1, + col = col, + }, + size = width, + border = { + text = { + top = popup_border_text, + }, + style = popup_border_style, + highlight = highlights.FLOAT_BORDER, + }, + win_options = { + winhighlight = "Normal:" + .. highlights.FLOAT_NORMAL + .. ",FloatBorder:" + .. highlights.FLOAT_BORDER, + }, + buf_options = { + bufhidden = "delete", + buflisted = false, + filetype = "neo-tree-popup", + }, + } + + if popup_border_style == "NC" then + local blank = NuiText(" ", highlights.TITLE_BAR) + popup_border_text = NuiText(" " .. title .. " ", highlights.TITLE_BAR) + popup_options.border = { + style = { "▕", blank, "▏", "▏", " ", "▔", " ", "▕" }, + highlight = highlights.FLOAT_BORDER, + text = { + top = popup_border_text, + top_align = "left", + }, + } + end + + if override_options then + return vim.tbl_extend("force", popup_options, override_options) + else + return popup_options + end +end + +M.alert = function(title, message, size) + local lines = {} + local max_line_width = title:len() + local add_line = function(line) + if not type(line) == "string" then + line = tostring(line) + end + if line:len() > max_line_width then + max_line_width = line:len() + end + table.insert(lines, line) + end + + if type(message) == "table" then + for _, v in ipairs(message) do + add_line(v) + end + else + add_line(message) + end + + add_line("") + add_line(" Press or to close") + + local win_options = M.popup_options(title, 80) + win_options.zindex = 60 + win_options.size = { + width = max_line_width + 4, + height = #lines + 1, + } + local win = NuiPopup(win_options) + win:mount() + + local success, msg = pcall(vim.api.nvim_buf_set_lines, win.bufnr, 0, 0, false, lines) + if success then + win:map("n", "", function(bufnr) + win:unmount() + end, { noremap = true }) + + win:map("n", "", function(bufnr) + win:unmount() + end, { noremap = true }) + + local event = require("nui.utils.autocmd").event + win:on({ event.BufLeave, event.BufDelete }, function() + win:unmount() + end, { once = true }) + + -- why is this necessary? + vim.api.nvim_set_current_win(win.winid) + else + log.error(msg) + win:unmount() + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/renderer.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/renderer.lua new file mode 100644 index 00000000..095adaa1 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/renderer.lua @@ -0,0 +1,1346 @@ +local vim = vim +local NuiLine = require("nui.line") +local NuiTree = require("nui.tree") +local NuiSplit = require("nui.split") +local NuiPopup = require("nui.popup") +local utils = require("neo-tree.utils") +local highlights = require("neo-tree.ui.highlights") +local popups = require("neo-tree.ui.popups") +local events = require("neo-tree.events") +local keymap = require("nui.utils.keymap") +local autocmd = require("nui.utils.autocmd") +local log = require("neo-tree.log") +local windows = require("neo-tree.ui.windows") + +local M = { resize_timer_interval = 50 } +local ESC_KEY = vim.api.nvim_replace_termcodes("", true, false, true) +local default_popup_size = { width = 60, height = "80%" } +local draw, create_tree, render_tree + +local floating_windows = {} +local update_floating_windows = function() + local valid_windows = {} + for _, win in ipairs(floating_windows) do + if M.is_window_valid(win.winid) then + table.insert(valid_windows, win) + end + end + floating_windows = valid_windows +end + +local tabid_to_tabnr = function(tabid) + return vim.api.nvim_tabpage_is_valid(tabid) and vim.api.nvim_tabpage_get_number(tabid) +end + +local buffer_is_usable = function(bufnr) + return vim.api.nvim_buf_is_valid(bufnr) and vim.api.nvim_buf_is_loaded(bufnr) +end + +local cleaned_up = false +---Clean up invalid neotree buffers (e.g after a session restore) +---@param force boolean if true, force cleanup. Otherwise only cleanup once +M.clean_invalid_neotree_buffers = function(force) + if cleaned_up and not force then + return + end + + for _, buf in ipairs(vim.api.nvim_list_bufs()) do + local bufname = vim.fn.bufname(buf) + local is_neotree_buffer = string.match(bufname, "neo%-tree [^ ]+ %[%d+]") + local is_valid_neotree, _ = pcall(vim.api.nvim_buf_get_var, buf, "neo_tree_source") + if is_neotree_buffer and not is_valid_neotree then + vim.api.nvim_buf_delete(buf, { force = true }) + end + end + cleaned_up = true +end + +local resize_monitor_timer = nil +local start_resize_monitor = function() + local interval = M.resize_timer_interval or -1 + if interval < 0 then + return + end + if type(interval) ~= "number" then + log.warn("Invalid resize_timer_interval:", interval) + return + end + if resize_monitor_timer then + return + end + local manager = require("neo-tree.sources.manager") + local check_window_size + local speed_up_loops = 0 + check_window_size = function() + local windows_exist = false + local success, err = pcall(manager._for_each_state, nil, function(state) + if state.win_width and M.tree_is_visible(state) then + windows_exist = true + local current_size = utils.get_inner_win_width(state.winid) + if current_size ~= state.win_width then + log.trace("Window size changed, redrawing tree") + state.win_width = current_size + render_tree(state) + speed_up_loops = 21 -- move to fast timer for the next 1000 ms + end + end + end) + + speed_up_loops = speed_up_loops - 1 + if success then + if windows_exist then + local this_interval = interval + if speed_up_loops > 0 then + this_interval = 50 + else + speed_up_loops = 0 + end + vim.defer_fn(check_window_size, this_interval) + else + log.trace("No windows exist, stopping resize monitor") + end + else + log.debug("Error checking window size: ", err) + vim.defer_fn(check_window_size, math.max(interval * 5, 1000)) + end + end + + vim.defer_fn(check_window_size, interval) +end + +---Safely closes the window and deletes the buffer associated with the state +---@param state table State of the source to close +---@param focus_prior_window boolean | nil if true or nil, focus the window that was previously focused +M.close = function(state, focus_prior_window) + + log.debug("Closing window, but saving position first.") + M.position.save(state) + + if focus_prior_window == nil then + focus_prior_window = true + end + local window_existed = false + if state and state.winid then + if M.window_exists(state) then + local bufnr = vim.api.nvim_win_get_buf(state.winid) + -- if bufnr is different then we expect, then it was taken over by + -- another buffer, so we can't delete it now + if bufnr == state.bufnr then + window_existed = true + if state.current_position == "current" then + -- we are going to hide the buffer instead of closing the window + M.position.save(state) + local new_buf = vim.fn.bufnr("#") + if new_buf < 1 then + new_buf = vim.api.nvim_create_buf(true, false) + end + vim.api.nvim_win_set_buf(state.winid, new_buf) + else + local args = { + position = state.current_position, + source = state.name, + winid = state.winid, + tabnr = tabid_to_tabnr(state.tabid), -- for compatibility + tabid = state.tabid, + } + events.fire_event(events.NEO_TREE_WINDOW_BEFORE_CLOSE, args) + local win_list = vim.api.nvim_tabpage_list_wins(0) + if focus_prior_window and #win_list > 1 then + -- focus the prior used window if we are closing the currently focused window + local current_winid = vim.api.nvim_get_current_win() + if current_winid == state.winid then + local pwin = require("neo-tree").get_prior_window() + if type(pwin) == "number" and pwin > 0 then + pcall(vim.api.nvim_set_current_win, pwin) + end + end + end + -- if the window was a float, changing the current win would have closed it already + pcall(vim.api.nvim_win_close, state.winid, true) + events.fire_event(events.NEO_TREE_WINDOW_AFTER_CLOSE, args) + end + end + end + state.winid = nil + end + local bufnr = utils.get_value(state, "bufnr", 0, true) + if bufnr > 0 and vim.api.nvim_buf_is_valid(bufnr) then + state.bufnr = nil + local success, err = pcall(vim.api.nvim_buf_delete, bufnr, { force = true }) + if not success and err and err:match("E523") then + vim.schedule_wrap(function() + vim.api.nvim_buf_delete(bufnr, { force = true }) + end)() + end + end + return window_existed +end + +M.close_floating_window = function(source_name) + local found_windows = {} + for _, win in ipairs(floating_windows) do + if win.source_name == source_name then + table.insert(found_windows, win) + end + end + + local valid_window_was_closed = false + for _, win in ipairs(found_windows) do + if not valid_window_was_closed then + valid_window_was_closed = M.is_window_valid(win.winid) + end + -- regardless of whether the window is valid or not, nui will cleanup + win:unmount() + end + return valid_window_was_closed +end + +M.close_all_floating_windows = function() + while #floating_windows > 0 do + local win = table.remove(floating_windows) + win:unmount() + end +end + +M.get_nui_popup = function(winid) + for _, win in ipairs(floating_windows) do + if win.winid == winid then + return win + end + end +end + +local remove_filtered = function(source_items, filtered_items) + local visible = {} + local hidden = {} + for _, child in ipairs(source_items) do + local fby = child.filtered_by + if type(fby) == "table" and not child.is_reveal_target then + if not fby.never_show then + if filtered_items.visible or child.is_nested or fby.always_show then + table.insert(visible, child) + elseif fby.name or fby.pattern or fby.dotfiles or fby.hidden then + table.insert(hidden, child) + elseif fby.show_gitignored and fby.gitignored then + table.insert(visible, child) + else + table.insert(hidden, child) + end + end + else + table.insert(visible, child) + end + end + return visible, hidden +end + +local create_nodes +---Transforms a list of items into a collection of TreeNodes. +---@param source_items table The list of items to transform. The expected +--interface for these items depends on the component renderers configured for +--the given source, but they must contain at least an id field. +---@param state table The current state of the plugin. +---@param level integer Optional. The current level of the tree, defaults to 0. +---@return table A collection of TreeNodes. +create_nodes = function(source_items, state, level) + level = level or 0 + local nodes = {} + local filtered_items = state.filtered_items or {} + local visible, hidden = remove_filtered(source_items, filtered_items) + + if #visible == 0 and level <= 1 and filtered_items.force_visible_in_empty_folder then + source_items = hidden + else + source_items = visible + end + + local show_indent_marker_for_message + local msg = state.renderers.message or {} + if msg[1] and msg[1][1] == "indent" then + show_indent_marker_for_message = msg[1].with_markers + end + + for i, item in ipairs(source_items) do + local is_last_child = i == #source_items + + local nodeData = { + id = item.id, + name = item.name, + type = item.type, + loaded = item.loaded, + filtered_by = item.filtered_by, + extra = item.extra, + is_nested = item.is_nested, + skip_node = item.skip_node, + is_empty_with_hidden_root = item.is_empty_with_hidden_root, + stat = item.stat, + stat_provider = item.stat_provider, + -- TODO: The below properties are not universal and should not be here. + -- Maybe they should be moved to the "extra" field? + is_link = item.is_link, + link_to = item.link_to, + path = item.path, + ext = item.ext, + search_pattern = item.search_pattern, + level = level, + is_last_child = is_last_child, + } + local indent = (state.renderers[item.type] or {}).indent_size or 4 + + local node_children = nil + if item.children ~= nil then + node_children = create_nodes(item.children, state, level + 1) + end + + local node = NuiTree.Node(nodeData, node_children) + if item._is_expanded then + node:expand() + end + table.insert(nodes, node) + end + + if #hidden > 0 then + if source_items == hidden then + local nodeData = { + id = hidden[#hidden].id .. "_hidden_message", + name = "(forced to show " + .. #hidden + .. " hidden " + .. (#hidden > 1 and "items" or "item") + .. ")", + type = "message", + level = level, + is_last_child = show_indent_marker_for_message, + } + local node = NuiTree.Node(nodeData) + table.insert(nodes, node) + elseif filtered_items.show_hidden_count or (#visible == 0 and level <= 1) then + local nodeData = { + id = hidden[#hidden].id .. "_hidden_message", + name = "(" .. #hidden .. " hidden " .. (#hidden > 1 and "items" or "item") .. ")", + type = "message", + level = level, + is_last_child = show_indent_marker_for_message, + } + if #nodes > 0 then + nodes[#nodes].is_last_child = not show_indent_marker_for_message + end + local node = NuiTree.Node(nodeData) + table.insert(nodes, node) + end + end + return nodes +end + +local one_line = function(text) + if type(text) == "string" then + return text:gsub("\n", " ") + else + return text + end +end + +M.render_component = function(component, item, state, remaining_width) + local component_func = state.components[component[1]] + if component_func then + local success, component_data, wanted_width = + pcall(component_func, component, item, state, remaining_width) + if success then + if component_data == nil then + return { {} } + end + if component_data.text then + -- everything else is easier if we make sure this is always the same shape + -- which is an array of { text, highlight } tables + component_data = { component_data } + end + for _, data in ipairs(component_data) do + data.text = one_line(data.text) + end + return component_data, wanted_width + else + local name = component[1] or "[missing_name]" + local msg = string.format("Error rendering component %s: %s", name, component_data) + log.warn(msg) + return { { text = msg, highlight = highlights.NORMAL } } + end + else + local name = component[1] or "[missing_name]" + local msg = "Neo-tree: Component " .. name .. " not found." + log.warn(msg) + return { { text = msg, highlight = highlights.NORMAL } } + end +end + +local prepare_node = function(item, state) + if item.skip_node then + if item.is_empty_with_hidden_root then + local line = NuiLine() + line:append("(empty folder)", highlights.MESSAGE) + return line + else + return nil + end + end + -- pre_render is used to calculate the longest node width + -- without actually rendering the node. + -- We'll try to reuse that work if possible. + local pre_render = state._in_pre_render + if item.line and not pre_render then + local line = item.line + -- Only use it once, we don't want to accidentally use stale data + item.line = nil + if + line + and item.wanted_width + and state.longest_node + and item.wanted_width <= state.longest_node + then + return line + end + end + local line = NuiLine() + + local renderer = state.renderers[item.type] + if not renderer then + line:append(item.type .. ": ", "Comment") + line:append(item.name) + return line + end + + local remaining_cols = state.win_width + if remaining_cols == nil then + if state.winid then + remaining_cols = vim.api.nvim_win_get_width(state.winid) + else + local default_width = utils.resolve_config_option(state, "window.width", 40) + remaining_cols = default_width + end + end + + local wanted_width = 0 + if state.current_position == "current" then + local longest = state.longest_node or 0 + remaining_cols = math.min(remaining_cols, longest + 4) + end + + local should_pad = false + + for _, component in ipairs(renderer) do + if component.enabled == false then + goto continue + end + local component_data, component_wanted_width = + M.render_component(component, item, state, remaining_cols - (should_pad and 1 or 0)) + local actual_width = 0 + if component_data then + for _, data in ipairs(component_data) do + if data.text then + local padding = "" + if should_pad and #data.text and data.text:sub(1, 1) ~= " " and not data.no_padding then + padding = " " + end + data.text = padding .. data.text + should_pad = data.text:sub(#data.text) ~= " " and not data.no_next_padding + + actual_width = actual_width + vim.api.nvim_strwidth(data.text) + line:append(data.text, data.highlight) + remaining_cols = remaining_cols - vim.fn.strchars(data.text) + end + end + end + component_wanted_width = component_wanted_width or actual_width + wanted_width = wanted_width + component_wanted_width + ::continue:: + end + + line.wanted_width = wanted_width + if pre_render then + item.line = line + state.longest_node = math.max(state.longest_node, line.wanted_width) + else + item.line = nil + end + + return line +end + +---Sets the cursor at the specified node. +---@param state table The current state of the source. +---@param id string? The id of the node to set the cursor at. +---@return boolean boolean True if the node was found and focused, false +---otherwise. +M.focus_node = function(state, id, do_not_focus_window, relative_movement, bottom_scroll_padding) + if not id and not relative_movement then + log.debug("focus_node called with no id and no relative movement") + return false + end + relative_movement = relative_movement or 0 + bottom_scroll_padding = bottom_scroll_padding or 0 + + local tree = state.tree + if not tree then + log.debug("focus_node called with no tree") + return false + end + local node, linenr = tree:get_node(id) + if not node then + log.debug("focus_node cannot find node with id ", id) + return false + end + id = node:get_id() -- in case nil was passed in for id, meaning current node + + local bufnr = utils.get_value(state, "bufnr", 0, true) + if bufnr == 0 then + log.debug("focus_node: state has no bufnr ", state.bufnr, " / ", state.winid) + return false + end + if not vim.api.nvim_buf_is_valid(bufnr) then + log.debug("focus_node: bufnr is not valid") + return false + end + + if M.window_exists(state) then + if not linenr then + M.expand_to_node(state, node) + node, linenr = tree:get_node(id) + if not linenr then + log.debug("focus_node cannot get linenr for node with id ", id) + return false + end + end + local focus_window = not do_not_focus_window + if focus_window then + vim.api.nvim_set_current_win(state.winid) + end + + -- focus the correct line + linenr = linenr + relative_movement + local col = 0 + if node.indent then + col = string.len(node.indent) + end + local success, err = pcall(vim.api.nvim_win_set_cursor, state.winid, { linenr, col }) + + if success then + -- forget about cursor position as it is overwritten + M.position.clear(state) + -- now ensure that the window is scrolled correctly + local execute_win_command = function(cmd) + if vim.api.nvim_get_current_win() == state.winid then + vim.cmd(cmd) + else + vim.cmd("call win_execute(" .. state.winid .. [[, "]] .. cmd .. [[")]]) + end + end + + -- make sure we are not scrolled down if it can all fit on the screen + local lines = vim.api.nvim_buf_line_count(state.bufnr) + local win_height = vim.api.nvim_win_get_height(state.winid) + local virtual_bottom_line = vim.fn.line("w0", state.winid) + win_height - bottom_scroll_padding + if virtual_bottom_line <= linenr then + execute_win_command("normal! " .. (linenr + bottom_scroll_padding) .. "zb") + pcall(vim.api.nvim_win_set_cursor, state.winid, { linenr, col }) + elseif virtual_bottom_line > lines then + execute_win_command("normal! " .. (lines + bottom_scroll_padding) .. "zb") + pcall(vim.api.nvim_win_set_cursor, state.winid, { linenr, col }) + elseif linenr < (win_height / 2) then + execute_win_command("normal! zz") + end + else + log.debug("Failed to set cursor: " .. err) + end + return success + else + log.debug("focus_node: window does not exist") + return false + end + + return false +end + +M.get_all_visible_nodes = function(tree) + local nodes = {} + + local function process(node) + table.insert(nodes, node) + if node:is_expanded() then + if node:has_children() then + for _, child in ipairs(tree:get_nodes(node:get_id())) do + process(child) + end + end + end + end + + for _, node in ipairs(tree:get_nodes()) do + process(node) + end + return nodes +end + +M.get_expanded_nodes = function(tree, root_node_id) + local node_ids = {} + + local function process(node) + local id = node:get_id() + if node:is_expanded() then + table.insert(node_ids, id) + end + if node:has_children() then + for _, child in ipairs(tree:get_nodes(id)) do + process(child) + end + end + end + + if root_node_id then + local root_node = tree:get_node(root_node_id) + if root_node then + process(root_node) + end + else + for _, node in ipairs(tree:get_nodes()) do + process(node) + end + end + return node_ids +end + +M.collapse_all_nodes = function(tree, root_node_id) + local expanded = M.get_expanded_nodes(tree, root_node_id) + for _, id in ipairs(expanded) do + local node = tree:get_node(id) + if utils.is_expandable(node) then + node:collapse(id) + end + end + -- but make sure the root is expanded + local root = tree:get_nodes()[1] + if root then + root:expand() + end +end + +M.expand_to_node = function(state, node) + if not M.tree_is_visible(state) then + return + end + local tree = state.tree + if type(node) == "string" then + node = tree:get_node(node) + end + local parentId = node:get_parent_id() + while parentId do + local parent = tree:get_node(parentId) + parent:expand() + parentId = parent:get_parent_id() + end + render_tree(state) +end + +---Functions to save and restore the focused node. +M.position = { + save = function(state) + if state.position.topline and state.position.lnum then + log.debug("There's already a position saved to be restored. Cannot save another.") + return + end + if state.tree and M.window_exists(state) then + local win_state = vim.api.nvim_win_call(state.winid, vim.fn.winsaveview) + state.position.topline = win_state.topline + state.position.lnum = win_state.lnum + log.debug("Saved cursor position with lnum: " .. state.position.lnum) + log.debug("Saved window position with topline: " .. state.position.topline) + end + end, + set = function(state, node_id) + if not type(node_id) == "string" and node_id > "" then + return + end + state.position.node_id = node_id + end, + clear = function (state) + log.debug("Forget about cursor position.") + -- Clear saved position, so that we can save another position later. + state.position.topline = nil + state.position.lnum = nil + -- After focusing a node, we clear it so that subsequent renderer.position.restore don't + -- focus on it anymore + state.position.node_id = nil + end, + restore = function(state) + if state.position.topline and state.position.lnum then + log.debug("Restoring window position to topline: " .. state.position.topline) + log.debug("Restoring cursor position to lnum: " .. state.position.lnum) + vim.api.nvim_win_call(state.winid, function() + vim.fn.winrestview({ topline = state.position.topline, lnum = state.position.lnum }) + end) + end + if state.position.node_id then + log.debug("Focusing on node_id: " .. state.position.node_id) + M.focus_node(state, state.position.node_id, true) + end + M.position.clear(state) + end, +} + +---Redraw the tree without relaoding from the source. +---@param state table State of the tree. +M.redraw = function(state) + if state.tree and M.tree_is_visible(state) then + log.trace("Redrawing tree", state.name, state.id) + -- every now and then this will fail because the window was closed in + -- betweeen the start of an async refresh and the redraw call. + -- This is not a problem, so we just ignore the error. + local success = pcall(render_tree, state) + if success then + log.trace(" Redrawing tree done", state.name, state.id) + else + log.trace(" Redrawing tree failed, maybe it was closed?", state.name, state.id) + end + end +end +---Visit all nodes ina tree recursively and reduce to a single value. +---@param tree table NuiTree +---@param memo any Value that is passed to the accumulator function +---@param func function Accumulator function that is called for each node +---@return any any The final memo value. +M.reduce_nodes = function(tree, memo, func) + if type(func) ~= "function" then + error("func must be a function") + end + local visit + visit = function(node) + func(node, memo) + if node:has_children() then + for _, child in ipairs(tree:get_nodes(node:get_id())) do + visit(child) + end + end + end + for _, node in ipairs(tree:get_nodes()) do + visit(node) + end + return memo +end + +---Visits all nodes in the tree and returns a list of all nodes that match the +---given predicate. +---@param tree table The NuiTree to search. +---@param selector_func function The predicate function, should return true for +---nodes that should be included in the result. +---@return table table A list of nodes that match the predicate. +M.select_nodes = function(tree, selector_func, limit) + if type(selector_func) ~= "function" then + error("selector_func must be a function") + end + local found_nodes = {} + local visit + visit = function(node) + if selector_func(node) then + table.insert(found_nodes, node) + if limit and #found_nodes >= limit then + return + end + end + if node:has_children() then + for _, child in ipairs(tree:get_nodes(node:get_id())) do + visit(child) + end + end + end + for _, node in ipairs(tree:get_nodes()) do + visit(node) + if limit and #found_nodes >= limit then + break + end + end + return found_nodes +end + +M.set_expanded_nodes = function(tree, expanded_nodes) + M.collapse_all_nodes(tree) + log.debug("Setting expanded nodes") + for _, id in ipairs(expanded_nodes or {}) do + local node = tree:get_node(id) + if node ~= nil then + node:expand() + end + end +end + +create_tree = function(state) + if state.tree and state.tree.bufnr == state.bufnr then + if buffer_is_usable(state.tree.bufnr) then + log.debug("Tree already exists and buffer is valid, skipping creation", state.name, state.id) + state.tree.winid = state.winid + return + end + end + state.tree = NuiTree({ + ns_id = highlights.ns_id, + winid = state.winid, + bufnr = state.bufnr, + get_node_id = function(node) + return node.id + end, + prepare_node = function(data) + return prepare_node(data, state) + end, + }) +end + +local get_selected_nodes = function(state) + if state.winid ~= vim.api.nvim_get_current_win() then + return nil + end + local start_pos = vim.fn.getpos("'<")[2] + local end_pos = vim.fn.getpos("'>")[2] + if end_pos < start_pos then + -- I'm not sure if this could actually happen, but just in case + start_pos, end_pos = end_pos, start_pos + end + local selected_nodes = {} + while start_pos <= end_pos do + local node = state.tree:get_node(start_pos) + if node then + table.insert(selected_nodes, node) + end + start_pos = start_pos + 1 + end + return selected_nodes +end + +local set_buffer_mappings = function(state) + local resolved_mappings = {} + local skip_this_mapping = { + ["none"] = true, + ["nop"] = true, + ["noop"] = true, + } + local mappings = utils.get_value(state, "window.mappings", {}, true) + local mapping_options = utils.get_value(state, "window.mapping_options", { noremap = true }, true) + for cmd, func in pairs(mappings) do + local vfunc + local config = {} + if utils.truthy(func) then + if skip_this_mapping[func] then + log.trace("Skipping mapping for %s", cmd) + else + local map_options = vim.deepcopy(mapping_options) + local desc + if type(func) == "table" then + for key, value in pairs(func) do + if key ~= "command" and key ~= 1 and key ~= "config" then + map_options[key] = value + end + end + desc = func.desc + config = func.config or {} + func = func.command or func[1] + end + if type(func) == "string" then + resolved_mappings[cmd] = { text = func } + map_options.desc = map_options.desc or func + vfunc = state.commands[func .. "_visual"] + func = state.commands[func] + elseif type(func) == "function" then + resolved_mappings[cmd] = { text = desc or "" } + end + if type(func) == "function" then + resolved_mappings[cmd].handler = function() + state.config = config + return func(state) + end + keymap.set(state.bufnr, "n", cmd, resolved_mappings[cmd].handler, map_options) + if type(vfunc) == "function" then + keymap.set(state.bufnr, "v", cmd, function() + vim.api.nvim_feedkeys(ESC_KEY, "i", true) + vim.schedule(function() + local selected_nodes = get_selected_nodes(state) + if utils.truthy(selected_nodes) then + state.config = config + vfunc(state, selected_nodes) + end + end) + end, map_options) + end + else + log.warn("Invalid mapping for ", cmd, ": ", func) + resolved_mappings[cmd] = "" + end + end + end + end + state.resolved_mappings = resolved_mappings +end + +local function create_floating_window(state, win_options, bufname) + local win + state.force_float = nil + -- First get the default options for floating windows. + local sourceTitle = state.name:gsub("^%l", string.upper) + win_options = popups.popup_options("Neo-tree " .. sourceTitle, 40, win_options) + win_options.win_options = nil + win_options.zindex = 40 + + -- Then override with source specific options. + local b = win_options.border + win_options.size = utils.resolve_config_option(state, "window.popup.size", default_popup_size) + win_options.position = utils.resolve_config_option(state, "window.popup.position", "50%") + win_options.border = utils.resolve_config_option(state, "window.popup.border", b) + + win = NuiPopup(win_options) + win:mount() + win.source_name = state.name + win.original_options = state.window + table.insert(floating_windows, win) + + win:on({ "BufHidden" }, function() + vim.schedule(function() + win:unmount() + end) + end, { once = true }) + state.winid = win.winid + state.bufnr = win.bufnr + log.debug("Created floating window with winid: ", win.winid, " and bufnr: ", win.bufnr) + vim.api.nvim_buf_set_name(state.bufnr, bufname) + + -- why is this necessary? + vim.api.nvim_set_current_win(win.winid) + return win +end + +local get_buffer = function(bufname, state) + local bufnr = vim.fn.bufnr(bufname) + if bufnr > 0 then + if vim.api.nvim_buf_is_valid(bufnr) and vim.api.nvim_buf_is_loaded(bufnr) then + return bufnr + else + pcall(vim.api.nvim_buf_delete, bufnr, { force = true }) + bufnr = 0 + end + end + if bufnr < 1 then + bufnr = vim.api.nvim_create_buf(false, false) + vim.api.nvim_buf_set_name(bufnr, bufname) + vim.api.nvim_buf_set_option(bufnr, "buftype", "nofile") + vim.api.nvim_buf_set_option(bufnr, "swapfile", false) + vim.api.nvim_buf_set_option(bufnr, "filetype", "neo-tree") + vim.api.nvim_buf_set_option(bufnr, "modifiable", false) + vim.api.nvim_buf_set_option(bufnr, "undolevels", -1) + autocmd.buf.define(bufnr, "BufDelete", function() + M.position.save(state) + end) + end + return bufnr +end + +M.acquire_window = function(state) + if M.window_exists(state) then + return state.winid + end + + -- used by tests to determine if the tree is ready for testing + state._ready = false + + local default_position = utils.resolve_config_option(state, "window.position", "left") + local relative = utils.resolve_config_option(state, "window.relative", "editor") + state.current_position = state.current_position or default_position + + local bufname = string.format("neo-tree %s [%s]", state.name, state.id) + local size_opt, default_size + if state.current_position == "top" or state.current_position == "bottom" then + size_opt, default_size = "window.height", "15" + else + size_opt, default_size = "window.width", "40" + end + local win_options = { + ns_id = highlights.ns_id, + size = utils.resolve_config_option(state, size_opt, default_size), + position = state.current_position, + relative = relative, + buf_options = { + buftype = "nofile", + modifiable = false, + swapfile = false, + filetype = "neo-tree", + undolevels = -1, + }, + win_options = { + colorcolumn = "", + signcolumn = "no", + }, + } + + local event_args = { + position = state.current_position, + source = state.name, + tabnr = tabid_to_tabnr(state.tabid), -- for compatibility + tabid = state.tabid, + } + events.fire_event(events.NEO_TREE_WINDOW_BEFORE_OPEN, event_args) + + local win + if state.current_position == "float" then + M.close_all_floating_windows() + M.close(state) + win = create_floating_window(state, win_options, bufname) + elseif state.current_position == "current" then + -- state.id is always the window id or tabnr that this state was created for + -- in the case of a position = current state object, it will be the window id + local winid = state.id + if not vim.api.nvim_win_is_valid(winid) then + log.warn("Window ", winid, " is no longer valid!") + return + end + state.winid = winid + state.bufnr = get_buffer(bufname, state) + vim.api.nvim_win_set_buf(state.winid, state.bufnr) + else + local close_old_window = function(new_winid) + if state.winid and new_winid ~= state.winid then + -- This state may be showing in another window, close it first because + -- each state can only be shown in one window at a time. + M.close(state, false) + end + end + local location = windows.get_location(state.current_position) + if location.winid > 0 then + close_old_window(location.winid) + state.bufnr = get_buffer(bufname, state) + state.winid = location.winid + vim.api.nvim_win_set_buf(state.winid, state.bufnr) + else + close_old_window() + win = NuiSplit(win_options) + win:mount() + state.bufnr = win.bufnr + state.winid = win.winid + location.winid = state.winid + end + location.source = state.name + end + event_args.winid = state.winid + events.fire_event(events.NEO_TREE_WINDOW_AFTER_OPEN, event_args) + + if type(state.bufnr) == "number" then + vim.api.nvim_buf_set_var(state.bufnr, "neo_tree_source", state.name) + vim.api.nvim_buf_set_var(state.bufnr, "neo_tree_tabnr", tabid_to_tabnr(state.tabid)) + vim.api.nvim_buf_set_var(state.bufnr, "neo_tree_tabid", state.tabid) + vim.api.nvim_buf_set_var(state.bufnr, "neo_tree_position", state.current_position) + vim.api.nvim_buf_set_var(state.bufnr, "neo_tree_winid", state.winid) + end + + if win ~= nil then + vim.api.nvim_buf_set_name(state.bufnr, bufname) + vim.api.nvim_set_current_win(state.winid) + -- Used to track the position of the cursor within the tree as it gains and loses focus + win:on({ "BufDelete" }, function() + M.position.save(state) + end) + win:on({ "BufDelete" }, function() + vim.schedule(function () + win:unmount() + end) + end, { once = true }) + end + + set_buffer_mappings(state) + return state.winid +end + +M.update_floating_window_layouts = function() + update_floating_windows() + for _, win in ipairs(floating_windows) do + local opt = { + relative = "win", + } + opt.size = utils.resolve_config_option(win.original_options, "popup.size", default_popup_size) + opt.position = utils.resolve_config_option(win.original_options, "popup.position", "50%") + win:update_layout(opt) + end +end + +---Determines is the givin winid is valid and the window still exists. +---@param winid any +---@return boolean +M.is_window_valid = function(winid) + if winid == nil then + return false + end + if type(winid) == "number" and winid > 0 then + return vim.api.nvim_win_is_valid(winid) + else + return false + end +end + +---Determines if the window exists and is valid. +---@param state table The current state of the plugin. +---@return boolean True if the window exists and is valid, false otherwise. +M.window_exists = function(state) + local window_exists + local winid = utils.get_value(state, "winid", 0, true) + local bufnr = utils.get_value(state, "bufnr", 0, true) + local default_position = utils.get_value(state, "window.position", "left", true) + local position = state.current_position or default_position + + if winid == 0 then + window_exists = false + elseif position == "current" then + window_exists = vim.api.nvim_win_is_valid(winid) + and vim.api.nvim_buf_is_loaded(bufnr) + and vim.api.nvim_win_get_buf(winid) == bufnr + else + local isvalid = M.is_window_valid(winid) + window_exists = isvalid and (vim.api.nvim_win_get_number(winid) > 0) + if window_exists then + local winbufnr = vim.api.nvim_win_get_buf(winid) + if winbufnr < 1 then + return false + else + if winbufnr ~= bufnr then + return false + end + local success, buf_position = pcall(vim.api.nvim_buf_get_var, bufnr, "neo_tree_position") + if not success then + return false + end + if buf_position ~= position then + return false + end + end + end + end + return window_exists +end + +---Determines if a specific tree is open. +---@param state table The current state of the plugin. +---@return boolean +M.tree_is_visible = function(state) + return M.window_exists(state) and vim.api.nvim_win_get_buf(state.winid) == state.bufnr +end + +---Renders the given tree and expands window width if needed +--@param state table The state containing tree to render. Almost same as state.tree:render() +render_tree = function(state) + local add_blank_line_at_top = require("neo-tree").config.add_blank_line_at_top + local should_auto_expand = state.window.auto_expand_width and state.current_position ~= "float" + local should_pre_render = should_auto_expand or state.current_position == "current" + + log.debug("render_tree: Saving position") + M.position.save(state) + + if should_pre_render and M.tree_is_visible(state) then + log.trace("pre-rendering tree") + state._in_pre_render = true + if add_blank_line_at_top then + state.tree:render(2) + else + state.tree:render() + end + state._in_pre_render = false + state.window.last_user_width = vim.api.nvim_win_get_width(state.winid) + if should_auto_expand and state.longest_node > state.window.last_user_width then + log.trace(string.format("auto_expand_width: on. Expanding width to %s.", state.longest_node)) + vim.api.nvim_win_set_width(state.winid, state.longest_node) + state.win_width = state.longest_node + end + end + if M.tree_is_visible(state) then + if add_blank_line_at_top then + state.tree:render(2) + else + state.tree:render() + end + end + + log.debug("render_tree: Restoring position") + M.position.restore(state) +end + +---Draws the given nodes on the screen. +--@param nodes table The nodes to draw. +--@param state table The current state of the source. +draw = function(nodes, state, parent_id) + -- If we are going to redraw, preserve the current set of expanded nodes. + local expanded_nodes = {} + if parent_id == nil and state.tree ~= nil then + if state.force_open_folders then + log.trace("Force open folders") + state.force_open_folders = nil + else + log.trace("Preserving expanded nodes") + expanded_nodes = M.get_expanded_nodes(state.tree) + end + end + if state.default_expanded_nodes then + for _, id in ipairs(state.default_expanded_nodes) do + table.insert(expanded_nodes, id) + end + end + + -- Create the tree if it doesn't exist. + if parent_id then + if not M.window_exists(state) then + log.trace("Window is gone, aborting lazy load of folder") + return + end + else + M.acquire_window(state) + create_tree(state) + end + + -- draw the given nodes + local success, msg = pcall(state.tree.set_nodes, state.tree, nodes, parent_id) + if not success then + log.error("Error setting nodes: ", msg) + log.error(vim.inspect(state.tree:get_nodes())) + end + if parent_id ~= nil then + -- this is a dynamic fetch of children that were not previously loaded + local node = state.tree:get_node(parent_id) + node.loaded = true + node:expand() + else + M.set_expanded_nodes(state.tree, expanded_nodes) + end + + -- This is to ensure that containers are always the right size + state.win_width = utils.get_inner_win_width(state.winid) + start_resize_monitor() + + render_tree(state) + + -- draw winbar / statusbar + require("neo-tree.ui.selector").set_source_selector(state) + + state._ready = true +end + +local function group_empty_dirs(node) + if node.children == nil then + return node + end + + local first_child = node.children[1] + if #node.children == 1 and first_child.type == "directory" then + -- this is the only path that changes the tree + -- at each step where we discover an empty directory, merge it's name with the parent + -- then skip over it + first_child.name = node.name .. utils.path_separator .. first_child.name + return group_empty_dirs(first_child) + else + for i, child in ipairs(node.children) do + node.children[i] = group_empty_dirs(child) + end + return node + end +end + +---Shows the given items as a tree. +--@param sourceItems table The list of items to transform. +--@param state table The current state of the plugin. +--@param parentId string Optional. The id of the parent node to display these nodes +--at; defaults to nil. +M.show_nodes = function(sourceItems, state, parentId, callback) + --local id = string.format("show_nodes %s:%s [%s]", state.name, state.force_float, state.tabid) + --utils.debounce(id, function() + events.fire_event(events.BEFORE_RENDER, state) + state.longest_width_exact = 0 + local parent + local level = 0 + if parentId ~= nil then + local success + success, parent = pcall(state.tree.get_node, state.tree, parentId) + if success and parent then + level = parent:get_depth() + end + state.longest_node = state.longest_node or 0 + else + state.longest_node = 0 + end + + local config = require("neo-tree").config + if config.hide_root_node then + if not parentId then + sourceItems[1].skip_node = true + if not (sourceItems[1].children and #sourceItems[1].children > 0) then + sourceItems[1].is_empty_with_hidden_root = true + end + end + if not config.retain_hidden_root_indent then + level = level - 1 + end + end + + if state.group_empty_dirs then + if parent then + local scan_mode = require("neo-tree").config.filesystem.scan_mode + if scan_mode == "deep" then + for i, item in ipairs(sourceItems) do + sourceItems[i] = group_empty_dirs(item) + end + else + -- this is a lazy load of a single sub folder + group_empty_dirs(sourceItems) + if #sourceItems == 1 and sourceItems[1].type == "directory" then + -- This folder needs to be grouped. + -- The goal is to just update the existing node in place. + -- To avoid digging into private internals of Nui, we will just export the entire level and replace + -- the one node. This keeps it in the right order, because nui doesn't have methods to replace something + -- in place. + -- We can't just mutate the existing node because we have to change it's id which would break Nui's + -- internal state. + local item = sourceItems[1] + parentId = parent:get_parent_id() + local siblings = state.tree:get_nodes(parentId) + for i, node in pairs(siblings) do + if node.id == parent.id then + item.name = parent.name .. utils.path_separator .. item.name + item.level = level - 1 + item.loaded = utils.truthy(item.children) + siblings[i] = NuiTree.Node(item, item.children) + break + end + end + sourceItems = nil -- this is a signal to skip the rest of the processing + state.tree:set_nodes(siblings, parentId) + end + end + else + -- if we are rendering a whole tree, just group the children because we don'the + -- want to change the root nodes + for _, item in ipairs(sourceItems) do + if item.children ~= nil then + for i, child in ipairs(item.children) do + item.children[i] = group_empty_dirs(child) + end + end + end + end + end + + if sourceItems then + -- normal path + local nodes = create_nodes(sourceItems, state, level) + draw(nodes, state, parentId) + else + -- this was a force grouping of a lazy loaded folder + state.win_width = utils.get_inner_win_width(state.winid) + render_tree(state) + end + + vim.schedule(function() + events.fire_event(events.AFTER_RENDER, state) + end) + if type(callback) == "function" then + vim.schedule(callback) + end + --end, 100) +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/selector.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/selector.lua new file mode 100644 index 00000000..1bd0422f --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/selector.lua @@ -0,0 +1,424 @@ +local vim = vim +local utils = require("neo-tree.utils") +local log = require("neo-tree.log") +local manager = require("neo-tree.sources.manager") + +local M = {} + +---calc_click_id_from_source: +-- Calculates click_id that stores information of the source and window id +-- DANGER: Do not change this function unless you know what you are doing +---@param winid integer: window id of the window source_selector is placed +---@param source_index integer: index of the source +---@return integer +local calc_click_id_from_source = function(winid, source_index) + local base_number = #require("neo-tree").config.source_selector.sources + 1 + return base_number * winid + source_index +end + +---calc_source_from_click_id: +-- Calculates source index and window id from click_id. Paired with `M.calc_click_id_from_source` +-- DANGER: Do not change this function unless you know what you are doing +---@param click_id integer: click_id +---@return integer, integer +local calc_source_from_click_id = function(click_id) + local base_number = #require("neo-tree").config.source_selector.sources + 1 + return math.floor(click_id / base_number), click_id % base_number +end +---sep_tbl: +-- Returns table expression of separator. +-- Converts to table expression if sep is string. +---@param sep string | table: +---@return table: `{ left = .., right = .., override = .. }` +local sep_tbl = function(sep) + if type(sep) == "nil" then + return {} + elseif type(sep) ~= "table" then + return { left = sep, right = sep, override = "active" } + end + return sep +end + +-- Function below provided by @akinsho +-- https://github.com/nvim-neo-tree/neo-tree.nvim/pull/427#discussion_r924947766 + +-- truncate a string based on number of display columns/cells it occupies +-- so that multibyte characters are not broken up mid-character +---@param str string +---@param col_limit number +---@return string +local function truncate_by_cell(str, col_limit) + local api = vim.api + local fn = vim.fn + if str and str:len() == api.nvim_strwidth(str) then + return fn.strcharpart(str, 0, col_limit) + end + local short = fn.strcharpart(str, 0, col_limit) + if api.nvim_strwidth(short) > col_limit then + while api.nvim_strwidth(short) > col_limit do + short = fn.strcharpart(short, 0, fn.strchars(short) - 1) + end + end + return short +end + +---get_separators +-- Returns information about separator on each tab. +---@param source_index integer: index of source +---@param active_index integer: index of active source. used to check if source is active and when `override = "active"` +---@param force_ignore_left boolean: overwrites calculated results with "" if set to true +---@param force_ignore_right boolean: overwrites calculated results with "" if set to true +---@return table: something like `{ left = "|", right = "|" }` +local get_separators = function(source_index, active_index, force_ignore_left, force_ignore_right) + local config = require("neo-tree").config + local is_active = source_index == active_index + local sep = sep_tbl(config.source_selector.separator) + if is_active then + sep = vim.tbl_deep_extend("force", sep, sep_tbl(config.source_selector.separator_active)) + end + local show_left = sep.override == "left" + or (sep.override == "active" and source_index <= active_index) + or sep.override == nil + local show_right = sep.override == "right" + or (sep.override == "active" and source_index >= active_index) + or sep.override == nil + return { + left = (show_left and not force_ignore_left) and sep.left or "", + right = (show_right and not force_ignore_right) and sep.right or "", + } +end + +---get_selector_tab_info: +-- Returns information to create a tab +---@param source_name string: name of source. should be same as names in `config.sources` +---@param source_index integer: index of source_name +---@param is_active boolean: whether this source is currently focused +---@param separator table: `{ left = .., right = .. }`: output from `get_separators()` +---@return table (see code): Note: `length`: length of whole tab (including seps), `text_length`: length of tab excluding seps +local get_selector_tab_info = function(source_name, source_index, is_active, separator) + local config = require("neo-tree").config + local separator_config = utils.resolve_config_option(config, "source_selector", nil) + if separator_config == nil then + log.warn("Cannot find source_selector config. `get_selector` abort.") + return {} + end + local source_config = config[source_name] or {} + local get_strlen = vim.api.nvim_strwidth + local text = separator_config.sources[source_index].display_name or source_config.display_name or source_name + local text_length = get_strlen(text) + if separator_config.tabs_min_width ~= nil and text_length < separator_config.tabs_min_width then + text = M.text_layout(text, separator_config.content_layout, separator_config.tabs_min_width) + text_length = separator_config.tabs_min_width + end + if separator_config.tabs_max_width ~= nil and text_length > separator_config.tabs_max_width then + text = M.text_layout(text, separator_config.content_layout, separator_config.tabs_max_width) + text_length = separator_config.tabs_max_width + end + local tab_hl = is_active and separator_config.highlight_tab_active + or separator_config.highlight_tab + local sep_hl = is_active and separator_config.highlight_separator_active + or separator_config.highlight_separator + return { + index = source_index, + is_active = is_active, + left = separator.left, + right = separator.right, + text = text, + tab_hl = tab_hl, + sep_hl = sep_hl, + length = text_length + get_strlen(separator.left) + get_strlen(separator.right), + text_length = text_length, + } +end + +---text_with_hl: +-- Returns text with highlight syntax for winbar / statusline +---@param text string: text to highlight +---@param tab_hl string | nil: if nil, does nothing +---@return string: e.g. "%#HiName#text" +local text_with_hl = function(text, tab_hl) + if tab_hl == nil then + return text + end + return string.format("%%#%s#%s", tab_hl, text) +end + +---add_padding: +-- Use for creating padding with highlight +---@param padding_legth number: number of padding. if float, value is rounded with `math.floor` +---@param padchar string | nil: if nil, " " (space) is used +---@return string +local add_padding = function(padding_legth, padchar) + if padchar == nil then + padchar = " " + end + return string.rep(padchar, math.floor(padding_legth)) +end + +---text_layout: +-- Add padding to fill `output_width`. +-- If `output_width` is less than `text_length`, text is truncated to fit `output_width`. +---@param text string: +---@param content_layout string: `"start", "center", "end"`: see `config.source_selector.tabs_layout` for more details +---@param output_width integer: exact `strdisplaywidth` of the output string +---@param trunc_char string | nil: Character used to indicate truncation. If nil, "…" (ellipsis) is used. +---@return string +local text_layout = function(text, content_layout, output_width, trunc_char) + if output_width < 1 then + return "" + end + local text_length = vim.fn.strdisplaywidth(text) + local pad_length = output_width - text_length + local left_pad, right_pad = 0, 0 + if pad_length < 0 then + if output_width < 4 then + return truncate_by_cell(text, output_width) + else + return truncate_by_cell(text, output_width - 1) .. trunc_char + end + elseif content_layout == "start" then + left_pad, right_pad = 0, pad_length + elseif content_layout == "end" then + left_pad, right_pad = pad_length, 0 + elseif content_layout == "center" then + left_pad, right_pad = pad_length / 2, math.ceil(pad_length / 2) + end + return add_padding(left_pad) .. text .. add_padding(right_pad) +end + +---render_tab: +-- Renders string to express one tab for winbar / statusline. +---@param left_sep string: left separator +---@param right_sep string: right separator +---@param sep_hl string: highlight of separators +---@param text string: text, mostly name of source in this case +---@param tab_hl string: highlight of text +---@param click_id integer: id passed to `___neotree_selector_click`, should be calculated with `M.calc_click_id_from_source` +---@return string: complete string to render one tab +local render_tab = function(left_sep, right_sep, sep_hl, text, tab_hl, click_id) + local res = "%" .. click_id .. "@v:lua.___neotree_selector_click@" + if left_sep ~= nil then + res = res .. text_with_hl(left_sep, sep_hl) + end + res = res .. text_with_hl(text, tab_hl) + if right_sep ~= nil then + res = res .. text_with_hl(right_sep, sep_hl) + end + return res +end + +M.get_scrolled_off_node_text = function(state) + if state == nil then + state = require("neo-tree.sources.manager").get_state_for_window() + if state == nil then + return + end + end + local win_top_line = vim.fn.line("w0") + if win_top_line == nil or win_top_line == 1 then + return + end + local node = state.tree:get_node(win_top_line) + return "  " .. vim.fn.fnamemodify(node.path, ":~:h") +end + +M.get = function() + local state = require("neo-tree.sources.manager").get_state_for_window() + if state == nil then + return + else + local config = require("neo-tree").config + local scrolled_off = + utils.resolve_config_option(config, "source_selector.show_scrolled_off_parent_node", false) + if scrolled_off then + local node_text = M.get_scrolled_off_node_text(state) + if node_text ~= nil then + return node_text + end + end + return M.get_selector(state, vim.api.nvim_win_get_width(0)) + end +end + +---get_selector: +-- Does everything to generate the string for source_selector in winbar / statusline. +---@param state table: +---@param width integer: width of the entire window where the source_selector is displayed +---@return string | nil +M.get_selector = function(state, width) + local config = require("neo-tree").config + if config == nil then + log.warn("Cannot find config. `get_selector` abort.") + return nil + end + local winid = state.winid or vim.api.nvim_get_current_win() + + -- load padding from config + local padding = config.source_selector.padding + if type(padding) == "number" then + padding = { left = padding, right = padding } + end + width = math.floor(width - padding.left - padding.right) + + -- generate information of each tab (look `get_selector_tab_info` for type hint) + local tabs = {} + local sources = config.source_selector.sources + local active_index = #sources + local length_sum, length_active, length_separators = 0, 0, 0 + for i, source_info in ipairs(sources) do + local is_active = source_info.source == state.name + if is_active then + active_index = i + end + local separator = get_separators( + i, + active_index, + config.source_selector.show_separator_on_edge == false and i == 1, + config.source_selector.show_separator_on_edge == false and i == #sources + ) + local element = get_selector_tab_info(source_info.source, i, is_active, separator) + length_sum = length_sum + element.length + length_separators = length_separators + element.length - element.text_length + if is_active then + length_active = element.length + end + table.insert(tabs, element) + end + + -- start creating string to display + local tabs_layout = config.source_selector.tabs_layout + local content_layout = config.source_selector.content_layout or "center" + local hl_background = config.source_selector.highlight_background + local trunc_char = config.source_selector.truncation_character or "…" + local remaining_width = width - length_separators + local return_string = text_with_hl(add_padding(padding.left), hl_background) + if width < length_sum then -- not enough width + tabs_layout = "equal" -- other methods cannot handle this + end + if tabs_layout == "active" then + local active_tab_length = width - length_sum + length_active - 1 + for _, tab in ipairs(tabs) do + return_string = return_string + .. render_tab( + tab.left, + tab.right, + tab.sep_hl, + text_layout( + tab.text, + tab.is_active and content_layout or nil, + active_tab_length, + trunc_char + ), + tab.tab_hl, + calc_click_id_from_source(winid, tab.index) + ) + .. text_with_hl("", hl_background) + end + elseif tabs_layout == "equal" then + for _, tab in ipairs(tabs) do + return_string = return_string + .. render_tab( + tab.left, + tab.right, + tab.sep_hl, + text_layout(tab.text, content_layout, math.floor(remaining_width / #tabs), trunc_char), + tab.tab_hl, + calc_click_id_from_source(winid, tab.index) + ) + .. text_with_hl("", hl_background) + end + else -- config.source_selector.tab_labels == "start", "end", "center" + -- calculate padding based on tabs_layout + local pad_length = width - length_sum + local left_pad, right_pad = 0, 0 + if pad_length > 0 then + if tabs_layout == "start" then + left_pad, right_pad = 0, pad_length + elseif tabs_layout == "end" then + left_pad, right_pad = pad_length, 0 + elseif tabs_layout == "center" then + left_pad, right_pad = pad_length / 2, math.ceil(pad_length / 2) + end + end + + for i, tab in ipairs(tabs) do + if width == 0 then + break + end + + -- only render trunc_char if there is no space for the tab + local sep_length = tab.length - tab.text_length + if width <= sep_length + 1 then + return_string = return_string + .. text_with_hl(trunc_char .. add_padding(width - 1), hl_background) + width = 0 + break + end + + -- tab_length should not exceed width + local tab_length = width < tab.length and width or tab.length + width = width - tab_length + + -- add padding for first and last tab + local tab_text = tab.text + if i == 1 then + tab_text = add_padding(left_pad) .. tab_text + tab_length = tab_length + left_pad + end + if i == #tabs then + tab_text = tab_text .. add_padding(right_pad) + tab_length = tab_length + right_pad + end + + return_string = return_string + .. render_tab( + tab.left, + tab.right, + tab.sep_hl, + text_layout(tab_text, tabs_layout, tab_length - sep_length, trunc_char), + tab.tab_hl, + calc_click_id_from_source(winid, tab.index) + ) + end + end + return return_string .. "%<%0@v:lua.___neotree_selector_click@" +end + +---set_source_selector: +-- (public): Directly set source_selector to current window's winbar / statusline +---@param state table: state +---@return nil +M.set_source_selector = function(state) + if state.enable_source_selector == false then + return + end + local sel_config = utils.resolve_config_option(require("neo-tree").config, "source_selector", {}) + if sel_config and sel_config.winbar then + vim.wo[state.winid].winbar = "%{%v:lua.require'neo-tree.ui.selector'.get()%}" + end + if sel_config and sel_config.statusline then + vim.wo[state.winid].statusline = "%{%v:lua.require'neo-tree.ui.selector'.get()%}" + end +end + +-- @v:lua@ in the tabline only supports global functions, so this is +-- the only way to add click handlers without autoloaded vimscript functions +_G.___neotree_selector_click = function(id, _, _, _) + if id < 1 then + return + end + local sources = require("neo-tree").config.source_selector.sources + local winid, source_index = calc_source_from_click_id(id) + local state = manager.get_state_for_window(winid) + if state == nil then + log.warn("state not found for window ", winid, "; ignoring click") + return + end + require("neo-tree.command").execute({ + source = sources[source_index].source, + position = state.current_position, + action = "focus", + }) +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/windows.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/windows.lua new file mode 100644 index 00000000..d68323ed --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/ui/windows.lua @@ -0,0 +1,27 @@ +local locations = {} + +local get_location = function(location) + local tab = vim.api.nvim_get_current_tabpage() + if not locations[tab] then + locations[tab] = {} + end + local loc = locations[tab][location] + if loc then + if loc.winid ~= 0 then + -- verify the window before we return it + if not vim.api.nvim_win_is_valid(loc.winid) then + loc.winid = 0 + end + end + return loc + end + loc = { + source = nil, + name = location, + winid = 0, + } + locations[tab][location] = loc + return loc +end + +return { get_location = get_location } diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/utils/filesize/LICENSE b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/utils/filesize/LICENSE new file mode 100644 index 00000000..18580e01 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/utils/filesize/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Boris Nagaev + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/utils/filesize/filesize.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/utils/filesize/filesize.lua new file mode 100644 index 00000000..c5cc7239 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/utils/filesize/filesize.lua @@ -0,0 +1,137 @@ +-- lua-filesize, generate a human readable string describing the file size +-- Copyright (c) 2016 Boris Nagaev +-- See the LICENSE file for terms of use. + +local si = { + bits = {"b", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"}, + bytes = {"B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"}, +} + +local function isNan(num) + -- http://lua-users.org/wiki/InfAndNanComparisons + -- NaN is the only value that doesn't equal itself + return num ~= num +end + +local function roundNumber(num, digits) + local fmt = "%." .. digits .. "f" + return tonumber(fmt:format(num)) +end + +local function filesize(size, options) + + -- copy options to o + local o = {} + for key, value in pairs(options or {}) do + o[key] = value + end + + local function setDefault(name, default) + if o[name] == nil then + o[name] = default + end + end + setDefault("bits", false) + setDefault("unix", false) + setDefault("base", 2) + setDefault("round", o.unix and 1 or 2) + setDefault("spacer", o.unix and "" or " ") + setDefault("suffixes", {}) + setDefault("output", "string") + setDefault("exponent", -1) + + assert(not isNan(size), "Invalid arguments") + + local ceil = (o.base > 2) and 1000 or 1024 + local negative = (size < 0) + if negative then + -- Flipping a negative number to determine the size + size = -size + end + + local result + + -- Zero is now a special case because bytes divide by 1 + if size == 0 then + result = { + 0, + o.unix and "" or (o.bits and "b" or "B"), + } + else + -- Determining the exponent + if o.exponent == -1 or isNan(o.exponent) then + o.exponent = math.floor(math.log(size) / math.log(ceil)) + end + + -- Exceeding supported length, time to reduce & multiply + if o.exponent > 8 then + o.exponent = 8 + end + + local val + if o.base == 2 then + val = size / math.pow(2, o.exponent * 10) + else + val = size / math.pow(1000, o.exponent) + end + + if o.bits then + val = val * 8 + if val > ceil then + val = val / ceil + o.exponent = o.exponent + 1 + end + end + + result = { + roundNumber(val, o.exponent > 0 and o.round or 0), + (o.base == 10 and o.exponent == 1) and + (o.bits and "kb" or "kB") or + (si[o.bits and "bits" or "bytes"][o.exponent + 1]), + } + + if o.unix then + result[2] = result[2]:sub(1, 1) + + if result[2] == "b" or result[2] == "B" then + result ={ + math.floor(result[1]), + "", + } + end + end + + end + + assert(result) + + -- Decorating a 'diff' + if negative then + result[1] = -result[1] + end + + -- Applying custom suffix + result[2] = o.suffixes[result[2]] or result[2] + + -- Applying custom suffix + result[2] = o.suffixes[result[2]] or result[2] + + -- Returning Array, Object, or String (default) + if o.output == "array" then + return result + elseif o.output == "exponent" then + return o.exponent + elseif o.output == "object" then + return { + value = result[1], + suffix = result[2], + } + elseif o.output == "string" then + local value = tostring(result[1]) + value = value:gsub('%.0$', '') + local suffix = result[2] + return value .. o.spacer .. suffix + end +end + +return filesize diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/utils/init.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/utils/init.lua new file mode 100644 index 00000000..5ff54a0e --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/lua/neo-tree/utils/init.lua @@ -0,0 +1,1296 @@ +local vim = vim +local log = require("neo-tree.log") +local filesize = require("neo-tree.utils.filesize.filesize") +local bit = require("bit") +local ffi_available, ffi = pcall(require, "ffi") + +local FILE_ATTRIBUTE_HIDDEN = 0x2 + +if ffi_available then + ffi.cdef([[ + int GetFileAttributesA(const char *path); + ]]) +end + +-- Backwards compatibility +table.pack = table.pack or function(...) + return { n = select("#", ...), ... } +end +table.unpack = table.unpack or unpack + +local M = {} + +local diag_severity_to_string = function(severity) + if severity == vim.diagnostic.severity.ERROR then + return "Error" + elseif severity == vim.diagnostic.severity.WARN then + return "Warn" + elseif severity == vim.diagnostic.severity.INFO then + return "Info" + elseif severity == vim.diagnostic.severity.HINT then + return "Hint" + else + return nil + end +end + +local tracked_functions = {} +---@enum NeotreeDebounceStrategy +M.debounce_strategy = { + CALL_FIRST_AND_LAST = 0, + CALL_LAST_ONLY = 1, +} + +---@enum NeotreeDebounceAction +M.debounce_action = { + START_NORMAL = 0, + START_ASYNC_JOB = 1, + COMPLETE_ASYNC_JOB = 2, +} + +---Part of debounce. Moved out of the function to eliminate memory leaks. +---@param id string Identifier for the debounce group, such as the function name. +---@param frequency_in_ms number Miniumum amount of time between invocations of fn. +---@param strategy NeotreeDebounceStrategy The debounce_strategy to use, determines which calls to fn are not dropped. +---@param action NeotreeDebounceAction? The debounce_action to use, determines how the function is invoked +local function defer_function(id, frequency_in_ms, strategy, action) + tracked_functions[id].in_debounce_period = true + vim.defer_fn(function() + local current_data = tracked_functions[id] + if not current_data then + return + end + if current_data.async_in_progress then + defer_function(id, frequency_in_ms, strategy, action) + return + end + local _fn = current_data.fn + current_data.fn = nil + current_data.in_debounce_period = false + if _fn ~= nil then + M.debounce(id, _fn, frequency_in_ms, strategy, action) + end + end, frequency_in_ms) +end + +---Call fn, but not more than once every x milliseconds. +---@param id string Identifier for the debounce group, such as the function name. +---@param fn function Function to be executed. +---@param frequency_in_ms number Miniumum amount of time between invocations of fn. +---@param strategy NeotreeDebounceStrategy The debounce_strategy to use, determines which calls to fn are not dropped. +---@param action NeotreeDebounceAction? The debounce_action to use, determines how the function is invoked +M.debounce = function(id, fn, frequency_in_ms, strategy, action) + local fn_data = tracked_functions[id] + + if fn_data == nil then + if action == M.debounce_action.COMPLETE_ASYNC_JOB then + -- original call complete and no further requests have been made + return + end + -- first call for this id + fn_data = { + id = id, + in_debounce_period = false, + fn = fn, + frequency_in_ms = frequency_in_ms, + } + tracked_functions[id] = fn_data + if strategy == M.debounce_strategy.CALL_LAST_ONLY then + defer_function(id, frequency_in_ms, strategy, action) + return + end + else + fn_data.fn = fn + fn_data.frequency_in_ms = frequency_in_ms + if action == M.debounce_action.COMPLETE_ASYNC_JOB then + fn_data.async_in_progress = false + return + elseif fn_data.async_in_progress then + defer_function(id, frequency_in_ms, strategy, action) + return + end + end + + if fn_data.in_debounce_period then + -- This id was called recently and can't be executed again yet. + -- Last one in wins. + return + end + + -- Run the requested function normally. + -- Use a pcall to ensure the debounce period is still respected even if + -- this call throws an error. + local success, result = true, nil + fn_data.in_debounce_period = true + if type(fn) == "function" then + success, result = pcall(fn) + end + fn = nil + fn_data.fn = fn + + if not success then + log.error("debounce ", id, " error: ", result) + elseif result and action == M.debounce_action.START_ASYNC_JOB then + -- This can't fire again until the COMPLETE_ASYNC_JOB signal is sent. + fn_data.async_in_progress = true + end + + if strategy == M.debounce_strategy.CALL_LAST_ONLY then + if fn_data.async_in_progress then + defer_function(id, frequency_in_ms, strategy, action) + else + -- We are done with this debounce + tracked_functions[id] = nil + end + else + -- Now schedule the next earliest execution. + -- If there are no calls to run the same function between now + -- and when this deferred executes, nothing will happen. + -- If there are several calls, only the last one in will run. + strategy = M.debounce_strategy.CALL_LAST_ONLY + defer_function(id, frequency_in_ms, strategy, action) + end +end + +--- Returns true if the contents of two tables are equal. +M.tbl_equals = function(table1, table2) + -- same object + if table1 == table2 then + return true + end + + -- not the same type + if type(table1) ~= "table" or type(table2) ~= "table" then + return false + end + + -- If tables are lists, check if they have the same values in the same order + if #table1 ~= #table2 then + return false + end + for i, v in ipairs(table1) do + if table2[i] ~= v then + return false + end + end + + -- Check if the tables have the same key/value pairs + for k, v in pairs(table1) do + if table2[k] ~= v then + return false + end + end + for k, v in pairs(table2) do + if table1[k] ~= v then + return false + end + end + + -- No differences found, tables are equal + return true +end + +M.execute_command = function(cmd) + local result = vim.fn.systemlist(cmd) + + -- An empty result is ok + if vim.v.shell_error ~= 0 or (#result > 0 and vim.startswith(result[1], "fatal:")) then + return false, {} + else + return true, result + end +end + +M.find_buffer_by_name = function(name) + for _, buf in ipairs(vim.api.nvim_list_bufs()) do + local buf_name = vim.api.nvim_buf_get_name(buf) + if buf_name == name then + return buf + end + end + return -1 +end + +---Converts a filesize from libuv.stats into a human readable string with appropriate units. +---@param size any +---@return string +M.human_size = function(size) + local human = filesize(size, { output = "string" }) + ---@cast human string + return human +end + +---Gets non-zero diagnostics counts for each open file and each ancestor directory. +---severity_number and severity_string refer to the highest severity with +---non-zero diagnostics count. +---Entry is nil if all counts are 0 +---@return table table +---{ [file_path] = { +--- severity_number = int, +--- severity_string = string, +--- Error = int or nil, +--- Warn = int or nil, +--- Info = int or nil +--- Hint = int or nil, +--- } or nil } +M.get_diagnostic_counts = function() + local lookup = {} + + for ns, _ in pairs(vim.diagnostic.get_namespaces()) do + for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do + local success, file_name = pcall(vim.api.nvim_buf_get_name, bufnr) + if success then + -- TODO: remove is_disabled check when dropping support for 0.8 + local enabled + if vim.diagnostic.is_enabled then + enabled = vim.diagnostic.is_enabled({ bufnr = bufnr, ns_id = ns }) + elseif vim.diagnostic.is_disabled then + enabled = not vim.diagnostic.is_disabled(bufnr, ns) + else + enabled = true + end + + if enabled then + for severity, _ in ipairs(vim.diagnostic.severity) do + local diagnostics = vim.diagnostic.get(bufnr, { namespace = ns, severity = severity }) + + if #diagnostics > 0 then + local severity_string = diag_severity_to_string(severity) + -- Get or create the entry for this file + local entry = lookup[file_name] + if entry == nil then + entry = { + severity_number = severity, + severity_string = severity_string, + } + lookup[file_name] = entry + end + -- Set the count for this diagnostic type + if severity_string ~= nil then + entry[severity_string] = #diagnostics + end + + -- Set the overall severity to the most severe so far + -- Error = 1, Warn = 2, Info = 3, Hint = 4 + if severity < entry.severity_number then + entry.severity_number = severity + entry.severity_string = severity_string + end + end + end + end + end + end + end + + for file_name, file_entry in pairs(lookup) do + -- Now bubble this status up to the parent directories + local parts = M.split(file_name, M.path_separator) + table.remove(parts) -- pop the last part so we don't override the file's status + M.reduce(parts, "", function(acc, part) + local path = (M.is_windows and acc == "") and part or M.path_join(acc, part) + + if file_entry.severity_number then + if not lookup[path] then + lookup[path] = { + severity_number = file_entry.severity_number, + severity_string = file_entry.severity_string, + } + else -- lookup[path].severity_number ~= nil + local min_severity = math.min(lookup[path].severity_number, file_entry.severity_number) + lookup[path].severity_number = min_severity + lookup[path].severity_string = diag_severity_to_string(min_severity) + end + end + + return path + end) + end + return lookup +end + +--- DEPRECATED: This will be removed in v3. Use `get_opened_buffers` instead. +---Gets a lookup of all open buffers keyed by path with the modifed flag as the value +---@return table opened_buffers { [buffer_name] = bool } +M.get_modified_buffers = function() + local opened_buffers = M.get_opened_buffers() + for bufname, bufinfo in pairs(opened_buffers) do + opened_buffers[bufname] = bufinfo.modified + end + return opened_buffers +end + +---Gets a lookup of all open buffers keyed by path with additional information +---@return table opened_buffers { [buffer_name] = { modified = bool } } +M.get_opened_buffers = function() + local opened_buffers = {} + for _, buffer in ipairs(vim.api.nvim_list_bufs()) do + if vim.fn.buflisted(buffer) ~= 0 then + local buffer_name = vim.api.nvim_buf_get_name(buffer) + if buffer_name == nil or buffer_name == "" then + buffer_name = "[No Name]#" .. buffer + end + opened_buffers[buffer_name] = { + ["modified"] = vim.api.nvim_buf_get_option(buffer, "modified"), + ["loaded"] = vim.api.nvim_buf_is_loaded(buffer), + } + end + end + return opened_buffers +end + +---Resolves some variable to a string. The object can be either a string or a +--function that returns a string. +---@param functionOrString any The object to resolve. +---@param node table The current node, which is passed to the function if it is a function. +---@param state any The current state, which is passed to the function if it is a function. +---@return string string The resolved string. +M.getStringValue = function(functionOrString, node, state) + if type(functionOrString) == "function" then + return functionOrString(node, state) + else + return functionOrString + end +end + +---Return the keys of a given table. +---@param tbl table The table to get the keys of. +---@param sorted boolean Whether to sort the keys. +---@return table table The keys of the table. +M.get_keys = function(tbl, sorted) + local keys = {} + for k, _ in pairs(tbl) do + table.insert(keys, k) + end + if sorted then + table.sort(keys) + end + return keys +end + +---Gets the usable columns in a window, subtracting sign, fold, and line number columns. +---@param winid integer The window id to get the columns of. +---@return number +M.get_inner_win_width = function(winid) + local info = vim.fn.getwininfo(winid) + if info and info[1] then + return info[1].width - info[1].textoff + else + log.error("Could not get window info for window", winid) + end +end + +local stat_providers = { + default = function(node) + return vim.loop.fs_stat(node.path) + end, +} + +--- Gets the statics for a node in the file system. The `stat` object will be cached +--- for the lifetime of the node. +--- +---@param node table The Nui TreeNode node to get the stats for. +---@return StatTable | table +--- +---@class StatTime +--- @field sec number +--- +---@class StatTable +--- @field birthtime StatTime +--- @field mtime StatTime +--- @field size number +M.get_stat = function(node) + if node.stat == nil then + local provider = stat_providers[node.stat_provider or "default"] + local success, stat = pcall(provider, node) + node.stat = success and stat or {} + end + return node.stat +end + +---Register a function to provide stats for a node. +---@param name string The name of the stat provider. +---@param func function The function to call to get the stats. +M.register_stat_provider = function(name, func) + stat_providers[name] = func + log.debug("Registered stat provider", name) +end + +---Handles null coalescing into a table at any depth. +---@param sourceObject table The table to get a vlue from. +---@param valuePath string The path to the value to get. +---@param defaultValue any|nil The default value to return if the value is nil. +---@param strict_type_check boolean? Whether to require the type of the value is +---the same as the default value. +---@return any value The value at the path or the default value. +M.get_value = function(sourceObject, valuePath, defaultValue, strict_type_check) + if sourceObject == nil then + return defaultValue + end + local pathParts = M.split(valuePath, ".") + local currentTable = sourceObject + for _, part in ipairs(pathParts) do + if currentTable[part] == nil then + return defaultValue + else + currentTable = currentTable[part] + end + end + + if currentTable ~= nil then + return currentTable + end + if strict_type_check then + if type(defaultValue) == type(currentTable) then + return currentTable + else + return defaultValue + end + end +end + +---Sets a value at a path in a table, creating any missing tables along the way. +---@param sourceObject table The table to set a value in. +---@param valuePath string The path to the value to set. +---@param value any The value to set. +M.set_value = function(sourceObject, valuePath, value) + local pathParts = M.split(valuePath, ".") + local currentTable = sourceObject + for i, part in ipairs(pathParts) do + if i == #pathParts then + currentTable[part] = value + else + if type(currentTable[part]) ~= "table" then + currentTable[part] = {} + end + currentTable = currentTable[part] + end + end +end + +---Groups an array of items by a key. +---@param array table The array to group. +---@param key string The key to group by. +---@return table table The grouped array where the keys are the unique values of the specified key. +M.group_by = function(array, key) + local result = {} + for _, item in ipairs(array) do + local keyValue = item[key] + local group = result[keyValue] + if group == nil then + group = {} + result[keyValue] = group + end + table.insert(group, item) + end + return result +end + +---Determines if a file should be filtered by a given list of glob patterns. +---@param pattern_list table The list of glob patterns to filter by. +---@param path string The full path to the file. +---@param name string|nil The name of the file. +---@return boolean +M.is_filtered_by_pattern = function(pattern_list, path, name) + if pattern_list == nil then + return false + end + if name == nil then + _, name = M.split_path(path) + end + for _, p in ipairs(pattern_list) do + local separator_pattern = M.is_windows and "\\" or "/" + local filename = string.find(p, separator_pattern) and path or name + if string.find(filename, p) then + return true + end + end + return false +end + +M.is_floating = function(win_id) + win_id = win_id or vim.api.nvim_get_current_win() + local cfg = vim.api.nvim_win_get_config(win_id) + if cfg.relative > "" or cfg.external then + return true + end + return false +end + +M.is_winfixbuf = function(win_id) + if vim.fn.exists("&winfixbuf") == 1 then + win_id = win_id or vim.api.nvim_get_current_win() + return vim.api.nvim_get_option_value("winfixbuf", { win = win_id }) + end + return false +end + +---Evaluates the value of , which comes from an autocmd event, and determines if it +---is a valid file or some sort of utility buffer like quickfix or neo-tree itself. +---@param afile string The path or relative path to the file. +---@param true_for_terminals boolean? Whether to return true for terminals, normally it would be false. +---@return boolean boolean Whether the buffer is a real file. +M.is_real_file = function(afile, true_for_terminals) + if type(afile) ~= "string" or afile == "" or afile == "quickfix" then + return false + end + + local source = afile:match("^neo%-tree ([%l%-]+) %[%d+%]") + if source then + return false + end + + local success, bufnr = pcall(vim.fn.bufnr, afile) + if success and bufnr > 0 then + local buftype = vim.api.nvim_buf_get_option(bufnr, "buftype") + + if true_for_terminals and buftype == "terminal" then + return true + end + -- all other buftypes are not real files + if M.truthy(buftype) then + return false + end + return true + else + return false + end +end + +---Creates a new table from an array with the array items as keys. If a dict like +---table is passed in, those keys will be copied to a new table. +---@param tbl table The table to copy items from. +---@return table table A new dictionary style table. +M.list_to_dict = function(tbl) + local dict = {} + -- leave the existing keys + for key, val in pairs(tbl) do + dict[key] = val + end + -- and convert the number indexed items + for _, item in ipairs(tbl) do + dict[item] = true + end + return dict +end + +M.map = function(tbl, fn) + local t = {} + for k, v in pairs(tbl) do + t[k] = fn(v) + end + return t +end + +M.get_appropriate_window = function(state, ignore_winfixbuf) + -- Avoid triggering autocommands when switching windows + local eventignore = vim.o.eventignore + vim.o.eventignore = "all" + + local current_window = vim.api.nvim_get_current_win() + + -- use last window if possible + local suitable_window_found = false + local nt = require("neo-tree") + local ignore_ft = nt.config.open_files_do_not_replace_types + local ignore = M.list_to_dict(ignore_ft) + ignore["neo-tree"] = true + if nt.config.open_files_in_last_window then + local prior_window = nt.get_prior_window(ignore, ignore_winfixbuf) + if prior_window > 0 then + local success = pcall(vim.api.nvim_set_current_win, prior_window) + if success then + suitable_window_found = true + end + end + end + -- find a suitable window to open the file in + if not suitable_window_found then + if state.current_position == "right" then + vim.cmd("wincmd t") + else + vim.cmd("wincmd w") + end + end + local attempts = 0 + while attempts < 5 and not suitable_window_found do + local bt = vim.bo.buftype or "normal" + if ignore[vim.bo.filetype] or ignore[bt] or M.is_floating() then + attempts = attempts + 1 + vim.cmd("wincmd w") + elseif ignore_winfixbuf and M.is_winfixbuf() then + attempts = attempts + 1 + vim.cmd("wincmd w") + else + suitable_window_found = true + end + end + if not suitable_window_found then + -- go back to the neotree window, this will forve it to open a new split + vim.api.nvim_set_current_win(current_window) + end + + local winid = vim.api.nvim_get_current_win() + local is_neo_tree_window = vim.bo.filetype == "neo-tree" + vim.api.nvim_set_current_win(current_window) + + vim.o.eventignore = eventignore + + return winid, is_neo_tree_window +end + +---Resolves the width to a number +---@param width number|string|function +M.resolve_width = function(width) + local default_width = 40 + local available_width = vim.o.columns + if type(width) == "string" then + if string.sub(width, -1) == "%" then + width = tonumber(string.sub(width, 1, #width - 1)) / 100 + width = width * available_width + else + width = tonumber(width) + end + elseif type(width) == "function" then + width = width() + end + + if type(width) ~= "number" then + width = default_width + end + + return math.floor(width) +end + +M.force_new_split = function(current_position, escaped_path) + local result, err + local split_command = "vsplit" + -- respect window position in user config when Neo-tree is the only window + if current_position == "left" then + split_command = "rightbelow vs" + elseif current_position == "right" then + split_command = "leftabove vs" + end + if escaped_path == M.escape_path_for_cmd("[No Name]") then + -- vim's default behavior is to overwrite [No Name] buffers. + -- We need to split first and then open the path to workaround this behavior. + result, err = pcall(vim.cmd, split_command) + if result then + vim.cmd.edit(escaped_path) + end + else + result, err = pcall(vim.cmd, split_command .. " " .. escaped_path) + end + return result, err +end + +---Open file in the appropriate window. +---@param state table The state of the source +---@param path string The file to open +---@param open_cmd string? The vimcommand to use to open the file +---@param bufnr number|nil The buffer number to open +M.open_file = function(state, path, open_cmd, bufnr) + open_cmd = open_cmd or "edit" + -- If the file is already open, switch to it. + bufnr = bufnr or M.find_buffer_by_name(path) + if bufnr <= 0 then + bufnr = nil + else + local buf_cmd_lookup = + { edit = "b", e = "b", split = "sb", sp = "sb", vsplit = "vert sb", vs = "vert sb" } + local cmd_for_buf = buf_cmd_lookup[open_cmd] + if cmd_for_buf then + open_cmd = cmd_for_buf + else + bufnr = nil + end + end + + if M.truthy(path) then + local escaped_path = M.escape_path_for_cmd(path) + local bufnr_or_path = bufnr or escaped_path + local events = require("neo-tree.events") + local result = true + local err = nil + local event_result = events.fire_event(events.FILE_OPEN_REQUESTED, { + state = state, + path = path, + open_cmd = open_cmd, + bufnr = bufnr, + }) or {} + if event_result.handled then + events.fire_event(events.FILE_OPENED, path) + return + end + if state.current_position == "current" then + result, err = pcall(vim.cmd, open_cmd .. " " .. bufnr_or_path) + else + local winid, is_neo_tree_window = M.get_appropriate_window(state) + vim.api.nvim_set_current_win(winid) + -- TODO: make this configurable, see issue #43 + if is_neo_tree_window then + local width = vim.api.nvim_win_get_width(0) + if width == vim.o.columns then + -- Neo-tree must be the only window, restore it's status as a sidebar + width = M.get_value(state, "window.width", 40, false) + width = M.resolve_width(width) + end + result, err = M.force_new_split(state.current_position, escaped_path) + vim.api.nvim_win_set_width(winid, width) + else + result, err = pcall(vim.cmd, open_cmd .. " " .. bufnr_or_path) + end + end + if not result and string.find(err or "", "winfixbuf") and M.is_winfixbuf() then + local winid, is_neo_tree_window = M.get_appropriate_window(state, true) + -- Rescan window list to find a window that is not winfixbuf. + -- If found, retry executing command in that window, + -- otherwise, all windows are either neo-tree or winfixbuf so we make a new split. + if not is_neo_tree_window and not M.is_winfixbuf(winid) then + vim.api.nvim_set_current_win(winid) + result, err = pcall(vim.cmd, open_cmd .. " " .. bufnr_or_path) + else + result, err = M.force_new_split(state.current_position, escaped_path) + end + end + if result or err == "Vim(edit):E325: ATTENTION" then + -- fixes #321 + vim.api.nvim_buf_set_option(0, "buflisted", true) + events.fire_event(events.FILE_OPENED, path) + else + log.error("Error opening file:", err) + end + end +end + +M.reduce = function(list, memo, func) + for _, i in ipairs(list) do + memo = func(memo, i) + end + return memo +end + +M.reverse_list = function(list) + local result = {} + for i = #list, 1, -1 do + table.insert(result, list[i]) + end + return result +end + +M.resolve_config_option = function(state, config_option, default_value) + local opt = M.get_value(state, config_option, default_value, false) + if type(opt) == "function" then + local success, val = pcall(opt, state) + if success then + return val + else + log.error("Error resolving config option: " .. config_option .. ": " .. val) + return default_value + end + else + return opt + end +end + +---Normalize a path, to avoid errors when comparing paths. +---@param path string The path to be normalize. +---@return string string The normalized path. +M.normalize_path = function(path) + if M.is_windows then + -- normalize the drive letter to uppercase + path = path:sub(1, 1):upper() .. path:sub(2) + -- Turn mixed forward and back slashes into all forward slashes + -- using NeoVim's logic + path = vim.fs.normalize(path) + -- Now use backslashes, as expected by the rest of Neo-Tree's code + path = path:gsub("/", M.path_separator) + end + return path +end + +---Check if a path is a subpath of another. +--@param base string The base path. +--@param path string The path to check is a subpath. +--@return boolean boolean True if it is a subpath, false otherwise. +M.is_subpath = function(base, path) + if not M.truthy(base) or not M.truthy(path) then + return false + elseif base == path then + return true + end + base = M.normalize_path(base) + path = M.normalize_path(path) + return string.sub(path, 1, string.len(base)) == base +end + +---The file system path separator for the current platform. +M.path_separator = "/" +M.is_windows = vim.fn.has("win32") == 1 or vim.fn.has("win32unix") == 1 +if M.is_windows == true then + M.path_separator = "\\" +end + +---Remove the path separator from the end of a path in a cross-platform way. +---@param path string The path to remove the separator from. +---@return string string The path without any trailing separator. +---@return number count The number of separators removed. +M.remove_trailing_slash = function(path) + if M.is_windows then + return path:gsub("\\$", "") + else + return path:gsub("/$", "") + end +end + +---Sorts a list of paths in the order they would appear in a tree. +---@param paths table The list of paths to sort. +---@return table table The sorted list of paths. +M.sort_by_tree_display = function(paths) + -- first turn the paths into a true tree + local nodes = {} + local index = {} + local function create_nodes(path) + local node = index[path] + if node then + return node + end + local parent, name = M.split_path(path) + node = { + name = name, + path = path, + children = {}, + } + index[path] = node + if parent == nil then + table.insert(nodes, node) + else + local parent_node = index[parent] + if parent_node == nil then + parent_node = create_nodes(parent) + end + table.insert(parent_node.children, node) + end + return node + end + + for _, path in ipairs(paths) do + create_nodes(path) + end + + -- create a lookup of the original paths so that we don't return anything + -- that isn't in the original list + local original_paths = M.list_to_dict(paths) + + -- sort folders before files + local sort_by_name = function(a, b) + local a_isdir = #a.children > 0 + local b_isdir = #b.children > 0 + if a_isdir and not b_isdir then + return true + elseif not a_isdir and b_isdir then + return false + else + return a.name < b.name + end + end + + -- now we can walk the tree in the order that it would be displayed on the screen + local result = {} + local function walk_tree(node) + if original_paths[node.path] then + table.insert(result, node.path) + original_paths[node.path] = nil -- just to be sure we don't return it twice + end + table.sort(node.children, sort_by_name) + for _, child in ipairs(node.children) do + walk_tree(child) + end + end + + walk_tree({ children = nodes }) + return result +end + +---Split string into a table of strings using a separator. +---@param inputString string The string to split. +---@param sep string The separator to use. +---@return table table A table of strings. +M.split = function(inputString, sep) + local fields = {} + + local pattern = string.format("([^%s]+)", sep) + local _ = string.gsub(inputString, pattern, function(c) + fields[#fields + 1] = c + end) + + return fields +end + +---Split a path into a parentPath and a name. +---@param path string The path to split. +---@return string|nil parentPath +---@return string|nil name +M.split_path = function(path) + if not path then + return nil, nil + end + if path == M.path_separator then + return nil, M.path_separator + end + local parts = M.split(path, M.path_separator) + local name = table.remove(parts) + local parentPath = table.concat(parts, M.path_separator) + if M.is_windows then + if #parts == 1 then + parentPath = parentPath .. M.path_separator + elseif parentPath == "" then + return nil, name + end + else + parentPath = M.path_separator .. parentPath + end + return parentPath, name +end + +---Joins arbitrary number of paths together. +---@param ... string The paths to join. +---@return string +M.path_join = function(...) + local args = { ... } + if #args == 0 then + return "" + end + + local all_parts = {} + if type(args[1]) == "string" and args[1]:sub(1, 1) == M.path_separator then + all_parts[1] = "" + end + + for _, arg in ipairs(args) do + if arg == "" and #all_parts == 0 and not M.is_windows then + all_parts = { "" } + else + local arg_parts = M.split(arg, M.path_separator) + vim.list_extend(all_parts, arg_parts) + end + end + return table.concat(all_parts, M.path_separator) +end + +local table_merge_internal +---Merges overrideTable into baseTable. This mutates baseTable. +---@param base_table table The base table that provides default values. +---@param override_table table The table to override the base table with. +---@return table table The merged table. +table_merge_internal = function(base_table, override_table) + for k, v in pairs(override_table) do + if type(v) == "table" then + if type(base_table[k]) == "table" then + table_merge_internal(base_table[k], v) + else + base_table[k] = v + end + else + base_table[k] = v + end + end + return base_table +end + +---DEPRECATED: Use vim.deepcopy(source_table, { noref = 1 }) instead. +M.table_copy = function(source_table) + return vim.deepcopy(source_table, { noref = 1 }) +end + +---DEPRECATED: Use vim.tbl_deep_extend("force", base_table, source_table) instead. +M.table_merge = function(base_table, override_table) + local merged_table = table_merge_internal({}, base_table) + return table_merge_internal(merged_table, override_table) +end + +---Evaluate the truthiness of a value, according to js/python rules. +---@param value any +---@return boolean +M.truthy = function(value) + if value == nil then + return false + end + if type(value) == "boolean" then + return value + end + if type(value) == "string" then + return value > "" + end + if type(value) == "number" then + return value > 0 + end + if type(value) == "table" then + return #vim.tbl_values(value) > 0 + end + return true +end + +M.is_expandable = function(node) + return node.type == "directory" or node:has_children() +end + +M.windowize_path = function(path) + return path:gsub("/", "\\") +end + +---Escapes a path primarily relying on `vim.fn.fnameescape`. This function should +---only be used when preparing a path to be used in a vim command, such as `:e`. +--- +---For Windows systems, this function handles punctuation characters that will +---be escaped, but may appear at the beginning of a path segment. For example, +---the path `C:\foo\(bar)\baz.txt` (where foo, (bar), and baz.txt are segments) +---will remain unchanged when escaped by `fnaemescape` on a Windows system. +---However, if that string is used to edit a file with `:e`, `:b`, etc., the open +---parenthesis will be treated as an escaped character and the path separator will +---be lost. +--- +---For more details, see issue #889 when this function was introduced, and further +---discussions in #1264, #1352, and #1448. +---@param path string +---@return string +M.escape_path_for_cmd = function(path) + local escaped_path = vim.fn.fnameescape(path) + if M.is_windows then + -- there is too much history to this logic to capture in a reasonable comment. + -- essentially, the following logic adds a number of `\` depending on the leading + -- character in a path segment. see #1264, #1352, and #1448 for more info. + local need_extra_esc = path:find("[%[%]`%$~]") + local esc = need_extra_esc and "\\\\" or "\\" + escaped_path = escaped_path:gsub("\\[%(%)%^&;]", esc .. "%1") + if need_extra_esc then + escaped_path = escaped_path:gsub("\\\\['` ]", "\\%1") + end + end + return escaped_path +end + +M.wrap = function(func, ...) + if type(func) ~= "function" then + error("Expected function, got " .. type(func)) + end + local wrapped_args = { ... } + return function(...) + local all_args = table.pack(table.unpack(wrapped_args), ...) + func(table.unpack(all_args)) + end +end + +---Checks if the given path is hidden using the Windows hidden file/directory logic +---@param path string +---@return boolean +function M.is_hidden(path) + if ffi_available and M.is_windows then + return bit.band(ffi.C.GetFileAttributesA(path), FILE_ATTRIBUTE_HIDDEN) ~= 0 + else + return false + end +end + +---Returns a new list that is the result of dedeuplicating a list. +---@param list table The list to deduplicate. +---@return table table The list of unique values. +M.unique = function(list) + local seen = {} + local result = {} + for _, item in ipairs(list) do + if not seen[item] then + table.insert(result, item) + seen[item] = true + end + end + return result +end + +---Splits string by sep on first occurrence. brace_expand_split("a,b,c", ",") -> { "a", "b,c" }. nil if separator not found. +---@param s string: input string +---@param separator string: separator +---@return string, string | nil +local brace_expand_split = function(s, separator) + local pos = 1 + local depth = 0 + while pos <= s:len() do + local c = s:sub(pos, pos) + if c == "\\" then + pos = pos + 1 + elseif c == separator and depth == 0 then + return s:sub(1, pos - 1), s:sub(pos + 1) + elseif c == "{" then + depth = depth + 1 + elseif c == "}" then + if depth > 0 then + depth = depth - 1 + end + end + pos = pos + 1 + end + return s, nil +end + +---Perform brace expansion on a string and return the sequence of the results +---@param s string?: input string which is inside braces, if nil return { "" } +---@return string[] | nil: list of strings each representing the individual expanded strings +local brace_expand_contents = function(s) + if s == nil then -- no closing brace "}" + return { "" } + elseif s == "" then -- brace with no content "{}" + return { "{}" } + end + + ---Generate a sequence from from..to..step and apply `func` + ---@param from string | number: initial value + ---@param to string | number: end value + ---@param step string | number: step value + ---@param func fun(i: number): string | nil function(string | number) -> string | nil: function applied to all values in sequence. if return is nil, the value will be ignored. + ---@return string[]: generated string list + ---@private + local function resolve_sequence(from, to, step, func) + local f, t = tonumber(from), tonumber(to) + local st = (t < f and -1 or 1) * math.abs(tonumber(step) or 1) -- reverse (negative) step if t < f + ---@type string[] + local items = {} + for i = f, t, st do + local r = func(i) + if r ~= nil then + table.insert(items, r) + end + end + return items + end + + ---If pattern matches the input string `s`, apply an expansion by `resolve_func` + ---@param pattern string: regex to match on `s` + ---@param resolve_func fun(from: string, to: string, step: string): string[] + ---@return string[] | nil: expanded sequence or nil if failed + local function try_sequence_on_pattern(pattern, resolve_func) + local from, to, step = string.match(s, pattern) + if from then + return resolve_func(from, to, step) + end + return nil + end + + ---Process numeric sequence expression. e.g. {0..2} -> {0,1,2}, {01..05..2} -> {01,03,05} + local resolve_sequence_num = function(from, to, step) + local format = "%d" + -- Pad strings in the presence of a leading zero + local pattern = "^-?0%d" + if from:match(pattern) or to:match(pattern) then + format = "%0" .. math.max(#from, #to) .. "d" + end + return resolve_sequence(from, to, step, function(i) + return string.format(format, i) + end) + end + + ---Process alphabet sequence expression. e.g. {a..c} -> {a,b,c}, {a..e..2} -> {a,c,e} + local resolve_sequence_char = function(from, to, step) + return resolve_sequence(from:byte(), to:byte(), step, function(i) + return i ~= 92 and string.char(i) or nil -- 92 == '\\' is ignored in bash + end) + end + + local check_list = { + { [=[^(-?%d+)%.%.(-?%d+)%.%.(-?%d+)$]=], resolve_sequence_num }, + { [=[^(-?%d+)%.%.(-?%d+)$]=], resolve_sequence_num }, + { [=[^(%a)%.%.(%a)%.%.(-?%d+)$]=], resolve_sequence_char }, + { [=[^(%a)%.%.(%a)$]=], resolve_sequence_char }, + } + for _, list in ipairs(check_list) do + local regex, func = table.unpack(list) + local sequence = try_sequence_on_pattern(regex, func) + if sequence then + return sequence + end + end + + -- Regular `,` separated expression. x{a,b,c} -> {xa,xb,xc} + local items, tmp_s = {}, nil + tmp_s = s + while tmp_s ~= nil do + items[#items + 1], tmp_s = brace_expand_split(tmp_s, ",") + end + if #items == 1 then -- Only one expansion found. Abort. + return nil + end + return vim.tbl_flatten(items) +end + +---brace_expand: +-- Perform a BASH style brace expansion to generate arbitrary strings. +-- Especially useful for specifying structured file / dir names. +-- USAGE: +-- - `require("neo-tree.utils").brace_expand("x{a..e..2}")` -> `{ "xa", "xc", "xe" }` +-- - `require("neo-tree.utils").brace_expand("file.txt{,.bak}")` -> `{ "file.txt", "file.txt.bak" }` +-- - `require("neo-tree.utils").brace_expand("./{a,b}/{00..02}.lua")` -> `{ "./a/00.lua", "./a/01.lua", "./a/02.lua", "./b/00.lua", "./b/01.lua", "./b/02.lua" }` +-- More examples for BASH style brace expansion can be found here: https://facelessuser.github.io/bracex/ +---@param s string: input string. e.g. {a..e..2} -> {a,c,e}, {00..05..2} -> {00,03,05} +---@return string[]: result of expansion, array with at least one string (one means it failed to expand and the raw string is returned) +M.brace_expand = function(s) + local preamble, postamble = brace_expand_split(s, "{") + if postamble == nil then + return { s } + end + + local expr, postscript, contents = nil, nil, nil + postscript = postamble + while contents == nil do + local old_expr = expr + expr, postscript = brace_expand_split(postscript, "}") + if old_expr then + expr = old_expr .. "}" .. expr + end + if postscript == nil then -- No closing brace found, so we put back the unmatched '{' + preamble = preamble .. "{" + expr, postscript = nil, postamble + end + contents = brace_expand_contents(expr) + end + + -- Concat everything. Pass postscript recursively. + ---@type string[] + local result = {} + for _, item in ipairs(contents) do + for _, suffix in ipairs(M.brace_expand(postscript)) do + result[#result + 1] = table.concat({ preamble, item, suffix }) + end + end + return result +end + +---Indexes a table that uses paths as keys. Case-insensitive logic is used when +---running on Windows. +--- +---Consideration should be taken before using this function, because it is a +---bit expensive on Windows. However, this function helps when trying to index +---with absolute path keys, which can have inconsistent casing on Windows (such +---as with drive letters). +---@param tbl table +---@param key string +---@return unknown +M.index_by_path = function(tbl, key) + local value = tbl[key] + if value ~= nil then + return value + end + + -- on windows, paths that differ only by case are considered equal + -- TODO: we should optimize this, see discussion in #1353 + if M.is_windows then + local key_lower = key:lower() + for k, v in pairs(tbl) do + if key_lower == k:lower() then + return v + end + end + end + + return value +end + +return M diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/plugin/neo-tree.vim b/config/neovim/store/lazy-plugins/neo-tree.nvim/plugin/neo-tree.vim new file mode 100644 index 00000000..24666d48 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/plugin/neo-tree.vim @@ -0,0 +1,8 @@ +if exists('g:loaded_neo_tree') + finish +endif + +command! -nargs=* -complete=custom,v:lua.require'neo-tree.command'.complete_args + \ Neotree lua require("neo-tree.command")._command() + +let g:loaded_neo_tree = 1 diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/release.sh b/config/neovim/store/lazy-plugins/neo-tree.nvim/release.sh new file mode 100755 index 00000000..a6fbdff4 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/release.sh @@ -0,0 +1,38 @@ +#/bin/bash +REPO="nvim-neo-tree/neo-tree.nvim" +LAST_VERSION=$(curl --silent "https://api.github.com/repos/$REPO/releases/latest" | jq -r .tag_name) +echo "LAST_VERSION=$LAST_VERSION" +MAJOR=$(cut -d. -f1 <<<"$LAST_VERSION") +MINOR=$(cut -d. -f2 <<<"$LAST_VERSION") +echo + +RELEASE_BRANCH="${1:-v${MAJOR}.x}" +echo "RELEASE_BRANCH=$RELEASE_BRANCH" +NEXT_VERSION=$MAJOR.$((MINOR+1)) +NEW_VERSION="${2:-${NEXT_VERSION}}" +echo "NEW_VERSION=$NEW_VERSION" +echo + +read -p "Are you sure you want to publish this release? " -n 1 -r +echo # (optional) move to a new line +if [[ ! $REPLY =~ ^[Yy]$ ]] +then + [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # handle exits from shell or function but don't exit interactive shell +fi + +git fetch +git checkout main +git pull +echo "Merging to ${RELEASE_BRANCH}" +git checkout $RELEASE_BRANCH +git pull +if git merge --ff-only origin/main; then + git push + git tag -a $NEW_VERSION -m "Release ${NEW_VERSION}" + git push origin $NEW_VERSION + echo "Creating Release" + gh release create $NEW_VERSION --generate-notes +else + echo "RELEASE FAILED! Could not fast-forward release to $RELEASE_BRANCH" +fi +git checkout main diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/scripts/test.sh b/config/neovim/store/lazy-plugins/neo-tree.nvim/scripts/test.sh new file mode 100755 index 00000000..3e662e93 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/scripts/test.sh @@ -0,0 +1,85 @@ +#!/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/bash + +set -euo pipefail + +luacov_dir="" + +while [[ $# -gt 0 ]]; do + case "${1}" in + --clean) + shift + echo "[test] cleaning up environment" + rm -rf ./.testcache + echo "[test] envionment cleaned" + ;; + *) + shift + ;; + esac +done + +function setup_environment() { + echo + echo "[test] setting up environment" + echo + + local plugins_dir="./.testcache/site/pack/vendor/start" + if [[ ! -d "${plugins_dir}" ]]; then + mkdir -p "${plugins_dir}" + fi + + if [[ ! -d "${plugins_dir}/nui.nvim" ]]; then + echo "[plugins] nui.nvim: installing..." + git clone https://github.com/MunifTanjim/nui.nvim "${plugins_dir}/nui.nvim" + echo "[plugins] nui.nvim: installed" + echo + fi + + if [[ ! -d "${plugins_dir}/nvim-web-devicons" ]]; then + echo "[plugins] nvim-web-devicons: installing..." + git clone https://github.com/nvim-tree/nvim-web-devicons "${plugins_dir}/nvim-web-devicons" + echo "[plugins] nvim-web-devicons: installed" + echo + fi + + if [[ ! -d "${plugins_dir}/plenary.nvim" ]]; then + echo "[plugins] plenary.nvim: installing..." + git clone https://github.com/nvim-lua/plenary.nvim "${plugins_dir}/plenary.nvim" + # this commit broke luacov + #git -C "${plugins_dir}/plenary.nvim" revert --no-commit 9069d14a120cadb4f6825f76821533f2babcab92 + echo "[plugins] plenary.nvim: installed" + echo + fi + + echo "[test] environment ready" + echo +} + +function luacov_start() { + luacov_dir="$(dirname "$(luarocks which luacov 2>/dev/null | head -1)")" + if [[ "${luacov_dir}" == "." ]]; then + luacov_dir="" + fi + + if test -n "${luacov_dir}"; then + rm -f luacov.*.out + export LUA_PATH=";;${luacov_dir}/?.lua" + fi +} + +function luacov_end() { + if test -n "${luacov_dir}"; then + luacov + + echo + tail -n +$(($(grep -n "^Summary$" luacov.report.out | cut -d":" -f1) - 1)) luacov.report.out + fi +} + +setup_environment + +#luacov_start + +make test + +#luacov_end diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/mininit.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/mininit.lua new file mode 100644 index 00000000..f5239da4 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/mininit.lua @@ -0,0 +1,30 @@ +-- Need the absolute path as when doing the testing we will issue things like `tcd` to change directory +-- to where our temporary filesystem lives +local root_dir = vim.fn.fnamemodify(vim.trim(vim.fn.system("git rev-parse --show-toplevel")), ":p") + +package.path = string.format("%s;%s?.lua;%s?/init.lua", package.path, root_dir, root_dir) + +vim.opt.packpath:prepend(string.format("%s", root_dir .. ".testcache/site")) + +vim.opt.rtp = { + root_dir, + vim.env.VIMRUNTIME, +} + +vim.cmd([[ + filetype on + packadd plenary.nvim + packadd nui.nvim + packadd nvim-web-devicons +]]) + +vim.opt.swapfile = false + +vim.cmd([[ + runtime plugin/neo-tree.vim +]]) + +-- For debugging +P = function(...) + print(unpack(vim.tbl_map(vim.inspect, { ... }))) +end diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/command/command_current_spec.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/command/command_current_spec.lua new file mode 100644 index 00000000..e5329886 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/command/command_current_spec.lua @@ -0,0 +1,107 @@ +pcall(require, "luacov") + +local Path = require("plenary.path") +local u = require("tests.utils") +local verify = require("tests.utils.verify") + +local run_in_current_command = function(command, expected_tree_node) + local winid = vim.api.nvim_get_current_win() + + vim.cmd(command) + verify.window_handle_is(winid) + verify.buf_name_endswith(string.format("neo-tree filesystem [%s]", winid), 1000) + if expected_tree_node then + verify.filesystem_tree_node_is(expected_tree_node, winid) + end +end + +local run_close_command = function(command) + vim.cmd(command) + u.wait_for(function() end, { interval = 200, timeout = 200 }) +end + +describe("Command", function() + local test = u.fs.init_test({ + items = { + { + name = "foo", + type = "dir", + items = { + { + name = "bar", + type = "dir", + items = { + { name = "baz1.txt", type = "file" }, + { name = "baz2.txt", type = "file", id = "deepfile2" }, + }, + }, + }, + }, + { name = "topfile1.txt", type = "file", id = "topfile1" }, + { name = "topfile2.txt", type = "file", id = "topfile2" }, + }, + }) + + test.setup() + + local fs_tree = test.fs_tree + + after_each(function() + u.clear_environment() + end) + + describe("netrw style:", function() + it("`:Neotree current` should show neo-tree in current window", function() + local cmd = "Neotree current" + run_in_current_command(cmd) + end) + + it( + "`:Neotree current reveal` should show neo-tree and reveal file in current window", + function() + local cmd = "Neotree current reveal" + local testfile = fs_tree.lookup["topfile1"].abspath + u.editfile(testfile) + run_in_current_command(cmd, testfile) + end + ) + + it("`:Neotree current reveal toggle` should toggle neo-tree in current window", function() + local cmd = "Neotree current reveal toggle" + local testfile = fs_tree.lookup["topfile1"].abspath + u.editfile(testfile) + local tree_winid = vim.api.nvim_get_current_win() + + -- toggle OPEN + run_in_current_command(cmd, testfile) + + -- toggle CLOSE + run_close_command(cmd) + verify.window_handle_is(tree_winid) + verify.buf_name_is(testfile) + end) + + it( + "`:Neotree current reveal_force_cwd reveal_file=xyz` should reveal file current window if cwd is not a parent of file", + function() + vim.cmd("cd ~") + local testfile = fs_tree.lookup["deepfile2"].abspath + local cmd = "Neotree current reveal_force_cwd reveal_file=" .. testfile + run_in_current_command(cmd, testfile) + end + ) + + it( + "`:Neotree current reveal_force_cwd reveal_file=xyz` should reveal file current window if cwd is a parent of file", + function() + local testfile = fs_tree.lookup["deepfile2"].abspath + local testfile_dir = Path:new(testfile):parent().filename + vim.cmd(string.format("cd %s", testfile_dir)) + local cmd = "Neotree current reveal_force_cwd reveal_file=" .. testfile + run_in_current_command(cmd, testfile) + end + ) + end) + + test.teardown() +end) diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/command/command_spec.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/command/command_spec.lua new file mode 100644 index 00000000..8bc23555 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/command/command_spec.lua @@ -0,0 +1,214 @@ +pcall(require, "luacov") + +local u = require("tests.utils") +local verify = require("tests.utils.verify") + +local run_focus_command = function(command, expected_tree_node) + local winid = vim.api.nvim_get_current_win() + + vim.cmd(command) + u.wait_for_neo_tree({ interval = 10, timeout = 200 }) + --u.wait_for_neo_tree() + verify.window_handle_is_not(winid) + verify.buf_name_endswith("neo-tree filesystem [1]") + if expected_tree_node then + verify.filesystem_tree_node_is(expected_tree_node) + end +end + +local run_show_command = function(command, expected_tree_node) + local starting_winid = vim.api.nvim_get_current_win() + local starting_bufname = vim.api.nvim_buf_get_name(0) + local expected_num_windows = #vim.api.nvim_list_wins() + 1 + + vim.cmd(command) + verify.eventually(500, function() + if #vim.api.nvim_list_wins() ~= expected_num_windows then + return false + end + if vim.api.nvim_get_current_win() ~= starting_winid then + return false + end + if vim.api.nvim_buf_get_name(0) ~= starting_bufname then + return false + end + if expected_tree_node then + verify.filesystem_tree_node_is(expected_tree_node) + end + return true + end, "Expected to see a new window without focusing it.") +end + +local run_close_command = function(command) + vim.cmd(command) + u.wait_for(function() end, { interval = 200, timeout = 200 }) +end + +describe("Command", function() + local test = u.fs.init_test({ + items = { + { + name = "foo", + type = "dir", + items = { + { + name = "bar", + type = "dir", + items = { + { name = "baz1.txt", type = "file" }, + { name = "baz2.txt", type = "file", id = "deepfile2" }, + }, + }, + { name = "foofile1.txt", type = "file" }, + }, + }, + { name = "topfile1.txt", type = "file", id = "topfile1" }, + }, + }) + + test.setup() + + local fs_tree = test.fs_tree + + after_each(function() + u.clear_environment() + end) + + describe("with reveal:", function() + it("`:Neotree float reveal` should reveal the current file in the floating window", function() + local cmd = "Neotree float reveal" + local testfile = fs_tree.lookup["./foo/bar/baz1.txt"].abspath + u.editfile(testfile) + run_focus_command(cmd, testfile) + end) + + it("`:Neotree reveal toggle` should toggle the reveal-state of the tree", function() + local cmd = "Neotree reveal toggle" + local testfile = fs_tree.lookup["./foo/foofile1.txt"].abspath + u.editfile(testfile) + + -- toggle OPEN + run_focus_command(cmd, testfile) + local tree_winid = vim.api.nvim_get_current_win() + + -- toggle CLOSE + run_close_command(cmd) + verify.window_handle_is_not(tree_winid) + verify.buf_name_is(testfile) + + -- toggle OPEN with a different file + testfile = fs_tree.lookup["./foo/bar/baz1.txt"].abspath + u.editfile(testfile) + run_focus_command(cmd, testfile) + end) + + it( + "`:Neotree float reveal toggle` should toggle the reveal-state of the floating window", + function() + local cmd = "Neotree float reveal toggle" + local testfile = fs_tree.lookup["./foo/foofile1.txt"].abspath + u.editfile(testfile) + + -- toggle OPEN + run_focus_command(cmd, testfile) + local tree_winid = vim.api.nvim_get_current_win() + + -- toggle CLOSE + run_close_command("Neotree float reveal toggle") + verify.window_handle_is_not(tree_winid) + verify.buf_name_is(testfile) + + -- toggle OPEN + testfile = fs_tree.lookup["./foo/bar/baz2.txt"].abspath + u.editfile(testfile) + run_focus_command(cmd, testfile) + end + ) + + it("`:Neotree reveal` should reveal the current file in the sidebar", function() + local cmd = "Neotree reveal" + local testfile = fs_tree.lookup["topfile1"].abspath + u.editfile(testfile) + run_focus_command(cmd, testfile) + end) + end) + + for _, follow_current_file in ipairs({ true, false }) do + require("neo-tree").setup({ + filesystem = { + follow_current_file = { + enabled = follow_current_file, + }, + }, + }) + + describe(string.format("w/ follow_current_file.enabled=%s", follow_current_file), function() + describe("with show :", function() + it("`:Neotree show` should show the window without focusing", function() + local cmd = "Neotree show" + local testfile = fs_tree.lookup["topfile1"].abspath + u.editfile(testfile) + run_show_command(cmd) + end) + + it("`:Neotree show toggle` should retain the focused node on next show", function() + local cmd = "Neotree show toggle" + local topfile = fs_tree.lookup["topfile1"].abspath + local baz = fs_tree.lookup["./foo/bar/baz1.txt"].abspath + + -- focus a sub node to see if state is retained + u.editfile(baz) + run_focus_command(":Neotree reveal", baz) + local expected_tree_node = baz + + verify.after(500, function() + -- toggle CLOSE + run_close_command(cmd) + + -- toggle OPEN + u.editfile(topfile) + if follow_current_file then + expected_tree_node = topfile + end + run_show_command(cmd, expected_tree_node) + return true + end) + end) + end) + + describe("with focus :", function() + it("`:Neotree focus` should show the window and focus it", function() + local cmd = "Neotree focus" + local testfile = fs_tree.lookup["topfile1"].abspath + u.editfile(testfile) + run_focus_command(cmd) + end) + + it("`:Neotree focus toggle` should retain the focused node on next focus", function() + local cmd = "Neotree focus toggle" + local topfile = fs_tree.lookup["topfile1"].abspath + local baz = fs_tree.lookup["./foo/bar/baz1.txt"].abspath + + -- focus a sub node to see if state is retained + u.editfile(baz) + run_focus_command("Neotree reveal", baz) + local expected_tree_node = baz + -- toggle CLOSE + run_close_command(cmd) + + verify.after(500, function() + -- toggle OPEN + u.editfile(topfile) + if follow_current_file then + expected_tree_node = topfile + end + run_focus_command(cmd, expected_tree_node) + return true + end) + end) + end) + end) + end + + test.teardown() +end) diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/events/queue_spec.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/events/queue_spec.lua new file mode 100644 index 00000000..a3a6c642 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/events/queue_spec.lua @@ -0,0 +1,28 @@ +pcall(require, "luacov") + +describe("Event queue", function() + it("should return data when handled = true", function() + local events = require("neo-tree.events") + events.subscribe({ + event = "test", + handler = function() + return { data = "first" } + end, + }) + events.subscribe({ + event = "test", + handler = function() + return { handled = true, data = "second" } + end, + }) + events.subscribe({ + event = "test", + handler = function() + return { data = "third" } + end, + }) + local result = events.fire_event("test") or {} + local data = result.data + assert.are.same("second", data) + end) +end) diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/sources/container_spec.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/sources/container_spec.lua new file mode 100644 index 00000000..9fc735bd --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/sources/container_spec.lua @@ -0,0 +1,146 @@ +pcall(require, "luacov") + +local ns_id = require("neo-tree.ui.highlights").ns_id +local u = require("tests.utils") + +local config = { + renderers = { + directory = { + { + "container", + content = { + { "indent", zindex = 10 }, + { "icon", zindex = 10 }, + { "name", zindex = 10 }, + { "name", zindex = 5, align = "right" }, + }, + }, + }, + file = { + { + "container", + content = { + { "indent", zindex = 10 }, + { "icon", zindex = 10 }, + { "name", zindex = 10 }, + { "name", zindex = 20, align = "right" }, + }, + }, + }, + }, + window = { + width = 40, + }, +} + +local config_right = { + renderers = { + directory = { + { + "container", + enable_character_fade = false, + content = { + { "indent", zindex = 10, align = "right" }, + { "icon", zindex = 10, align = "right" }, + { "name", zindex = 10, align = "right" }, + }, + }, + }, + file = { + { + "container", + enable_character_fade = false, + content = { + { "indent", zindex = 10, align = "right" }, + { "icon", zindex = 10, align = "right" }, + { "name", zindex = 10, align = "right" }, + }, + }, + }, + }, + window = { + width = 40, + }, +} + +local test_dir = { + items = { + { + name = "foo", + type = "dir", + items = { + { + name = "bar", + type = "dir", + items = { + { name = "bar1.txt", type = "file" }, + { name = "bar2.txt", type = "file" }, + }, + }, + { name = "foo1.lua", type = "file" }, + }, + }, + { name = "bazbazbazbazbazbazbazbazbazbazbazbazbazbazbazbazbaz", type = "dir" }, + { name = "1.md", type = "file" }, + }, +} + +describe("sources/components/container", function() + local req_switch = u.get_require_switch() + + local test = u.fs.init_test(test_dir) + test.setup() + + after_each(function() + if req_switch then + req_switch.restore() + end + + u.clear_environment() + end) + + describe("should expand to width", function() + for pow = 4, 8 do + it(2 ^ pow, function() + config.window.width = 2 ^ pow + require("neo-tree").setup(config) + vim.cmd([[Neotree focus]]) + u.wait_for(function() + return vim.bo.filetype == "neo-tree" + end) + + assert.equals(vim.bo.filetype, "neo-tree") + + local width = vim.api.nvim_win_get_width(0) + local lines = vim.api.nvim_buf_get_lines(0, 2, -1, false) + for _, line in ipairs(lines) do + assert.is_true(#line >= width) + end + end) + end + end) + + describe("right-align should matches width", function() + for pow = 4, 8 do + it(2 ^ pow, function() + config_right.window.width = 2 ^ pow + require("neo-tree").setup(config_right) + vim.cmd([[Neotree focus]]) + u.wait_for(function() + return vim.bo.filetype == "neo-tree" + end) + + assert.equals(vim.bo.filetype, "neo-tree") + + local width = vim.api.nvim_win_get_width(0) + local lines = vim.api.nvim_buf_get_lines(0, 1, -1, false) + for _, line in ipairs(lines) do + line = vim.fn.trim(line, " ", 2) + assert.equals(width, vim.fn.strchars(line)) + end + end) + end + end) + + test.teardown() +end) diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/sources/filesystem/filesystem_netrw_hijack_spec.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/sources/filesystem/filesystem_netrw_hijack_spec.lua new file mode 100644 index 00000000..2e007564 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/sources/filesystem/filesystem_netrw_hijack_spec.lua @@ -0,0 +1,89 @@ +pcall(require, "luacov") + +local u = require("tests.utils") +local verify = require("tests.utils.verify") + +describe("Filesystem netrw hijack", function() + after_each(function() + u.clear_environment() + end) + + it("does not interfere with netrw when disabled", function() + require("neo-tree").setup({ + filesystem = { + hijack_netrw_behavior = "disabled", + window = { + position = "left", + }, + }, + }) + + vim.cmd("edit .") + + assert(#vim.api.nvim_list_wins() == 1, "there should only be one window") + + verify.after(100, function() + local name = vim.api.nvim_buf_get_name(0) + return name ~= "neo-tree filesystem [1]" + end, "the buffer should not be neo-tree") + end) + + it("opens in sidebar when behavior is open_default", function() + local file = "Makefile" + vim.cmd("edit " .. file) + + require("neo-tree").setup({ + filesystem = { + hijack_netrw_behavior = "open_default", + window = { + position = "left", + }, + }, + }) + + vim.cmd("edit .") + + verify.eventually(200, function() + return #vim.api.nvim_list_wins() == 2 + end, "there should be two windows") + + verify.buf_name_endswith("neo-tree filesystem [1]") + + verify.eventually(100, function() + local expected_buf_name = "Makefile" + local buf_at_2 = vim.api.nvim_win_get_buf(vim.fn.win_getid(2)) + local name_at_2 = vim.api.nvim_buf_get_name(buf_at_2) + if name_at_2:sub(-#expected_buf_name) == expected_buf_name then + return true + else + return false + end + end, file .. " is not at window 2") + end) + + -- This test is flaky and usually fails in github actions but not always + -- so I'm disabling it for now. + -- TODO: fix this test + -- + --it("opens in in splits when behavior is open_current", function() + -- local file = "Makefile" + -- vim.cmd("edit " .. file) + + -- require("neo-tree").setup({ + -- filesystem = { + -- hijack_netrw_behavior = "open_current", + -- }, + -- }) + + -- assert(#vim.api.nvim_list_wins() == 1, "Test should start with one window") + + -- vim.cmd("split .") + + -- verify.eventually(200, function() + -- if #vim.api.nvim_list_wins() ~= 2 then + -- return false + -- end + -- return vim.api.nvim_buf_get_option(0, "filetype") == "neo-tree" + -- end, "neotree is not in the second window") + --end) +end) diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/sources/manager_spec.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/sources/manager_spec.lua new file mode 100644 index 00000000..b264ef5e --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/sources/manager_spec.lua @@ -0,0 +1,125 @@ +pcall(require, "luacov") + +local u = require("tests.utils") +local verify = require("tests.utils.verify") + +local manager = require('neo-tree.sources.manager') + +local get_dirs = function(winid) + winid = winid or vim.api.nvim_get_current_win() + local tabnr = vim.api.nvim_tabpage_get_number(vim.api.nvim_win_get_tabpage(winid)) + local winnr = vim.api.nvim_win_get_number(winid) + return { + win = vim.fn.getcwd(winnr), + tab = vim.fn.getcwd(-1, tabnr), + global = vim.fn.getcwd(-1, -1), + } +end + +local get_state_for_tab = function(tabid) + for _, state in ipairs(manager._get_all_states()) do + if state.tabid == tabid then + return state + end + end +end + +local get_tabnr = function(tabid) + return vim.api.nvim_tabpage_get_number(tabid or vim.api.nvim_get_current_tabpage()) +end + +describe("Manager", function() + local test = u.fs.init_test({ + items = { + { + name = "foo", + type = "dir", + items = { + { name = "foofile1.txt", type = "file" }, + }, + }, + { name = "topfile1.txt", type = "file", id = "topfile1" }, + }, + }) + + test.setup() + + local fs_tree = test.fs_tree + + -- Just make sure we start all tests in the expected state + before_each(function() + u.eq(1, #vim.api.nvim_list_wins()) + u.eq(1, #vim.api.nvim_list_tabpages()) + vim.cmd.lcd(fs_tree.abspath) + vim.cmd.tcd(fs_tree.abspath) + vim.cmd.cd(fs_tree.abspath) + end) + + after_each(function() + u.clear_environment() + end) + + local setup_2_tabs = function() + -- create 2 tabs + local tab1 = vim.api.nvim_get_current_tabpage() + local win1 = vim.api.nvim_get_current_win() + vim.cmd.tabnew() + local tab2 = vim.api.nvim_get_current_tabpage() + local win2 = vim.api.nvim_get_current_win() + u.neq(tab2, tab1) + u.neq(win2, win1) + + -- set different directories + vim.api.nvim_set_current_tabpage(tab2) + local base_dir = vim.fn.getcwd() + vim.cmd.tcd('foo') + local new_dir = vim.fn.getcwd() + + -- open neo-tree + vim.api.nvim_set_current_tabpage(tab1) + vim.cmd.Neotree('show') + vim.api.nvim_set_current_tabpage(tab2) + vim.cmd.Neotree('show') + + return { + tab1 = tab1, + tab2 = tab2, + win1 = win1, + win2 = win2, + tab1_dir = base_dir, + tab2_dir = new_dir, + } + end + + it("should respect changed tab cwd", function() + local ctx = setup_2_tabs() + + local state1 = get_state_for_tab(ctx.tab1) + local state2 = get_state_for_tab(ctx.tab2) + u.eq(ctx.tab1_dir, manager.get_cwd(state1)) + u.eq(ctx.tab2_dir, manager.get_cwd(state2)) + end) + + it("should have correct tab cwd after tabs order is changed", function() + local ctx = setup_2_tabs() + + -- tab numbers should be the same as ids + u.eq(1, get_tabnr(ctx.tab1)) + u.eq(2, get_tabnr(ctx.tab2)) + + -- swap tabs + vim.cmd.tabfirst() + vim.cmd.tabmove('+1') + + -- make sure tabs have been swapped + u.eq(2, get_tabnr(ctx.tab1)) + u.eq(1, get_tabnr(ctx.tab2)) + + -- verify that tab dirs are the same as nvim tab cwd + local state1 = get_state_for_tab(ctx.tab1) + local state2 = get_state_for_tab(ctx.tab2) + u.eq(get_dirs(ctx.win1).tab, manager.get_cwd(state1)) + u.eq(get_dirs(ctx.win2).tab, manager.get_cwd(state2)) + end) +end) + diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/sources/navigate_spec.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/sources/navigate_spec.lua new file mode 100644 index 00000000..f5487651 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/sources/navigate_spec.lua @@ -0,0 +1,51 @@ +pcall(require, "luacov") + +local uv = vim.loop + +---Return all sources inside "lua/neo-tree/sources" +---@return string[] # name of sources found +local function find_all_sources() + local base_dir = "lua/neo-tree/sources" + local result = {} + local fd = uv.fs_scandir(base_dir) + while fd do + local name, typ = uv.fs_scandir_next(fd) + if not name then + break + end + if typ == "directory" then + local ok, mod = pcall(require, "neo-tree.sources." .. name) + if ok and mod.name then + result[#result + 1] = name + end + end + end + return result +end + +describe("sources.navigate(...: #)", function() + it("neo-tree.sources.filesystem.navigate exists", function() + local ok, mod = pcall(require, "neo-tree.sources.filesystem") + assert.is_true(ok) + assert.is_not_nil(mod.navigate) + end) + local filesystem_navigate_nparams = + debug.getinfo(require("neo-tree.sources.filesystem").navigate).nparams + it("neo-tree.sources.filesystem.navigate is a func and has args", function() + assert.is_not_nil(filesystem_navigate_nparams) + assert.is_true(filesystem_navigate_nparams > 0) + end) + for _, source in ipairs(find_all_sources()) do + describe(string.format("Test: %s.navigate", source), function() + it(source .. ".navigate is able to require and exists", function() + local ok, mod = pcall(require, "neo-tree.sources." .. source) + assert.is_true(ok) + assert.is_not_nil(mod.navigate) + end) + it(source .. ".navigate has same num of args as filesystem", function() + local nparams = debug.getinfo(require("neo-tree.sources." .. source).navigate).nparams + assert.are.equal(filesystem_navigate_nparams, nparams) + end) + end) + end +end) diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/ui/icons_spec.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/ui/icons_spec.lua new file mode 100644 index 00000000..d74df302 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/neo-tree/ui/icons_spec.lua @@ -0,0 +1,227 @@ +pcall(require, "luacov") + +local ns_id = require("neo-tree.ui.highlights").ns_id +local u = require("tests.utils") + +describe("ui/icons", function() + local req_switch = u.get_require_switch() + + local test = u.fs.init_test({ + items = { + { + name = "foo", + type = "dir", + items = { + { + name = "bar", + type = "dir", + items = { + { name = "bar1.txt", type = "file" }, + { name = "bar2.txt", type = "file" }, + }, + }, + { name = "foo1.lua", type = "file" }, + }, + }, + { name = "baz", type = "dir" }, + { name = "1.md", type = "file" }, + }, + }) + + test.setup() + + local fs_tree = test.fs_tree + + after_each(function() + if req_switch then + req_switch.restore() + end + + u.clear_environment() + end) + + describe("w/ default_config", function() + before_each(function() + require("neo-tree").setup({}) + end) + + it("works w/o nvim-web-devicons", function() + req_switch.disable_package("nvim-web-devicons") + + vim.cmd([[:Neotree focus]]) + u.wait_for_neo_tree() + + local winid = vim.api.nvim_get_current_win() + local bufnr = vim.api.nvim_win_get_buf(winid) + + u.assert_buf_lines(bufnr, { + string.format("  %s", fs_tree.abspath):sub(1, 42), + "  baz", + "  foo", + " * 1.md", + }) + + vim.api.nvim_win_set_cursor(winid, { 2, 0 }) + u.feedkeys("") + + vim.api.nvim_win_set_cursor(winid, { 3, 0 }) + u.feedkeys("") + + vim.wait(100) + + u.assert_buf_lines(bufnr, { + string.format("  %s", fs_tree.abspath):sub(1, 42), + " 󰉖 baz", + "  foo", + " │  bar", + " └ * foo1.lua", + " * 1.md", + }) + + u.assert_highlight(bufnr, ns_id, 1, " ", "NeoTreeDirectoryIcon") + u.assert_highlight(bufnr, ns_id, 2, "󰉖 ", "NeoTreeDirectoryIcon") + u.assert_highlight(bufnr, ns_id, 4, " ", "NeoTreeDirectoryIcon") + u.assert_highlight(bufnr, ns_id, 5, "* ", "NeoTreeFileIcon") + end) + + it("works w/ nvim-web-devicons", function() + vim.cmd([[:Neotree focus]]) + u.wait_for_neo_tree() + + local winid = vim.api.nvim_get_current_win() + local bufnr = vim.api.nvim_win_get_buf(winid) + + u.assert_buf_lines(bufnr, { + vim.fn.strcharpart(string.format("  %s", fs_tree.abspath), 0, 40), + "  baz", + "  foo", + "  1.md", + }) + + vim.api.nvim_win_set_cursor(winid, { 2, 0 }) + u.feedkeys("") + + vim.api.nvim_win_set_cursor(winid, { 3, 0 }) + u.feedkeys("") + + vim.wait(100) + + u.assert_buf_lines(bufnr, { + vim.fn.strcharpart(string.format("  %s", fs_tree.abspath), 0, 40), + " 󰉖 baz", + "  foo", + " │  bar", + " └  foo1.lua", + "  1.md", + }) + + u.assert_highlight(bufnr, ns_id, 1, " ", "NeoTreeDirectoryIcon") + u.assert_highlight(bufnr, ns_id, 2, "󰉖 ", "NeoTreeDirectoryIcon") + u.assert_highlight(bufnr, ns_id, 4, " ", "NeoTreeDirectoryIcon") + + local extmarks = u.get_text_extmarks(bufnr, ns_id, 5, " ") + u.eq(#extmarks, 1) + u.neq(extmarks[1][4].hl_group, "NeoTreeFileIcon") + end) + end) + + describe("custom config", function() + local config + before_each(function() + config = { + default_component_configs = { + icon = { + folder_closed = "c", + folder_open = "o", + folder_empty = "e", + default = "f", + highlight = "TestNeoTreeFileIcon", + }, + }, + } + + require("neo-tree").setup(config) + end) + + it("works w/o nvim-web-devicons", function() + req_switch.disable_package("nvim-web-devicons") + + vim.cmd([[:Neotree focus]]) + u.wait_for_neo_tree() + + local winid = vim.api.nvim_get_current_win() + local bufnr = vim.api.nvim_win_get_buf(winid) + + u.assert_buf_lines(bufnr, { + string.format(" o %s", fs_tree.abspath):sub(1, 40), + " c baz", + " c foo", + " f 1.md", + }) + + vim.api.nvim_win_set_cursor(winid, { 2, 0 }) + u.feedkeys("") + + vim.api.nvim_win_set_cursor(winid, { 3, 0 }) + u.feedkeys("") + + vim.wait(100) + + u.assert_buf_lines(bufnr, { + string.format(" o %s", fs_tree.abspath):sub(1, 40), + " e baz", + " o foo", + " │ c bar", + " └ f foo1.lua", + " f 1.md", + }) + + u.assert_highlight(bufnr, ns_id, 1, "o ", "NeoTreeDirectoryIcon") + u.assert_highlight(bufnr, ns_id, 2, "e ", "NeoTreeDirectoryIcon") + u.assert_highlight(bufnr, ns_id, 4, "c ", "NeoTreeDirectoryIcon") + u.assert_highlight(bufnr, ns_id, 5, "f ", config.default_component_configs.icon.highlight) + end) + + it("works w/ nvim-web-devicons", function() + vim.cmd([[:Neotree focus]]) + u.wait_for_neo_tree() + + local winid = vim.api.nvim_get_current_win() + local bufnr = vim.api.nvim_win_get_buf(winid) + + u.assert_buf_lines(bufnr, { + vim.fn.strcharpart(string.format(" o %s", fs_tree.abspath), 0, 40), + " c baz", + " c foo", + "  1.md", + }) + + vim.api.nvim_win_set_cursor(winid, { 2, 0 }) + u.feedkeys("") + + vim.api.nvim_win_set_cursor(winid, { 3, 0 }) + u.feedkeys("") + + vim.wait(100) + + u.assert_buf_lines(bufnr, { + vim.fn.strcharpart(string.format(" o %s", fs_tree.abspath), 0, 40), + " e baz", + " o foo", + " │ c bar", + " └  foo1.lua", + "  1.md", + }) + + u.assert_highlight(bufnr, ns_id, 1, "o ", "NeoTreeDirectoryIcon") + u.assert_highlight(bufnr, ns_id, 2, "e ", "NeoTreeDirectoryIcon") + u.assert_highlight(bufnr, ns_id, 4, "c ", "NeoTreeDirectoryIcon") + + local extmarks = u.get_text_extmarks(bufnr, ns_id, 5, " ") + u.eq(#extmarks, 1) + u.neq(extmarks[1][4].hl_group, config.default_component_configs.icon.highlight) + end) + end) + + test.teardown() +end) diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/utils/fs.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/utils/fs.lua new file mode 100644 index 00000000..66e35a8c --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/utils/fs.lua @@ -0,0 +1,94 @@ +local Path = require("plenary.path") + +local fs = {} + +function fs.create_temp_dir() + -- Resolve for two reasons. + -- 1. Follow any symlinks which make comparing paths fail. (on macOS, TMPDIR can be under /var which is symlinked to + -- /private/var) + -- 2. Remove any double separators (on macOS TMPDIR can end in a trailing / which absolute doesn't remove, this should + -- be coverted by https://github.com/nvim-lua/plenary.nvim/issues/330). + local temp_dir = vim.fn.resolve( + Path:new( + vim.fn.fnamemodify(vim.fn.tempname(), ":h"), + string.format("neo-tree-test-%s", vim.fn.rand()) + ):absolute() + ) + vim.fn.mkdir(temp_dir, "p") + return temp_dir +end + +function fs.create_dir(path) + local abspath = Path:new(path):absolute() + vim.fn.mkdir(abspath, "p") +end + +function fs.remove_dir(dir, recursive) + if vim.fn.isdirectory(dir) == 1 then + return vim.fn.delete(dir, recursive and "rf" or "d") == 0 + end + return false +end + +function fs.write_file(path, content) + local abspath = Path:new(path):absolute() + fs.create_dir(vim.fn.fnamemodify(abspath, ":h")) + vim.fn.writefile(content or {}, abspath) +end + +function fs.create_fs_tree(fs_tree) + local function create_items(items, basedir, relative_root_path) + relative_root_path = relative_root_path or "." + + for _, item in ipairs(items) do + local relative_path = relative_root_path .. "/" .. item.name + + -- create lookups + fs_tree.lookup[relative_path] = item + if item.id then + fs_tree.lookup[item.id] = item + end + + -- create actual files and directories + if item.type == "dir" then + item.abspath = Path:new(basedir, item.name):absolute() + fs.create_dir(item.abspath) + if item.items then + create_items(item.items, item.abspath, relative_path) + end + elseif item.type == "file" then + item.abspath = Path:new(basedir, item.name):absolute() + fs.write_file(item.abspath) + end + end + end + + create_items(fs_tree.items, fs_tree.abspath) + + return fs_tree +end + +function fs.init_test(fs_tree) + fs_tree.lookup = {} + if not fs_tree.abspath then + fs_tree.abspath = fs.create_temp_dir() + end + + local function setup() + fs.remove_dir(fs_tree.abspath, true) + fs.create_fs_tree(fs_tree) + vim.cmd("tcd " .. fs_tree.abspath) + end + + local function teardown() + fs.remove_dir(fs_tree.abspath, true) + end + + return { + fs_tree = fs_tree, + setup = setup, + teardown = teardown, + } +end + +return fs diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/utils/init.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/utils/init.lua new file mode 100644 index 00000000..e3caae6b --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/utils/init.lua @@ -0,0 +1,191 @@ +local mod = { + fs = require("tests.utils.fs"), +} + +function mod.clear_environment() + -- Create fresh window + vim.cmd("top new | wincmd o") + local keepbufnr = vim.api.nvim_get_current_buf() + -- Clear ALL neo-tree state + require("neo-tree.sources.manager")._clear_state() + -- Cleanup any remaining buffers + for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do + if bufnr ~= keepbufnr then + vim.api.nvim_buf_delete(bufnr, { force = true }) + end + end + assert(#vim.api.nvim_tabpage_list_wins(0) == 1, "Failed to properly clear tab") + assert(#vim.api.nvim_list_bufs() == 1, "Failed to properly clear buffers") +end + +mod.editfile = function(testfile) + vim.cmd("e " .. testfile) + assert.are.same( + vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":p"), + vim.fn.fnamemodify(testfile, ":p") + ) +end + +function mod.eq(...) + return assert.are.same(...) +end + +function mod.neq(...) + return assert["not"].are.same(...) +end + +---@param keys string +---@param mode? string +function mod.feedkeys(keys, mode) + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(keys, true, false, true), mode or "x", true) +end + +---@param tbl table +---@param keys string[] +function mod.tbl_pick(tbl, keys) + if not keys or #keys == 0 then + return tbl + end + + local new_tbl = {} + for _, key in ipairs(keys) do + new_tbl[key] = tbl[key] + end + return new_tbl +end + +local orig_require = _G.require +-- can be used to enable/disable package +-- for specific tests +function mod.get_require_switch() + local disabled_packages = {} + + local function fake_require(name) + if vim.tbl_contains(disabled_packages, name) then + return error("test: package disabled") + end + + return orig_require(name) + end + + return { + disable_package = function(name) + _G.require = fake_require + package.loaded[name] = nil + table.insert(disabled_packages, name) + end, + enable_package = function(name) + _G.require = fake_require + disabled_packages = vim.tbl_filter(function(package_name) + return package_name ~= name + end, disabled_packages) + end, + restore = function() + disabled_packages = {} + _G.require = orig_require + end, + } +end + +---@param bufnr number +---@param lines string[] +---@param linenr_start? integer (1-indexed) +---@param linenr_end? integer (1-indexed, inclusive) +function mod.assert_buf_lines(bufnr, lines, linenr_start, linenr_end) + mod.eq( + vim.api.nvim_buf_get_lines( + bufnr, + linenr_start and linenr_start - 1 or 0, + linenr_end or -1, + false + ), + lines + ) +end + +---@param bufnr number +---@param ns_id integer +---@param linenr integer (1-indexed) +---@param byte_start? integer (0-indexed) +---@param byte_end? integer (0-indexed, inclusive) +function mod.get_line_extmarks(bufnr, ns_id, linenr, byte_start, byte_end) + return vim.api.nvim_buf_get_extmarks( + bufnr, + ns_id, + { linenr - 1, byte_start or 0 }, + { linenr - 1, byte_end and byte_end + 1 or -1 }, + { details = true } + ) +end + +---@param bufnr number +---@param ns_id integer +---@param linenr integer (1-indexed) +---@param text string +---@return table[] +---@return { byte_start: integer, byte_end: integer } info (byte range: 0-indexed, inclusive) +function mod.get_text_extmarks(bufnr, ns_id, linenr, text) + local line = vim.api.nvim_buf_get_lines(bufnr, linenr - 1, linenr, false)[1] + + local byte_start = string.find(line, text) -- 1-indexed + byte_start = byte_start - 1 -- 0-indexed + local byte_end = byte_start + #text - 1 -- inclusive + + local extmarks = vim.api.nvim_buf_get_extmarks( + bufnr, + ns_id, + { linenr - 1, byte_start }, + { linenr - 1, byte_end }, + { details = true } + ) + + return extmarks, { byte_start = byte_start, byte_end = byte_end } +end + +---@param extmark table +---@param linenr number (1-indexed) +---@param text string +---@param hl_group string +function mod.assert_extmark(extmark, linenr, text, hl_group) + mod.eq(extmark[2], linenr - 1) + + if text then + local start_col = extmark[3] + mod.eq(extmark[4].end_col - start_col, #text) + end + + mod.eq(mod.tbl_pick(extmark[4], { "end_row", "hl_group" }), { + end_row = linenr - 1, + hl_group = hl_group, + }) +end + +---@param bufnr number +---@param ns_id integer +---@param linenr integer (1-indexed) +---@param text string +---@param hl_group string +function mod.assert_highlight(bufnr, ns_id, linenr, text, hl_group) + local extmarks, info = mod.get_text_extmarks(bufnr, ns_id, linenr, text) + + mod.eq(#extmarks, 1) + mod.eq(extmarks[1][3], info.byte_start) + mod.assert_extmark(extmarks[1], linenr, text, hl_group) +end + +---@param callback fun(): boolean +---@param options? { interval?: integer, timeout?: integer } +function mod.wait_for(callback, options) + options = options or {} + vim.wait(options.timeout or 1000, callback, options.interval or 100) +end + +---@param options? { interval?: integer, timeout?: integer } +function mod.wait_for_neo_tree(options) + local verify = require("tests.utils.verify") + mod.wait_for(function() + return verify.get_state() ~= nil + end, options) +end + +return mod diff --git a/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/utils/verify.lua b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/utils/verify.lua new file mode 100644 index 00000000..3202adf0 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neo-tree.nvim/tests/utils/verify.lua @@ -0,0 +1,127 @@ +local verify = {} + +verify.eventually = function(timeout, assertfunc, failmsg, ...) + local success, args = false, { ... } + vim.wait(timeout or 1000, function() + success = assertfunc(unpack(args)) + return success + end) + assert(success, failmsg) +end + +verify.after = function(timeout, assertfunc, failmsg) + vim.wait(timeout, function() + return false + end) + assert(assertfunc(), failmsg) +end + +verify.bufnr_is = function(bufnr, timeout) + verify.eventually(timeout or 500, function() + return bufnr == vim.api.nvim_get_current_buf() + end, string.format("Current buffer is expected to be '%s' but is not", bufnr)) +end + +verify.bufnr_is_not = function(bufnr, timeout) + verify.eventually(timeout or 500, function() + return bufnr ~= vim.api.nvim_get_current_buf() + end, string.format("Current buffer is '%s' when expected to not be", bufnr)) +end + +verify.buf_name_endswith = function(buf_name, timeout) + verify.eventually( + timeout or 500, + function() + if buf_name == "" then + return true + end + local n = vim.api.nvim_buf_get_name(0) + if n:sub(-#buf_name) == buf_name then + return true + else + return false + end + end, + string.format("Current buffer name is expected to be end with '%s' but it does not", buf_name) + ) +end + +verify.buf_name_is = function(buf_name, timeout) + verify.eventually(timeout or 500, function() + return buf_name == vim.api.nvim_buf_get_name(0) + end, string.format("Current buffer name is expected to be '%s' but is not", buf_name)) +end + +verify.tree_focused = function(timeout) + verify.eventually(timeout or 1000, function() + if not verify.get_state() then + return false + end + return vim.api.nvim_buf_get_option(0, "filetype") == "neo-tree" + end, "Current buffer is not a 'neo-tree' filetype") +end + +verify.get_state = function(source_name, winid) + if source_name == nil then + local success + success, source_name = pcall(vim.api.nvim_buf_get_var, 0, "neo_tree_source") + if not success then + return nil + end + end + local state = require("neo-tree.sources.manager").get_state(source_name, nil, winid) + if not state.tree then + return nil + end + if not state._ready then + return nil + end + return state +end + +verify.tree_node_is = function(source_name, expected_node_id, winid, timeout) + verify.eventually(timeout or 500, function() + local state = verify.get_state(source_name, winid) + if not state then + return false + end + local success, node = pcall(state.tree.get_node, state.tree) + if not success then + return false + end + if not node then + return false + end + local node_id = node:get_id() + if node_id == expected_node_id then + return true + end + return false + end, string.format("Tree node '%s' not focused", expected_node_id)) +end + +verify.filesystem_tree_node_is = function(expected_node_id, winid, timeout) + verify.tree_node_is("filesystem", expected_node_id, winid, timeout) +end + +verify.buffers_tree_node_is = function(expected_node_id, winid, timeout) + verify.tree_node_is("buffers", expected_node_id, winid, timeout) +end + +verify.git_status_tree_node_is = function(expected_node_id, winid, timeout) + verify.tree_node_is("git_status", expected_node_id, winid, timeout) +end + +verify.window_handle_is = function(winid, timeout) + verify.eventually(timeout or 500, function() + return winid == vim.api.nvim_get_current_win() + end, string.format("Current window handle is expected to be '%s' but is not", winid)) +end + +verify.window_handle_is_not = function(winid, timeout) + verify.eventually(timeout or 500, function() + return winid ~= vim.api.nvim_get_current_win() + end, string.format("Current window handle is not expected to be '%s' but it is", winid)) +end + +return verify diff --git a/config/neovim/store/lazy-plugins/neodev.nvim/doc/tags b/config/neovim/store/lazy-plugins/neodev.nvim/doc/tags new file mode 100644 index 00000000..6e177719 --- /dev/null +++ b/config/neovim/store/lazy-plugins/neodev.nvim/doc/tags @@ -0,0 +1,18 @@ +lua-dev-configuration lua-dev.txt /*lua-dev-configuration* +lua-dev-features lua-dev.txt /*lua-dev-features* +lua-dev-how? lua-dev.txt /*lua-dev-how?* +lua-dev-installation lua-dev.txt /*lua-dev-installation* +lua-dev-lua-dev lua-dev.txt /*lua-dev-lua-dev* +lua-dev-requirements lua-dev.txt /*lua-dev-requirements* +lua-dev-setup lua-dev.txt /*lua-dev-setup* +lua-dev-table-of-contents lua-dev.txt /*lua-dev-table-of-contents* +lua-dev.txt lua-dev.txt /*lua-dev.txt* +neodev.nvim-links neodev.nvim.txt /*neodev.nvim-links* +neodev.nvim-neodev.nvim neodev.nvim.txt /*neodev.nvim-neodev.nvim* +neodev.nvim-neodev.nvim-configuration neodev.nvim.txt /*neodev.nvim-neodev.nvim-configuration* +neodev.nvim-neodev.nvim-features neodev.nvim.txt /*neodev.nvim-neodev.nvim-features* +neodev.nvim-neodev.nvim-installation neodev.nvim.txt /*neodev.nvim-neodev.nvim-installation* +neodev.nvim-neodev.nvim-requirements neodev.nvim.txt /*neodev.nvim-neodev.nvim-requirements* +neodev.nvim-neodev.nvim-setup neodev.nvim.txt /*neodev.nvim-neodev.nvim-setup* +neodev.nvim-table-of-contents neodev.nvim.txt /*neodev.nvim-table-of-contents* +neodev.nvim.txt neodev.nvim.txt /*neodev.nvim.txt* diff --git a/config/neovim/store/lazy-plugins/noice.nvim/doc/tags b/config/neovim/store/lazy-plugins/noice.nvim/doc/tags new file mode 100644 index 00000000..e2b3a749 --- /dev/null +++ b/config/neovim/store/lazy-plugins/noice.nvim/doc/tags @@ -0,0 +1,16 @@ +noice.nvim-links noice.nvim.txt /*noice.nvim-links* +noice.nvim-noice-(nice,-noise,-notice) noice.nvim.txt /*noice.nvim-noice-(nice,-noise,-notice)* +noice.nvim-noice-(nice,-noise,-notice)-configuration noice.nvim.txt /*noice.nvim-noice-(nice,-noise,-notice)-configuration* +noice.nvim-noice-(nice,-noise,-notice)-features noice.nvim.txt /*noice.nvim-noice-(nice,-noise,-notice)-features* +noice.nvim-noice-(nice,-noise,-notice)-filters noice.nvim.txt /*noice.nvim-noice-(nice,-noise,-notice)-filters* +noice.nvim-noice-(nice,-noise,-notice)-formatting noice.nvim.txt /*noice.nvim-noice-(nice,-noise,-notice)-formatting* +noice.nvim-noice-(nice,-noise,-notice)-highlight-groups noice.nvim.txt /*noice.nvim-noice-(nice,-noise,-notice)-highlight-groups* +noice.nvim-noice-(nice,-noise,-notice)-installation noice.nvim.txt /*noice.nvim-noice-(nice,-noise,-notice)-installation* +noice.nvim-noice-(nice,-noise,-notice)-requirements noice.nvim.txt /*noice.nvim-noice-(nice,-noise,-notice)-requirements* +noice.nvim-noice-(nice,-noise,-notice)-routes noice.nvim.txt /*noice.nvim-noice-(nice,-noise,-notice)-routes* +noice.nvim-noice-(nice,-noise,-notice)-status noice.nvim.txt /*noice.nvim-noice-(nice,-noise,-notice)-status* +noice.nvim-noice-(nice,-noise,-notice)-telescope noice.nvim.txt /*noice.nvim-noice-(nice,-noise,-notice)-telescope* +noice.nvim-noice-(nice,-noise,-notice)-usage noice.nvim.txt /*noice.nvim-noice-(nice,-noise,-notice)-usage* +noice.nvim-noice-(nice,-noise,-notice)-views noice.nvim.txt /*noice.nvim-noice-(nice,-noise,-notice)-views* +noice.nvim-table-of-contents noice.nvim.txt /*noice.nvim-table-of-contents* +noice.nvim.txt noice.nvim.txt /*noice.nvim.txt* diff --git a/config/neovim/store/lazy-plugins/nvim-autopairs/doc/tags b/config/neovim/store/lazy-plugins/nvim-autopairs/doc/tags new file mode 100644 index 00000000..5a688807 --- /dev/null +++ b/config/neovim/store/lazy-plugins/nvim-autopairs/doc/tags @@ -0,0 +1,17 @@ +nvim-autopairs-Mapping-`` nvim-autopairs.txt /*nvim-autopairs-Mapping-``* +nvim-autopairs-default-values nvim-autopairs.txt /*nvim-autopairs-default-values* +nvim-autopairs-installation nvim-autopairs.txt /*nvim-autopairs-installation* +nvim-autopairs-nvim-autopairs nvim-autopairs.txt /*nvim-autopairs-nvim-autopairs* +nvim-autopairs-rules-Optional-`check_pair`-parameter nvim-autopairs-rules.txt /*nvim-autopairs-rules-Optional-`check_pair`-parameter* +nvim-autopairs-rules-advanced-methods nvim-autopairs-rules.txt /*nvim-autopairs-rules-advanced-methods* +nvim-autopairs-rules-conditions nvim-autopairs-rules.txt /*nvim-autopairs-rules-conditions* +nvim-autopairs-rules-controlling-rule-behavior nvim-autopairs-rules.txt /*nvim-autopairs-rules-controlling-rule-behavior* +nvim-autopairs-rules-method-explanations nvim-autopairs-rules.txt /*nvim-autopairs-rules-method-explanations* +nvim-autopairs-rules-method-overview nvim-autopairs-rules.txt /*nvim-autopairs-rules-method-overview* +nvim-autopairs-rules-rule-basics nvim-autopairs-rules.txt /*nvim-autopairs-rules-rule-basics* +nvim-autopairs-rules-shorthand-methods nvim-autopairs-rules.txt /*nvim-autopairs-rules-shorthand-methods* +nvim-autopairs-rules-table-of-contents nvim-autopairs-rules.txt /*nvim-autopairs-rules-table-of-contents* +nvim-autopairs-rules.txt nvim-autopairs-rules.txt /*nvim-autopairs-rules.txt* +nvim-autopairs-sponsors nvim-autopairs.txt /*nvim-autopairs-sponsors* +nvim-autopairs-table-of-contents nvim-autopairs.txt /*nvim-autopairs-table-of-contents* +nvim-autopairs.txt nvim-autopairs.txt /*nvim-autopairs.txt* diff --git a/config/neovim/store/lazy-plugins/nvim-colorizer.lua/doc/tags b/config/neovim/store/lazy-plugins/nvim-colorizer.lua/doc/tags new file mode 100644 index 00000000..00f7dc9d --- /dev/null +++ b/config/neovim/store/lazy-plugins/nvim-colorizer.lua/doc/tags @@ -0,0 +1,71 @@ +:ColorizerAttachToBuffer colorizer.txt /*:ColorizerAttachToBuffer* +:ColorizerDetachFromBuffer colorizer.txt /*:ColorizerDetachFromBuffer* +:ColorizerReloadAllBuffers colorizer.txt /*:ColorizerReloadAllBuffers* +:ColorizerToggle colorizer.txt /*:ColorizerToggle* +colorizer colorizer.txt /*colorizer* +colorizer-commands colorizer.txt /*colorizer-commands* +colorizer-lua-api colorizer.txt /*colorizer-lua-api* +colorizer-usage colorizer.txt /*colorizer-usage* +colorizer.DEFAULT_NAMESPACE colorizer.txt /*colorizer.DEFAULT_NAMESPACE* +colorizer.attach_to_buffer colorizer.txt /*colorizer.attach_to_buffer* +colorizer.buffer-introduction colorizer.txt /*colorizer.buffer-introduction* +colorizer.buffer-lua-api colorizer.txt /*colorizer.buffer-lua-api* +colorizer.buffer.add_highlight colorizer.txt /*colorizer.buffer.add_highlight* +colorizer.buffer.clear_hl_cache colorizer.txt /*colorizer.buffer.clear_hl_cache* +colorizer.buffer.default_namespace colorizer.txt /*colorizer.buffer.default_namespace* +colorizer.buffer.highlight colorizer.txt /*colorizer.buffer.highlight* +colorizer.buffer.highlight_mode_names colorizer.txt /*colorizer.buffer.highlight_mode_names* +colorizer.buffer.parse_lines colorizer.txt /*colorizer.buffer.parse_lines* +colorizer.buffer.rehighlight colorizer.txt /*colorizer.buffer.rehighlight* +colorizer.clear_highlight_cache colorizer.txt /*colorizer.clear_highlight_cache* +colorizer.color-introduction colorizer.txt /*colorizer.color-introduction* +colorizer.color-lua-api colorizer.txt /*colorizer.color-lua-api* +colorizer.color.hsl_to_rgb colorizer.txt /*colorizer.color.hsl_to_rgb* +colorizer.color.hue_to_rgb colorizer.txt /*colorizer.color.hue_to_rgb* +colorizer.color.is_bright colorizer.txt /*colorizer.color.is_bright* +colorizer.detach_from_buffer colorizer.txt /*colorizer.detach_from_buffer* +colorizer.get_buffer_options colorizer.txt /*colorizer.get_buffer_options* +colorizer.highlight_buffer colorizer.txt /*colorizer.highlight_buffer* +colorizer.is_buffer_attached colorizer.txt /*colorizer.is_buffer_attached* +colorizer.matcher-introduction colorizer.txt /*colorizer.matcher-introduction* +colorizer.matcher-lua-api colorizer.txt /*colorizer.matcher-lua-api* +colorizer.matcher.compile colorizer.txt /*colorizer.matcher.compile* +colorizer.matcher.make colorizer.txt /*colorizer.matcher.make* +colorizer.parser.argb_hex-introduction colorizer.txt /*colorizer.parser.argb_hex-introduction* +colorizer.parser.argb_hex-lua-api colorizer.txt /*colorizer.parser.argb_hex-lua-api* +colorizer.parser.argb_hex.parser.argb_hex_parser colorizer.txt /*colorizer.parser.argb_hex.parser.argb_hex_parser* +colorizer.parser.hsl-introduction colorizer.txt /*colorizer.parser.hsl-introduction* +colorizer.parser.hsl-lua-api colorizer.txt /*colorizer.parser.hsl-lua-api* +colorizer.parser.hsl.parser.hsl_function_parser colorizer.txt /*colorizer.parser.hsl.parser.hsl_function_parser* +colorizer.parser.names-introduction colorizer.txt /*colorizer.parser.names-introduction* +colorizer.parser.names-lua-api colorizer.txt /*colorizer.parser.names-lua-api* +colorizer.parser.names.parser.name_parser colorizer.txt /*colorizer.parser.names.parser.name_parser* +colorizer.parser.rgb-introduction colorizer.txt /*colorizer.parser.rgb-introduction* +colorizer.parser.rgb-lua-api colorizer.txt /*colorizer.parser.rgb-lua-api* +colorizer.parser.rgb.parser.rgb_function_parser colorizer.txt /*colorizer.parser.rgb.parser.rgb_function_parser* +colorizer.parser.rgba_hex-introduction colorizer.txt /*colorizer.parser.rgba_hex-introduction* +colorizer.parser.rgba_hex-lua-api colorizer.txt /*colorizer.parser.rgba_hex-lua-api* +colorizer.parser.rgba_hex.parser.rgba_hex_parser colorizer.txt /*colorizer.parser.rgba_hex.parser.rgba_hex_parser* +colorizer.reload_all_buffers colorizer.txt /*colorizer.reload_all_buffers* +colorizer.sass-introduction colorizer.txt /*colorizer.sass-introduction* +colorizer.sass-lua-api colorizer.txt /*colorizer.sass-lua-api* +colorizer.sass.cleanup colorizer.txt /*colorizer.sass.cleanup* +colorizer.sass.name_parser colorizer.txt /*colorizer.sass.name_parser* +colorizer.sass.update_variables colorizer.txt /*colorizer.sass.update_variables* +colorizer.setup colorizer.txt /*colorizer.setup* +colorizer.tailwind-introduction colorizer.txt /*colorizer.tailwind-introduction* +colorizer.tailwind-lua-api colorizer.txt /*colorizer.tailwind-lua-api* +colorizer.tailwind.cleanup colorizer.txt /*colorizer.tailwind.cleanup* +colorizer.tailwind.setup_lsp_colors colorizer.txt /*colorizer.tailwind.setup_lsp_colors* +colorizer.trie-introduction colorizer.txt /*colorizer.trie-introduction* +colorizer.user_default_options colorizer.txt /*colorizer.user_default_options* +colorizer.utils-introduction colorizer.txt /*colorizer.utils-introduction* +colorizer.utils-lua-api colorizer.txt /*colorizer.utils-lua-api* +colorizer.utils.byte_is_alphanumeric colorizer.txt /*colorizer.utils.byte_is_alphanumeric* +colorizer.utils.byte_is_hex colorizer.txt /*colorizer.utils.byte_is_hex* +colorizer.utils.byte_is_valid_colorchar colorizer.txt /*colorizer.utils.byte_is_valid_colorchar* +colorizer.utils.count colorizer.txt /*colorizer.utils.count* +colorizer.utils.get_last_modified colorizer.txt /*colorizer.utils.get_last_modified* +colorizer.utils.merge colorizer.txt /*colorizer.utils.merge* +colorizer.utils.parse_hex colorizer.txt /*colorizer.utils.parse_hex* +colorizer.utils.watch_file colorizer.txt /*colorizer.utils.watch_file* diff --git a/config/neovim/store/lazy-plugins/nvim-lspconfig/doc/server_configurations.md b/config/neovim/store/lazy-plugins/nvim-lspconfig/doc/server_configurations.md index 86ab9b2f..f36ded46 100644 --- a/config/neovim/store/lazy-plugins/nvim-lspconfig/doc/server_configurations.md +++ b/config/neovim/store/lazy-plugins/nvim-lspconfig/doc/server_configurations.md @@ -164,6 +164,7 @@ autogenerated from the Lua files. You can view this file in Nvim by running - [mojo](#mojo) - [motoko_lsp](#motoko_lsp) - [move_analyzer](#move_analyzer) +- [msbuild_project_tools_server](#msbuild_project_tools_server) - [mutt_ls](#mutt_ls) - [nelua_lsp](#nelua_lsp) - [neocmake](#neocmake) @@ -7326,6 +7327,47 @@ require'lspconfig'.move_analyzer.setup{} ``` +## msbuild_project_tools_server + +https://github.com/tintoy/msbuild-project-tools-server/ + +MSBuild Project Tools Server can be installed by following the README.MD on the above repository. + +Example config: +```lua +lspconfig.msbuild_project_tools_server.setup { + cmd = {'dotnet', '/path/to/server/MSBuildProjectTools.LanguageServer.Host.dll'} +} +``` + + + + +**Snippet to enable the language server:** +```lua +require'lspconfig'.msbuild_project_tools_server.setup{} +``` + + +**Default values:** + - `cmd` : + ```lua + { "dotnet", "MSBuildProjectTools.LanguageServer.Host.dll" } + ``` + - `filetypes` : + ```lua + { "xml.csproj", "xml.fsproj", "sln" } + ``` + - `init_options` : + ```lua + {} + ``` + - `root_dir` : + ```lua + root_pattern('.git') + ``` + + ## mutt_ls https://github.com/neomutt/mutt-language-server diff --git a/config/neovim/store/lazy-plugins/nvim-lspconfig/doc/server_configurations.txt b/config/neovim/store/lazy-plugins/nvim-lspconfig/doc/server_configurations.txt index 86ab9b2f..f36ded46 100644 --- a/config/neovim/store/lazy-plugins/nvim-lspconfig/doc/server_configurations.txt +++ b/config/neovim/store/lazy-plugins/nvim-lspconfig/doc/server_configurations.txt @@ -164,6 +164,7 @@ autogenerated from the Lua files. You can view this file in Nvim by running - [mojo](#mojo) - [motoko_lsp](#motoko_lsp) - [move_analyzer](#move_analyzer) +- [msbuild_project_tools_server](#msbuild_project_tools_server) - [mutt_ls](#mutt_ls) - [nelua_lsp](#nelua_lsp) - [neocmake](#neocmake) @@ -7326,6 +7327,47 @@ require'lspconfig'.move_analyzer.setup{} ``` +## msbuild_project_tools_server + +https://github.com/tintoy/msbuild-project-tools-server/ + +MSBuild Project Tools Server can be installed by following the README.MD on the above repository. + +Example config: +```lua +lspconfig.msbuild_project_tools_server.setup { + cmd = {'dotnet', '/path/to/server/MSBuildProjectTools.LanguageServer.Host.dll'} +} +``` + + + + +**Snippet to enable the language server:** +```lua +require'lspconfig'.msbuild_project_tools_server.setup{} +``` + + +**Default values:** + - `cmd` : + ```lua + { "dotnet", "MSBuildProjectTools.LanguageServer.Host.dll" } + ``` + - `filetypes` : + ```lua + { "xml.csproj", "xml.fsproj", "sln" } + ``` + - `init_options` : + ```lua + {} + ``` + - `root_dir` : + ```lua + root_pattern('.git') + ``` + + ## mutt_ls https://github.com/neomutt/mutt-language-server diff --git a/config/neovim/store/lazy-plugins/nvim-lspconfig/doc/tags b/config/neovim/store/lazy-plugins/nvim-lspconfig/doc/tags new file mode 100644 index 00000000..1c298e12 --- /dev/null +++ b/config/neovim/store/lazy-plugins/nvim-lspconfig/doc/tags @@ -0,0 +1,21 @@ +lspconfig lspconfig.txt /*lspconfig* +lspconfig-all server_configurations.txt /*lspconfig-all* +lspconfig-commands lspconfig.txt /*lspconfig-commands* +lspconfig-completion lspconfig.txt /*lspconfig-completion* +lspconfig-configurations lspconfig.txt /*lspconfig-configurations* +lspconfig-debugging lspconfig.txt /*lspconfig-debugging* +lspconfig-global-defaults lspconfig.txt /*lspconfig-global-defaults* +lspconfig-highlight lspconfig.txt /*lspconfig-highlight* +lspconfig-logging lspconfig.txt /*lspconfig-logging* +lspconfig-new lspconfig.txt /*lspconfig-new* +lspconfig-quickstart lspconfig.txt /*lspconfig-quickstart* +lspconfig-root-advanced lspconfig.txt /*lspconfig-root-advanced* +lspconfig-root-composition lspconfig.txt /*lspconfig-root-composition* +lspconfig-root-detection lspconfig.txt /*lspconfig-root-detection* +lspconfig-root-dir lspconfig.txt /*lspconfig-root-dir* +lspconfig-scope lspconfig.txt /*lspconfig-scope* +lspconfig-server-configurations server_configurations.txt /*lspconfig-server-configurations* +lspconfig-setup lspconfig.txt /*lspconfig-setup* +lspconfig-setup-hook lspconfig.txt /*lspconfig-setup-hook* +lspconfig-single-file-support lspconfig.txt /*lspconfig-single-file-support* +lspconfig.txt lspconfig.txt /*lspconfig.txt* diff --git a/config/neovim/store/lazy-plugins/nvim-lspconfig/lua/lspconfig/server_configurations/msbuild_project_tools_server.lua b/config/neovim/store/lazy-plugins/nvim-lspconfig/lua/lspconfig/server_configurations/msbuild_project_tools_server.lua new file mode 100644 index 00000000..1f6a1241 --- /dev/null +++ b/config/neovim/store/lazy-plugins/nvim-lspconfig/lua/lspconfig/server_configurations/msbuild_project_tools_server.lua @@ -0,0 +1,30 @@ +local util = require 'lspconfig.util' + +local host_dll_name = 'MSBuildProjectTools.LanguageServer.Host.dll' + +return { + default_config = { + filetypes = { 'xml.csproj', 'xml.fsproj', 'sln' }, + root_dir = util.find_git_ancestor, + init_options = {}, + cmd = { 'dotnet', host_dll_name }, + }, + docs = { + description = [[ +https://github.com/tintoy/msbuild-project-tools-server/ + +MSBuild Project Tools Server can be installed by following the README.MD on the above repository. + +Example config: +```lua +lspconfig.msbuild_project_tools_server.setup { + cmd = {'dotnet', '/path/to/server/MSBuildProjectTools.LanguageServer.Host.dll'} +} +``` + +]], + default_config = { + root_dir = [[root_pattern('.git')]], + }, + }, +} diff --git a/config/neovim/store/lazy-plugins/nvim-navbuddy/doc/tags b/config/neovim/store/lazy-plugins/nvim-navbuddy/doc/tags new file mode 100644 index 00000000..c146ba83 --- /dev/null +++ b/config/neovim/store/lazy-plugins/nvim-navbuddy/doc/tags @@ -0,0 +1,8 @@ +navbuddy navbuddy.txt /*navbuddy* +navbuddy-actions navbuddy.txt /*navbuddy-actions* +navbuddy-api navbuddy.txt /*navbuddy-api* +navbuddy-components navbuddy.txt /*navbuddy-components* +navbuddy-customise navbuddy.txt /*navbuddy-customise* +navbuddy-highlights navbuddy.txt /*navbuddy-highlights* +navbuddy-usage navbuddy.txt /*navbuddy-usage* +nvim-navbuddy navbuddy.txt /*nvim-navbuddy* diff --git a/config/neovim/store/lazy-plugins/nvim-navic/doc/tags b/config/neovim/store/lazy-plugins/nvim-navic/doc/tags new file mode 100644 index 00000000..42e5386d --- /dev/null +++ b/config/neovim/store/lazy-plugins/nvim-navic/doc/tags @@ -0,0 +1,16 @@ +navic navic.txt /*navic* +navic-api navic.txt /*navic-api* +navic-components navic.txt /*navic-components* +navic-customise navic.txt /*navic-customise* +navic-highlights navic.txt /*navic-highlights* +navic-usage navic.txt /*navic-usage* +navic-variables navic.txt /*navic-variables* +navic.attach navic.txt /*navic.attach* +navic.format_data navic.txt /*navic.format_data* +navic.get_data navic.txt /*navic.get_data* +navic.get_location navic.txt /*navic.get_location* +navic.is_available navic.txt /*navic.is_available* +navic.setup navic.txt /*navic.setup* +nvim-navic navic.txt /*nvim-navic* +vim.b.navic_lazy_update_context navic.txt /*vim.b.navic_lazy_update_context* +vim.g.navic_silence navic.txt /*vim.g.navic_silence* diff --git a/config/neovim/store/lazy-plugins/nvim-notify/doc/tags b/config/neovim/store/lazy-plugins/nvim-notify/doc/tags new file mode 100644 index 00000000..d55ca017 --- /dev/null +++ b/config/neovim/store/lazy-plugins/nvim-notify/doc/tags @@ -0,0 +1,22 @@ +notify nvim-notify.txt /*notify* +notify-render nvim-notify.txt /*notify-render* +notify.AsyncRecord nvim-notify.txt /*notify.AsyncRecord* +notify.Config nvim-notify.txt /*notify.Config* +notify.DismissOpts nvim-notify.txt /*notify.DismissOpts* +notify.Events nvim-notify.txt /*notify.Events* +notify.Highlights nvim-notify.txt /*notify.Highlights* +notify.HistoryOpts nvim-notify.txt /*notify.HistoryOpts* +notify.OpenOpts nvim-notify.txt /*notify.OpenOpts* +notify.OpenedBuffer nvim-notify.txt /*notify.OpenedBuffer* +notify.Options nvim-notify.txt /*notify.Options* +notify.Record nvim-notify.txt /*notify.Record* +notify.async() nvim-notify.txt /*notify.async()* +notify.config nvim-notify.txt /*notify.config* +notify.dismiss() nvim-notify.txt /*notify.dismiss()* +notify.history() nvim-notify.txt /*notify.history()* +notify.instance() nvim-notify.txt /*notify.instance()* +notify.notify() nvim-notify.txt /*notify.notify()* +notify.open() nvim-notify.txt /*notify.open()* +notify.pending() nvim-notify.txt /*notify.pending()* +notify.setup() nvim-notify.txt /*notify.setup()* +nvim-notify.txt nvim-notify.txt /*nvim-notify.txt* diff --git a/config/neovim/store/lazy-plugins/nvim-treesitter/.github/workflows/lint.yml b/config/neovim/store/lazy-plugins/nvim-treesitter/.github/workflows/lint.yml index b73f03cf..7123332b 100644 --- a/config/neovim/store/lazy-plugins/nvim-treesitter/.github/workflows/lint.yml +++ b/config/neovim/store/lazy-plugins/nvim-treesitter/.github/workflows/lint.yml @@ -36,15 +36,16 @@ jobs: format-queries: name: Lint queries runs-on: ubuntu-latest + env: + NVIM_TAG: stable steps: - uses: actions/checkout@v4 - name: Prepare run: | - wget https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz - tar -zxf nvim-linux64.tar.gz - sudo ln -s "$PWD"/nvim-linux64/bin/nvim /usr/local/bin + bash ./scripts/ci-install.sh - name: Lint run: | + nvim --headless -c "TSInstallSync query" -c "q" nvim -l scripts/format-queries.lua git diff --exit-code diff --git a/config/neovim/store/lazy-plugins/nvim-treesitter/doc/tags b/config/neovim/store/lazy-plugins/nvim-treesitter/doc/tags new file mode 100644 index 00000000..813e79d6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/nvim-treesitter/doc/tags @@ -0,0 +1,47 @@ +:TSBufDisable nvim-treesitter.txt /*:TSBufDisable* +:TSBufEnable nvim-treesitter.txt /*:TSBufEnable* +:TSBufToggle nvim-treesitter.txt /*:TSBufToggle* +:TSDisable nvim-treesitter.txt /*:TSDisable* +:TSEditQuery nvim-treesitter.txt /*:TSEditQuery* +:TSEditQueryUserAfter nvim-treesitter.txt /*:TSEditQueryUserAfter* +:TSEnable nvim-treesitter.txt /*:TSEnable* +:TSInstall nvim-treesitter.txt /*:TSInstall* +:TSInstallInfo nvim-treesitter.txt /*:TSInstallInfo* +:TSInstallSync nvim-treesitter.txt /*:TSInstallSync* +:TSModuleInfo nvim-treesitter.txt /*:TSModuleInfo* +:TSToggle nvim-treesitter.txt /*:TSToggle* +:TSUninstall nvim-treesitter.txt /*:TSUninstall* +:TSUpdate nvim-treesitter.txt /*:TSUpdate* +:TSUpdateSync nvim-treesitter.txt /*:TSUpdateSync* +nvim-treesitter nvim-treesitter.txt /*nvim-treesitter* +nvim-treesitter-commands nvim-treesitter.txt /*nvim-treesitter-commands* +nvim-treesitter-functions nvim-treesitter.txt /*nvim-treesitter-functions* +nvim-treesitter-highlight-mod nvim-treesitter.txt /*nvim-treesitter-highlight-mod* +nvim-treesitter-incremental-selection-mod nvim-treesitter.txt /*nvim-treesitter-incremental-selection-mod* +nvim-treesitter-indentation-aligned_indent.align nvim-treesitter.txt /*nvim-treesitter-indentation-aligned_indent.align* +nvim-treesitter-indentation-indent.begin nvim-treesitter.txt /*nvim-treesitter-indentation-indent.begin* +nvim-treesitter-indentation-indent.branch nvim-treesitter.txt /*nvim-treesitter-indentation-indent.branch* +nvim-treesitter-indentation-indent.dedent nvim-treesitter.txt /*nvim-treesitter-indentation-indent.dedent* +nvim-treesitter-indentation-indent.end nvim-treesitter.txt /*nvim-treesitter-indentation-indent.end* +nvim-treesitter-indentation-mod nvim-treesitter.txt /*nvim-treesitter-indentation-mod* +nvim-treesitter-indentation-queries nvim-treesitter.txt /*nvim-treesitter-indentation-queries* +nvim-treesitter-intro nvim-treesitter.txt /*nvim-treesitter-intro* +nvim-treesitter-modules nvim-treesitter.txt /*nvim-treesitter-modules* +nvim-treesitter-performance nvim-treesitter.txt /*nvim-treesitter-performance* +nvim-treesitter-quickstart nvim-treesitter.txt /*nvim-treesitter-quickstart* +nvim-treesitter-utils nvim-treesitter.txt /*nvim-treesitter-utils* +nvim_treesitter#foldexpr() nvim-treesitter.txt /*nvim_treesitter#foldexpr()* +nvim_treesitter#statusline() nvim-treesitter.txt /*nvim_treesitter#statusline()* +ts_utils.get_named_children nvim-treesitter.txt /*ts_utils.get_named_children* +ts_utils.get_next_node nvim-treesitter.txt /*ts_utils.get_next_node* +ts_utils.get_node_at_cursor nvim-treesitter.txt /*ts_utils.get_node_at_cursor* +ts_utils.get_previous_node nvim-treesitter.txt /*ts_utils.get_previous_node* +ts_utils.goto_node nvim-treesitter.txt /*ts_utils.goto_node* +ts_utils.highlight_node nvim-treesitter.txt /*ts_utils.highlight_node* +ts_utils.highlight_range nvim-treesitter.txt /*ts_utils.highlight_range* +ts_utils.is_parent nvim-treesitter.txt /*ts_utils.is_parent* +ts_utils.memoize_by_buf_tick nvim-treesitter.txt /*ts_utils.memoize_by_buf_tick* +ts_utils.node_length nvim-treesitter.txt /*ts_utils.node_length* +ts_utils.node_to_lsp_range nvim-treesitter.txt /*ts_utils.node_to_lsp_range* +ts_utils.swap_nodes nvim-treesitter.txt /*ts_utils.swap_nodes* +ts_utils.update_selection nvim-treesitter.txt /*ts_utils.update_selection* diff --git a/config/neovim/store/lazy-plugins/nvim-treesitter/lockfile.json b/config/neovim/store/lazy-plugins/nvim-treesitter/lockfile.json index 894fb999..419eeca1 100644 --- a/config/neovim/store/lazy-plugins/nvim-treesitter/lockfile.json +++ b/config/neovim/store/lazy-plugins/nvim-treesitter/lockfile.json @@ -51,7 +51,7 @@ "revision": "2326d709fb9cf73cf124fdbc803c267f851721a4" }, "c": { - "revision": "82fb86aa544843bd17a9f0f3dc16edf645a34349" + "revision": "00ed08f1a6c18141bfd7a81638e4d239a0bb55cc" }, "c_sharp": { "revision": "82fa8f05f41a33e9bc830f85d74a9548f0291738" @@ -87,7 +87,7 @@ "revision": "594289eadfec719198e560f9d7fd243c4db678d5" }, "cpp": { - "revision": "2369fa991eba294e9238e28280ffcd58132f94bc" + "revision": "d29fbff09a8c9ff4f3074de2595dfca12cb33da9" }, "css": { "revision": "f6be52c3d1cdb1c5e4dd7d8bce0a57497f55d6af" @@ -135,13 +135,13 @@ "revision": "648183d86f6f8ffb240ea11b4c6873f6f45d8b67" }, "earthfile": { - "revision": "91fc9434283aec06139e37fc007ad00922f278b4" + "revision": "336001d79dd62668088bc6fe6d72a774a449fa2d" }, "ebnf": { "revision": "8e635b0b723c620774dfb8abf382a7f531894b40" }, "eds": { - "revision": "fde62029d4c715562230070b9af51a9500c2ce10" + "revision": "5517bdb90c90703df49579a4b04689a614780be2" }, "eex": { "revision": "f742f2fe327463335e8671a87c0b9b396905d1d1" @@ -324,7 +324,7 @@ "revision": "bcb84a2d4bcd6f55b911c42deade75c8f90cb0c5" }, "inko": { - "revision": "7860637ce1b43f5f79cfb7cc3311bf3234e9479f" + "revision": "234c87be1dac20f766ddf6f486a7bde2a4bc5594" }, "ispc": { "revision": "9b2f9aec2106b94b4e099fe75e73ebd8ae707c04" @@ -447,7 +447,7 @@ "revision": "570f3d7be01fffc751237f4cfcf52d04e20532d1" }, "nickel": { - "revision": "58baf89db8fdae54a84bcf22c80ff10ee3f929ed" + "revision": "52478738c5a072ab3ad62c74db5d0902dab064cd" }, "nim": { "revision": "961c2798cec9250c44f7d7225ddb33d47d25856a" @@ -570,7 +570,7 @@ "revision": "2c57cac27e207425f8df15327884434cb12365a3" }, "query": { - "revision": "a12c4a1cd8aa6e0340ecb7089a05cd345a12bae3" + "revision": "f767fb0ac5e711b6d44c5e0c8d1f349687a86ce0" }, "r": { "revision": "391400572538ff9854341a175ed8ab4b1e45f44b" @@ -648,7 +648,7 @@ "revision": "ba1b3868eaa960b945593404af9a7c2f296d3643" }, "solidity": { - "revision": "b5a23ead0f69d38b5c9a630f52f5c129132c16ed" + "revision": "1c94fe3d5351dfcff3551ec1f49614cbf758e444" }, "soql": { "revision": "c99ad4b16d112fea91745e3f1b769754239fdaba" @@ -690,7 +690,7 @@ "revision": "2c97326cd96b7c3016c3d249e8dc244c89b4abeb" }, "swift": { - "revision": "03af4d057afc56edf6a703e6606b86f782353f22" + "revision": "26354ddec08c7efde4fa16bd29429f3310d2e2c5" }, "sxhkdrc": { "revision": "440d5f913d9465c9c776a1bd92334d32febcf065" @@ -831,7 +831,7 @@ "revision": "e877f6ade4b77d5ef8787075141053631ba12318" }, "zathurarc": { - "revision": "e9e8de071ab79ed1f6e3365f05fcf890b6d85a2f" + "revision": "5918bf1785662c43a841b0b6a27a129337ec3a23" }, "zig": { "revision": "0d08703e4c3f426ec61695d7617415fff97029bd" diff --git a/config/neovim/store/lazy-plugins/nvim-treesitter/queries/cpp/highlights.scm b/config/neovim/store/lazy-plugins/nvim-treesitter/queries/cpp/highlights.scm index 1779d59e..e39a2925 100644 --- a/config/neovim/store/lazy-plugins/nvim-treesitter/queries/cpp/highlights.scm +++ b/config/neovim/store/lazy-plugins/nvim-treesitter/queries/cpp/highlights.scm @@ -229,8 +229,8 @@ "public" "private" "protected" - "virtual" "final" + (virtual) ] @keyword.modifier [ diff --git a/config/neovim/store/lazy-plugins/nvim-treesitter/queries/query/highlights.scm b/config/neovim/store/lazy-plugins/nvim-treesitter/queries/query/highlights.scm index 210d03dc..c02ee3f2 100644 --- a/config/neovim/store/lazy-plugins/nvim-treesitter/queries/query/highlights.scm +++ b/config/neovim/store/lazy-plugins/nvim-treesitter/queries/query/highlights.scm @@ -5,9 +5,6 @@ (capture (identifier) @type) -(anonymous_node - (identifier) @string) - (predicate name: (identifier) @function.call) diff --git a/config/neovim/store/lazy-plugins/nvim-treesitter/queries/solidity/highlights.scm b/config/neovim/store/lazy-plugins/nvim-treesitter/queries/solidity/highlights.scm index 37f2d6df..1f1d2fe9 100644 --- a/config/neovim/store/lazy-plugins/nvim-treesitter/queries/solidity/highlights.scm +++ b/config/neovim/store/lazy-plugins/nvim-treesitter/queries/solidity/highlights.scm @@ -262,38 +262,39 @@ "=>" ] @punctuation.delimiter -; Operators: currently broken: https://github.com/JoranHonig/tree-sitter-solidity/issues/59 -;[ -; "&&" -; "||" -; ">>" -; ">>>" -; "<<" -; "&" -; "^" -; "|" -; "+" -; "-" -; "*" -; "/" -; "%" -; "**" -; "=" -; "<" -; "<=" -; "==" -; "!=" -; "!==" -; ">=" -; ">" -; "!" -; "~" -; "-" -; "+" -; "++" -; "--" -; ":=" -;] @operator +; Operators +[ + "&&" + "||" + ">>" + ">>>" + "<<" + "&" + "^" + "|" + "+" + "-" + "*" + "/" + "%" + "**" + "=" + "<" + "<=" + "==" + "!=" + "!==" + ">=" + ">" + "!" + "~" + "-" + "+" + "++" + "--" + ":=" +] @operator + [ "delete" "new" diff --git a/config/neovim/store/lazy-plugins/nvim-treesitter/scripts/format-queries.lua b/config/neovim/store/lazy-plugins/nvim-treesitter/scripts/format-queries.lua index 25f0df2a..ce89b043 100755 --- a/config/neovim/store/lazy-plugins/nvim-treesitter/scripts/format-queries.lua +++ b/config/neovim/store/lazy-plugins/nvim-treesitter/scripts/format-queries.lua @@ -200,7 +200,7 @@ local format_queries = [[ (capture) @format.prepend-space ;; Workaround to just use the string's content -(anonymous_node (identifier) @format.keep) +(anonymous_node (string) @format.keep) ; ( (_) ) handler (grouping @@ -248,7 +248,7 @@ local format_queries = [[ . [ (anonymous_node - name: (identifier) .) + name: (string) .) (named_node [ "_" diff --git a/config/neovim/store/lazy-plugins/nvim-ufo/doc/tags b/config/neovim/store/lazy-plugins/nvim-ufo/doc/tags new file mode 100644 index 00000000..788a50db --- /dev/null +++ b/config/neovim/store/lazy-plugins/nvim-ufo/doc/tags @@ -0,0 +1,3 @@ +nvim-ufo.txt ufo.txt /*nvim-ufo.txt* +nvimufo.txt ufo.txt /*nvimufo.txt* +ufo.txt ufo.txt /*ufo.txt* diff --git a/config/neovim/store/lazy-plugins/promise-async/.github/colorscheme/catppuccin.vim b/config/neovim/store/lazy-plugins/promise-async/.github/colorscheme/catppuccin.vim deleted file mode 100644 index aeb778eb..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/.github/colorscheme/catppuccin.vim +++ /dev/null @@ -1,22 +0,0 @@ -let s:c = has("nvim") == 1 ? luaeval('require("catppuccin.palettes").get_palette()') : luaeval('vim.dict(require("catppuccin.palettes").get_palette())') - -let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} -let s:p.normal.left = [ [ s:c.mantle, s:c.blue ], [ s:c.blue, s:c.base ] ] -let s:p.normal.middle = [ [ s:c.blue, s:c.mantle ] ] -let s:p.normal.right = [ [ s:c.overlay0, s:c.base ], [ s:c.blue, s:c.surface0 ] ] -let s:p.insert.left = [ [ s:c.mantle, s:c.teal ], [ s:c.blue, s:c.base ] ] -let s:p.visual.left = [ [ s:c.mantle, s:c.mauve ], [ s:c.blue, s:c.base ] ] -let s:p.replace.left = [ [ s:c.mantle, s:c.red ], [ s:c.blue, s:c.base ] ] - -let s:p.inactive.left = [ [ s:c.blue, s:c.base ], [ s:c.overlay0, s:c.base ] ] -let s:p.inactive.middle = [ [ s:c.surface1, s:c.base ] ] -let s:p.inactive.right = [ [ s:c.surface1, s:c.base ], [ s:c.overlay0, s:c.base ] ] - -let s:p.tabline.left = [ [ s:c.overlay0, s:c.base ], [ s:c.overlay0, s:c.base ] ] -let s:p.tabline.tabsel = [ [ s:c.blue, s:c.surface1 ], [ s:c.overlay0, s:c.base] ] -let s:p.tabline.middle = [ [ s:c.surface1, s:c.base ] ] -let s:p.tabline.right = copy(s:p.inactive.right) -let s:p.normal.error = [ [ s:c.mantle, s:c.red ] ] -let s:p.normal.warning = [ [ s:c.mantle, s:c.yellow ] ] - -let g:lightline#colorscheme#catppuccin#palette = lightline#colorscheme#fill(s:p) diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/barbecue/theme/catppuccin-frappe.lua b/config/neovim/store/lazy-plugins/promise-async/examples/barbecue/theme/catppuccin-frappe.lua deleted file mode 100644 index ecebd5ec..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/barbecue/theme/catppuccin-frappe.lua +++ /dev/null @@ -1 +0,0 @@ -return require "catppuccin.utils.barbecue" "frappe" diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/barbecue/theme/catppuccin-latte.lua b/config/neovim/store/lazy-plugins/promise-async/examples/barbecue/theme/catppuccin-latte.lua deleted file mode 100644 index e52461d8..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/barbecue/theme/catppuccin-latte.lua +++ /dev/null @@ -1 +0,0 @@ -return require "catppuccin.utils.barbecue" "latte" diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/barbecue/theme/catppuccin-macchiato.lua b/config/neovim/store/lazy-plugins/promise-async/examples/barbecue/theme/catppuccin-macchiato.lua deleted file mode 100644 index 5778cea3..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/barbecue/theme/catppuccin-macchiato.lua +++ /dev/null @@ -1 +0,0 @@ -return require "catppuccin.utils.barbecue" "macchiato" diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/barbecue/theme/catppuccin-mocha.lua b/config/neovim/store/lazy-plugins/promise-async/examples/barbecue/theme/catppuccin-mocha.lua deleted file mode 100644 index 044f8716..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/barbecue/theme/catppuccin-mocha.lua +++ /dev/null @@ -1 +0,0 @@ -return require "catppuccin.utils.barbecue" "mocha" diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/barbecue/theme/catppuccin.lua b/config/neovim/store/lazy-plugins/promise-async/examples/barbecue/theme/catppuccin.lua deleted file mode 100644 index b5848cf7..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/barbecue/theme/catppuccin.lua +++ /dev/null @@ -1 +0,0 @@ -return require "catppuccin.utils.barbecue"() diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/editor.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/editor.lua deleted file mode 100644 index 6a12ef66..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/editor.lua +++ /dev/null @@ -1,77 +0,0 @@ -local M = {} - -function M.get() - return { - ColorColumn = { bg = C.surface0 }, -- used for the columns set with 'colorcolumn' - Conceal = { fg = C.overlay1 }, -- placeholder characters substituted for concealed text (see 'conceallevel') - Cursor = { fg = C.base, bg = C.text }, -- character under the cursor - lCursor = { fg = C.base, bg = C.text }, -- the character under the cursor when |language-mapping| is used (see 'guicursor') - CursorIM = { fg = C.base, bg = C.text }, -- like Cursor, but used when in IME mode |CursorIM| - CursorColumn = { bg = C.mantle }, -- Screen-column at the cursor, when 'cursorcolumn' is set. - CursorLine = { - bg = U.vary_color({ latte = U.lighten(C.mantle, 0.70, C.base) }, U.darken(C.surface0, 0.64, C.base)), - }, -- Screen-line at the cursor, when 'cursorline' is set. Low-priority if forecrust (ctermfg OR guifg) is not set. - Directory = { fg = C.blue }, -- directory names (and other special names in listings) - EndOfBuffer = { fg = O.show_end_of_buffer and C.surface1 or C.base }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. - ErrorMsg = { fg = C.red, style = { "bold", "italic" } }, -- error messages on the command line - VertSplit = { fg = O.transparent_background and C.surface1 or C.crust }, -- the column separating vertically split windows - Folded = { fg = C.blue, bg = O.transparent_background and C.none or C.surface1 }, -- line used for closed folds - FoldColumn = { fg = C.overlay0 }, -- 'foldcolumn' - SignColumn = { fg = C.surface1 }, -- column where |signs| are displayed - SignColumnSB = { bg = C.crust, fg = C.surface1 }, -- column where |signs| are displayed - Substitute = { bg = C.surface1, fg = U.vary_color({ latte = C.red }, C.pink) }, -- |:substitute| replacement text highlighting - LineNr = { fg = C.surface1 }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. - CursorLineNr = { fg = C.lavender }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. highlights the number in numberline. - MatchParen = { fg = C.peach, bg = C.surface1, style = { "bold" } }, -- The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt| - ModeMsg = { fg = C.text, style = { "bold" } }, -- 'showmode' message (e.g., "-- INSERT -- ") - -- MsgArea = { fg = C.text }, -- Area for messages and cmdline, don't set this highlight because of https://github.com/neovim/neovim/issues/17832 - MsgSeparator = {}, -- Separator for scrolled messages, `msgsep` flag of 'display' - MoreMsg = { fg = C.blue }, -- |more-prompt| - NonText = { fg = C.overlay0 }, -- '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). See also |hl-EndOfBuffer|. - Normal = { fg = C.text, bg = O.transparent_background and C.none or C.base }, -- normal text - NormalNC = { - fg = C.text, - bg = (O.transparent_background and O.dim_inactive.enabled and C.dim) - or (O.dim_inactive.enabled and C.dim) - or (O.transparent_background and C.none) - or C.base, - }, -- normal text in non-current windows - NormalSB = { fg = C.text, bg = C.crust }, -- normal text in non-current windows - NormalFloat = { fg = C.text, bg = (O.transparent_background and vim.o.winblend == 0) and C.none or C.mantle }, -- Normal text in floating windows. - FloatBorder = { fg = C.blue }, - FloatTitle = { fg = C.subtext0 }, -- Title of floating windows - Pmenu = { - bg = (O.transparent_background and vim.o.pumblend == 0) and C.none or U.darken(C.surface0, 0.8, C.crust), - fg = C.overlay2, - }, -- Popup menu: normal item. - PmenuSel = { bg = C.surface1, style = { "bold" } }, -- Popup menu: selected item. - PmenuSbar = { bg = C.surface1 }, -- Popup menu: scrollbar. - PmenuThumb = { bg = C.overlay0 }, -- Popup menu: Thumb of the scrollbar. - Question = { fg = C.blue }, -- |hit-enter| prompt and yes/no questions - QuickFixLine = { bg = C.surface1, style = { "bold" } }, -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there. - Search = { bg = U.darken(C.sky, 0.30, C.base), fg = C.text }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. - IncSearch = { bg = U.darken(C.sky, 0.90, C.base), fg = C.mantle }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c" - CurSearch = { bg = C.red, fg = C.mantle }, -- 'cursearch' highlighting: highlights the current search you're on differently - SpecialKey = { link = "NonText" }, -- Unprintable characters: text displayed differently from what it really is. But not 'listchars' textspace. |hl-Whitespace| - SpellBad = { sp = C.red, style = { "undercurl" } }, -- Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise. - SpellCap = { sp = C.yellow, style = { "undercurl" } }, -- Word that should start with a capital. |spell| Combined with the highlighting used otherwise. - SpellLocal = { sp = C.blue, style = { "undercurl" } }, -- Word that is recognized by the spellchecker as one that is used in another region. |spell| Combined with the highlighting used otherwise. - SpellRare = { sp = C.green, style = { "undercurl" } }, -- Word that is recognized by the spellchecker as one that is hardly ever used. |spell| Combined with the highlighting used otherwise. - StatusLine = { fg = C.text, bg = O.transparent_background and C.none or C.mantle }, -- status line of current window - StatusLineNC = { fg = C.surface1, bg = O.transparent_background and C.none or C.mantle }, -- status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. - TabLine = { bg = C.mantle, fg = C.surface1 }, -- tab pages line, not active tab page label - TabLineFill = {}, -- tab pages line, where there are no labels - TabLineSel = { fg = C.green, bg = C.surface1 }, -- tab pages line, active tab page label - Title = { fg = C.blue, style = { "bold" } }, -- titles for output from ":set all", ":autocmd" etc. - Visual = { bg = C.surface1, style = { "bold" } }, -- Visual mode selection - VisualNOS = { bg = C.surface1, style = { "bold" } }, -- Visual mode selection when vim is "Not Owning the Selection". - WarningMsg = { fg = C.yellow }, -- warning messages - Whitespace = { fg = C.surface1 }, -- "nbsp", "space", "tab" and "trail" in 'listchars' - WildMenu = { bg = C.overlay0 }, -- current match in 'wildmenu' completion - WinBar = { fg = C.rosewater }, - WinBarNC = { link = "WinBar" }, - WinSeparator = { fg = O.transparent_background and C.surface1 or C.crust }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/NormalNvim.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/NormalNvim.lua deleted file mode 100644 index 7e711efd..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/NormalNvim.lua +++ /dev/null @@ -1,15 +0,0 @@ -local M = {} - -function M.get() - return { - MarkdownTask = { fg = C.teal, style = { "bold" } }, - MarkdownTodo = { fg = C.flamingo, style = { "bold" } }, - MarkdownNote = { fg = C.red, style = { "bold" } }, - MarkdownSee = { fg = C.blue, style = { "bold" } }, - MarkdownCheck = { fg = C.green, style = { "bold" } }, - MarkdownURL = { fg = C.lavender, style = { "bold" } }, - MarkdownExample = { fg = C.mauve, style = { "bold" } }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/aerial.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/aerial.lua deleted file mode 100644 index a0f5b0cd..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/aerial.lua +++ /dev/null @@ -1,36 +0,0 @@ -local M = {} - -function M.get() - return { - AerialLine = { fg = C.yellow, bg = C.none }, - AerialGuide = { fg = C.overlay2 }, - AerialBooleanIcon = { link = "@boolean" }, - AerialClassIcon = { link = "@type" }, - AerialConstantIcon = { link = "@constant" }, - AerialConstructorIcon = { link = "@constructor" }, - AerialFieldIcon = { link = "@field" }, - AerialFunctionIcon = { link = "@function" }, - AerialMethodIcon = { link = "@method" }, - AerialNamespaceIcon = { link = "@namespace" }, - AerialNumberIcon = { link = "@number" }, - AerialOperatorIcon = { link = "@operator" }, - AerialTypeParameterIcon = { link = "@type" }, - AerialPropertyIcon = { link = "@property" }, - AerialStringIcon = { link = "@string" }, - AerialVariableIcon = { link = "@constant" }, - AerialEnumMemberIcon = { link = "@field" }, - AerialEnumIcon = { link = "@type" }, - AerialFileIcon = { link = "@text.uri" }, - AerialModuleIcon = { link = "@namespace" }, - AerialPackageIcon = { link = "@namespace" }, - AerialInterfaceIcon = { link = "@type" }, - AerialStructIcon = { link = "@type" }, - AerialEventIcon = { link = "@type" }, - AerialArrayIcon = { link = "@constant" }, - AerialObjectIcon = { link = "@type" }, - AerialKeyIcon = { link = "@type" }, - AerialNullIcon = { link = "@type" }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/alpha.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/alpha.lua deleted file mode 100644 index 8839b11f..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/alpha.lua +++ /dev/null @@ -1,13 +0,0 @@ -local M = {} - -function M.get() - return { - AlphaShortcut = { fg = C.green }, - AlphaHeader = { fg = C.blue }, - AlphaHeaderLabel = { fg = C.peach }, - AlphaButtons = { fg = C.lavender }, - AlphaFooter = { fg = C.yellow, style = { "italic" } }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/barbar.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/barbar.lua deleted file mode 100644 index 6926ccf8..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/barbar.lua +++ /dev/null @@ -1,25 +0,0 @@ -local M = {} - -function M.get() - return { - BufferCurrent = { bg = C.surface1, fg = C.text }, - BufferCurrentIndex = { bg = C.surface1, fg = C.blue }, - BufferCurrentMod = { bg = C.surface1, fg = C.yellow }, - BufferCurrentSign = { bg = C.surface1, fg = C.blue }, - BufferCurrentTarget = { bg = C.surface1, fg = C.red }, - BufferVisible = { bg = C.mantle, fg = C.text }, - BufferVisibleIndex = { bg = C.mantle, fg = C.blue }, - BufferVisibleMod = { bg = C.mantle, fg = C.yellow }, - BufferVisibleSign = { bg = C.mantle, fg = C.blue }, - BufferVisibleTarget = { bg = C.mantle, fg = C.red }, - BufferInactive = { bg = C.mantle, fg = C.overlay0 }, - BufferInactiveIndex = { bg = C.mantle, fg = C.overlay0 }, - BufferInactiveMod = { bg = C.mantle, fg = C.yellow }, - BufferInactiveSign = { bg = C.mantle, fg = C.blue }, - BufferInactiveTarget = { bg = C.mantle, fg = C.red }, - BufferTabpages = { bg = C.mantle, fg = C.none }, - BufferTabpage = { bg = C.mantle, fg = C.blue }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/beacon.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/beacon.lua deleted file mode 100644 index 5f8280c7..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/beacon.lua +++ /dev/null @@ -1,9 +0,0 @@ -local M = {} - -function M.get() - return { - Beacon = { bg = C.blue }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/bufferline.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/bufferline.lua deleted file mode 100644 index 454fe0d2..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/bufferline.lua +++ /dev/null @@ -1,117 +0,0 @@ -local M = {} -local ctp = require "catppuccin" -local O = ctp.options - -function M.get(user_config) - user_config = user_config or {} - -- Backward compatibility - if O.integrations.bufferline then return {} end - return function() - local C = require("catppuccin.palettes").get_palette() - local transparent_background = O.transparent_background - local bg_highlight = (transparent_background and O.dim_inactive.enabled and C.dim) - or (transparent_background and "NONE") - or (O.dim_inactive.enabled and C.dim) - or C.crust - - local active_bg = transparent_background and "NONE" or C.base - local inactive_bg = transparent_background and "NONE" or C.mantle - - local separator_fg = O.transparent_background and C.surface1 or C.crust - - local styles = user_config.styles or { "bold", "italic" } - - local highlights = { - -- buffers - background = { bg = inactive_bg }, - buffer_visible = { fg = C.surface1, bg = inactive_bg }, - buffer_selected = { fg = C.text, bg = active_bg, style = styles }, -- current - -- Duplicate - duplicate_selected = { fg = C.text, bg = active_bg, style = styles }, - duplicate_visible = { fg = C.surface1, bg = inactive_bg, style = styles }, - duplicate = { fg = C.surface1, bg = inactive_bg, style = styles }, - -- tabs - tab = { fg = C.surface1, bg = inactive_bg }, - tab_selected = { fg = C.sky, bg = active_bg, bold = true }, - tab_separator = { fg = separator_fg, bg = inactive_bg }, - tab_separator_selected = { fg = separator_fg, bg = active_bg }, - - tab_close = { fg = C.red, bg = inactive_bg }, - indicator_selected = { fg = C.peach, bg = active_bg, style = styles }, - -- separators - separator = { fg = separator_fg, bg = inactive_bg }, - separator_visible = { fg = separator_fg, bg = inactive_bg }, - separator_selected = { fg = separator_fg, bg = active_bg }, - offset_separator = { fg = separator_fg, bg = active_bg }, - -- close buttons - close_button = { fg = C.surface1, bg = inactive_bg }, - close_button_visible = { fg = C.surface1, bg = inactive_bg }, - close_button_selected = { fg = C.red, bg = active_bg }, - -- Empty fill - fill = { bg = bg_highlight }, - -- Numbers - numbers = { fg = C.subtext0, bg = inactive_bg }, - numbers_visible = { fg = C.subtext0, bg = inactive_bg }, - numbers_selected = { fg = C.subtext0, bg = active_bg, style = styles }, - -- Errors - error = { fg = C.red, bg = inactive_bg }, - error_visible = { fg = C.red, bg = inactive_bg }, - error_selected = { fg = C.red, bg = active_bg, style = styles }, - error_diagnostic = { fg = C.red, bg = inactive_bg }, - error_diagnostic_visible = { fg = C.red, bg = inactive_bg }, - error_diagnostic_selected = { fg = C.red, bg = active_bg }, - -- Warnings - warning = { fg = C.yellow, bg = inactive_bg }, - warning_visible = { fg = C.yellow, bg = inactive_bg }, - warning_selected = { fg = C.yellow, bg = active_bg, style = styles }, - warning_diagnostic = { fg = C.yellow, bg = inactive_bg }, - warning_diagnostic_visible = { fg = C.yellow, bg = inactive_bg }, - warning_diagnostic_selected = { fg = C.yellow, bg = active_bg }, - -- Infos - info = { fg = C.sky, bg = inactive_bg }, - info_visible = { fg = C.sky, bg = inactive_bg }, - info_selected = { fg = C.sky, bg = active_bg, style = styles }, - info_diagnostic = { fg = C.sky, bg = inactive_bg }, - info_diagnostic_visible = { fg = C.sky, bg = inactive_bg }, - info_diagnostic_selected = { fg = C.sky, bg = active_bg }, - -- Hint - hint = { fg = C.teal, bg = inactive_bg }, - hint_visible = { fg = C.teal, bg = inactive_bg }, - hint_selected = { fg = C.teal, bg = active_bg, style = styles }, - hint_diagnostic = { fg = C.teal, bg = inactive_bg }, - hint_diagnostic_visible = { fg = C.teal, bg = inactive_bg }, - hint_diagnostic_selected = { fg = C.teal, bg = active_bg }, - -- Diagnostics - diagnostic = { fg = C.subtext0, bg = inactive_bg }, - diagnostic_visible = { fg = C.subtext0, bg = inactive_bg }, - diagnostic_selected = { fg = C.subtext0, bg = active_bg, style = styles }, - -- Modified - modified = { fg = C.peach, bg = inactive_bg }, - modified_selected = { fg = C.peach, bg = active_bg }, - } - - local user_highlights = user_config.custom or {} - highlights = - vim.tbl_deep_extend("keep", user_highlights[ctp.flavour] or {}, user_highlights.all or {}, highlights) - - for _, color in pairs(highlights) do - -- Because default is gui=bold,italic - color.italic = false - color.bold = false - - if color.style then - for _, style in pairs(color.style) do - color[style] = true - if O.no_italic and style == "italic" then color[style] = false end - if O.no_bold and style == "bold" then color[style] = false end - if O.no_underline and style == "underline" then color[style] = false end - end - end - color.style = nil - end - - return highlights - end -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/cmp.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/cmp.lua deleted file mode 100644 index 677a90f1..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/cmp.lua +++ /dev/null @@ -1,42 +0,0 @@ -local M = {} - -function M.get() - return { - CmpItemAbbr = { fg = C.overlay2 }, - CmpItemAbbrDeprecated = { fg = C.overlay0, style = { "strikethrough" } }, - CmpItemKind = { fg = C.blue }, - CmpItemMenu = { fg = C.text }, - CmpItemAbbrMatch = { fg = C.text, style = { "bold" } }, - CmpItemAbbrMatchFuzzy = { fg = C.text, style = { "bold" } }, - - -- kind support - CmpItemKindSnippet = { fg = C.mauve }, - CmpItemKindKeyword = { fg = C.red }, - CmpItemKindText = { fg = C.teal }, - CmpItemKindMethod = { fg = C.blue }, - CmpItemKindConstructor = { fg = C.blue }, - CmpItemKindFunction = { fg = C.blue }, - CmpItemKindFolder = { fg = C.blue }, - CmpItemKindModule = { fg = C.blue }, - CmpItemKindConstant = { fg = C.peach }, - CmpItemKindField = { fg = C.green }, - CmpItemKindProperty = { fg = C.green }, - CmpItemKindEnum = { fg = C.green }, - CmpItemKindUnit = { fg = C.green }, - CmpItemKindClass = { fg = C.yellow }, - CmpItemKindVariable = { fg = C.flamingo }, - CmpItemKindFile = { fg = C.blue }, - CmpItemKindInterface = { fg = C.yellow }, - CmpItemKindColor = { fg = C.red }, - CmpItemKindReference = { fg = C.red }, - CmpItemKindEnumMember = { fg = C.red }, - CmpItemKindStruct = { fg = C.blue }, - CmpItemKindValue = { fg = C.peach }, - CmpItemKindEvent = { fg = C.blue }, - CmpItemKindOperator = { fg = C.blue }, - CmpItemKindTypeParameter = { fg = C.blue }, - CmpItemKindCopilot = { fg = C.teal }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/coc_nvim.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/coc_nvim.lua deleted file mode 100644 index d9d8c3a4..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/coc_nvim.lua +++ /dev/null @@ -1,19 +0,0 @@ -local M = {} - -function M.get() - return { - -- These groups are for the coc.nvim, see ":h coc-highlights" - -- Custom popup menu since coc v0.0.82 - CocMenuSel = { link = "PmenuSel" }, - CocPumSearch = { fg = C.sky, style = { "bold" } }, - - -- Inlay hints - CocInlayHint = { - -- fg of `Comment` - fg = C.overlay0, - style = { "italic" }, - }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/colorful_winsep.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/colorful_winsep.lua deleted file mode 100644 index d4d5f885..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/colorful_winsep.lua +++ /dev/null @@ -1,9 +0,0 @@ -local M = {} - -function M.get() - return { - NvimSeparator = { bg = C.base, fg = C[O.integrations.colorful_winsep.color] }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/dap.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/dap.lua deleted file mode 100644 index 94c5f297..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/dap.lua +++ /dev/null @@ -1,13 +0,0 @@ -local M = {} - -function M.get() - return { - DapBreakpoint = { fg = C.red }, - DapBreakpointCondition = { fg = C.yellow }, - DapBreakpointRejected = { fg = C.mauve }, - DapLogPoint = { fg = C.sky }, - DapStopped = { fg = C.maroon }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/dap_ui.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/dap_ui.lua deleted file mode 100644 index 88643e96..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/dap_ui.lua +++ /dev/null @@ -1,39 +0,0 @@ -local M = {} - -function M.get() - return { - DapUIScope = { fg = C.sky }, - DapUIType = { fg = C.mauve }, - DapUIValue = { fg = C.sky }, - DapUIVariable = { fg = C.text }, - DapUIModifiedValue = { fg = C.peach }, - DapUIDecoration = { fg = C.sky }, - DapUIThread = { fg = C.green }, - DapUIStoppedThread = { fg = C.sky }, - DapUISource = { fg = C.lavender }, - DapUILineNumber = { fg = C.sky }, - DapUIFloatBorder = { fg = C.sky }, - - DapUIWatchesEmpty = { fg = C.maroon }, - DapUIWatchesValue = { fg = C.green }, - DapUIWatchesError = { fg = C.maroon }, - - DapUIBreakpointsPath = { fg = C.sky }, - DapUIBreakpointsInfo = { fg = C.green }, - DapUIBreakpointsCurrentLine = { fg = C.green, style = { "bold" } }, - DapUIBreakpointsDisabledLine = { fg = C.surface2 }, - - DapUIStepOver = { fg = C.blue }, - DapUIStepInto = { fg = C.blue }, - DapUIStepBack = { fg = C.blue }, - DapUIStepOut = { fg = C.blue }, - DapUIStop = { fg = C.red }, - DapUIPlayPause = { fg = C.green }, - DapUIRestart = { fg = C.green }, - DapUIUnavailable = { fg = C.surface1 }, - - DapUIWinSelect = { fg = C.peach }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/dashboard.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/dashboard.lua deleted file mode 100644 index 52953db4..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/dashboard.lua +++ /dev/null @@ -1,18 +0,0 @@ -local M = {} - -function M.get() - return { - DashboardShortCut = { fg = C.pink }, - DashboardHeader = { fg = C.blue }, - DashboardCenter = { fg = C.green }, - DashboardFooter = { fg = C.yellow, style = { "italic" } }, - DashboardMruTitle = { fg = C.sky }, - DashboardProjectTitle = { fg = C.sky }, - DashboardFiles = { fg = C.lavender }, - DashboardKey = { fg = C.peach }, - DashboardDesc = { fg = C.blue }, - DashboardIcon = { fg = C.pink, bold = true }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/diffview.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/diffview.lua deleted file mode 100644 index b14b482d..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/diffview.lua +++ /dev/null @@ -1,41 +0,0 @@ -local M = {} - -function M.get() - return { - DiffviewDim1 = { link = "Comment" }, - DiffviewPrimary = { fg = C.blue }, - DiffviewSecondary = { fg = C.green }, - DiffviewNormal = { fg = C.text, bg = O.transparent_background and C.none or C.mantle }, - DiffviewWinSeparator = { - fg = O.transparent_background and C.surface1 or C.base, - bg = O.transparent_background and C.none or C.base, - }, - DiffviewFilePanelTitle = { fg = C.blue, style = { "bold" } }, - DiffviewFilePanelCounter = { fg = C.text }, - DiffviewFilePanelRootPath = { fg = C.lavender, style = { "bold" } }, - DiffviewFilePanelFileName = { fg = C.text }, - DiffviewFilePanelSelected = { fg = C.yellow }, - DiffviewFilePanelPath = { link = "Comment" }, - DiffviewFilePanelInsertions = { fg = C.green }, - DiffviewFilePanelDeletions = { fg = C.red }, - DiffviewFilePanelConflicts = { fg = C.yellow }, - DiffviewFolderName = { fg = C.blue, style = { "bold" } }, - DiffviewFolderSign = { fg = C.blue }, - DiffviewHash = { fg = C.flamingo }, - DiffviewReference = { fg = C.blue, style = { "bold" } }, - DiffviewReflogSelector = { fg = C.pink }, - DiffviewStatusAdded = { fg = C.green }, - DiffviewStatusUntracked = { fg = C.green }, - DiffviewStatusModified = { fg = C.yellow }, - DiffviewStatusRenamed = { fg = C.yellow }, - DiffviewStatusCopied = { fg = C.yellow }, - DiffviewStatusTypeChange = { fg = C.yellow }, - DiffviewStatusUnmerged = { fg = C.yellow }, - DiffviewStatusUnknown = { fg = C.red }, - DiffviewStatusDeleted = { fg = C.red }, - DiffviewStatusBroken = { fg = C.red }, - DiffviewStatusIgnored = { fg = C.overlay0 }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/dropbar.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/dropbar.lua deleted file mode 100644 index 712a9148..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/dropbar.lua +++ /dev/null @@ -1,69 +0,0 @@ -local M = {} - -function M.get() - local color = O.integrations.dropbar.color_mode - return { - DropBarMenuHoverEntry = { link = "Visual" }, - DropBarMenuHoverIcon = { reverse = true }, - DropBarMenuHoverSymbol = { bold = true }, - DropBarIconUISeparator = { fg = C.overlay1 }, - DropBarKindArray = color and { link = "DropBarIconKindArray" } or { fg = C.text }, - DropBarKindBoolean = color and { link = "DropBarIconKindBoolean" } or { fg = C.text }, - DropBarKindBreakStatement = color and { link = "DropBarIconKindBreakStatement" } or { fg = C.text }, - DropBarKindCall = color and { link = "DropBarIconKindCall" } or { fg = C.text }, - DropBarKindCaseStatement = color and { link = "DropBarIconKindCaseStatement" } or { fg = C.text }, - DropBarKindClass = color and { link = "DropBarIconKindClass" } or { fg = C.text }, - DropBarKindConstant = color and { link = "DropBarIconKindConstant" } or { fg = C.text }, - DropBarKindConstructor = color and { link = "DropBarIconKindConstructor" } or { fg = C.text }, - DropBarKindContinueStatement = color and { link = "DropBarIconKindContinueStatement" } or { fg = C.text }, - DropBarKindDeclaration = color and { link = "DropBarIconKindDeclaration" } or { fg = C.text }, - DropBarKindDelete = color and { link = "DropBarIconKindDelete" } or { fg = C.text }, - DropBarKindDoStatement = color and { link = "DropBarIconKindDoStatement" } or { fg = C.text }, - DropBarKindElseStatement = color and { link = "DropBarIconKindElseStatement" } or { fg = C.text }, - DropBarKindEnum = color and { link = "DropBarIconKindEnum" } or { fg = C.text }, - DropBarKindEnumMember = color and { link = "DropBarIconKindEnumMember" } or { fg = C.text }, - DropBarKindEvent = color and { link = "DropBarIconKindEvent" } or { fg = C.text }, - DropBarKindField = color and { link = "DropBarIconKindField" } or { fg = C.text }, - DropBarKindFile = color and { link = "DropBarIconKindFile" } or { fg = C.text }, - DropBarKindFolder = color and { link = "DropBarIconKindFolder" } or { fg = C.text }, - DropBarKindForStatement = color and { link = "DropBarIconKindForStatement" } or { fg = C.text }, - DropBarKindFunction = color and { link = "DropBarIconKindFunction" } or { fg = C.text }, - DropBarKindIdentifier = color and { link = "DropBarIconKindIdentifier" } or { fg = C.text }, - DropBarKindIfStatement = color and { link = "DropBarIconKindIfStatement" } or { fg = C.text }, - DropBarKindInterface = color and { link = "DropBarIconKindInterface" } or { fg = C.text }, - DropBarKindKeyword = color and { link = "DropBarIconKindKeyword" } or { fg = C.text }, - DropBarKindList = color and { link = "DropBarIconKindList" } or { fg = C.text }, - DropBarKindMacro = color and { link = "DropBarIconKindMacro" } or { fg = C.text }, - DropBarKindMarkdownH1 = color and { link = "DropBarIconKindMarkdownH1" } or { fg = C.text }, - DropBarKindMarkdownH2 = color and { link = "DropBarIconKindMarkdownH2" } or { fg = C.text }, - DropBarKindMarkdownH3 = color and { link = "DropBarIconKindMarkdownH3" } or { fg = C.text }, - DropBarKindMarkdownH4 = color and { link = "DropBarIconKindMarkdownH4" } or { fg = C.text }, - DropBarKindMarkdownH5 = color and { link = "DropBarIconKindMarkdownH5" } or { fg = C.text }, - DropBarKindMarkdownH6 = color and { link = "DropBarIconKindMarkdownH6" } or { fg = C.text }, - DropBarKindMethod = color and { link = "DropBarIconKindMethod" } or { fg = C.text }, - DropBarKindModule = color and { link = "DropBarIconKindModule" } or { fg = C.text }, - DropBarKindNamespace = color and { link = "DropBarIconKindNamespace" } or { fg = C.text }, - DropBarKindNull = color and { link = "DropBarIconKindNull" } or { fg = C.text }, - DropBarKindNumber = color and { link = "DropBarIconKindNumber" } or { fg = C.text }, - DropBarKindObject = color and { link = "DropBarIconKindObject" } or { fg = C.text }, - DropBarKindOperator = color and { link = "DropBarIconKindOperator" } or { fg = C.text }, - DropBarKindPackage = color and { link = "DropBarIconKindPackage" } or { fg = C.text }, - DropBarKindProperty = color and { link = "DropBarIconKindProperty" } or { fg = C.text }, - DropBarKindReference = color and { link = "DropBarIconKindReference" } or { fg = C.text }, - DropBarKindRepeat = color and { link = "DropBarIconKindRepeat" } or { fg = C.text }, - DropBarKindScope = color and { link = "DropBarIconKindScope" } or { fg = C.text }, - DropBarKindSpecifier = color and { link = "DropBarIconKindSpecifier" } or { fg = C.text }, - DropBarKindStatement = color and { link = "DropBarIconKindStatement" } or { fg = C.text }, - DropBarKindString = color and { link = "DropBarIconKindString" } or { fg = C.text }, - DropBarKindStruct = color and { link = "DropBarIconKindStruct" } or { fg = C.text }, - DropBarKindSwitchStatement = color and { link = "DropBarIconKindSwitchStatement" } or { fg = C.text }, - DropBarKindType = color and { link = "DropBarIconKindType" } or { fg = C.text }, - DropBarKindTypeParameter = color and { link = "DropBarIconKindTypeParameter" } or { fg = C.text }, - DropBarKindUnit = color and { link = "DropBarIconKindUnit" } or { fg = C.text }, - DropBarKindValue = color and { link = "DropBarIconKindValue" } or { fg = C.text }, - DropBarKindVariable = color and { link = "DropBarIconKindVariable" } or { fg = C.text }, - DropBarKindWhileStatement = color and { link = "DropBarIconKindWhileStatement" } or { fg = C.text }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/feline.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/feline.lua deleted file mode 100644 index f0d9c024..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/feline.lua +++ /dev/null @@ -1,501 +0,0 @@ -local M = {} - -local C = require("catppuccin.palettes").get_palette() -local lsp = require "feline.providers.lsp" - -local assets = { - left_separator = "", - right_separator = "", - mode_icon = "", - dir = "󰉖", - file = "󰈙", - lsp = { - server = "󰅡", - error = "", - warning = "", - info = "", - hint = "", - }, - git = { - branch = "", - added = "", - changed = "", - removed = "", - }, -} - -local sett = { - text = C.mantle, - bkg = C.crust, - diffs = C.mauve, - extras = C.overlay1, - curr_file = C.maroon, - curr_dir = C.flamingo, - show_modified = false, -} - -if require("catppuccin").flavour == "latte" then - local latte = require("catppuccin.palettes").get_palette "latte" - sett.text = latte.base - sett.bkg = latte.crust -end - -if require("catppuccin").options.transparent_background then sett.bkg = "NONE" end - -local mode_colors = { - ["n"] = { "NORMAL", C.lavender }, - ["no"] = { "N-PENDING", C.lavender }, - ["i"] = { "INSERT", C.green }, - ["ic"] = { "INSERT", C.green }, - ["t"] = { "TERMINAL", C.green }, - ["v"] = { "VISUAL", C.flamingo }, - ["V"] = { "V-LINE", C.flamingo }, - [""] = { "V-BLOCK", C.flamingo }, - ["R"] = { "REPLACE", C.maroon }, - ["Rv"] = { "V-REPLACE", C.maroon }, - ["s"] = { "SELECT", C.maroon }, - ["S"] = { "S-LINE", C.maroon }, - [""] = { "S-BLOCK", C.maroon }, - ["c"] = { "COMMAND", C.peach }, - ["cv"] = { "COMMAND", C.peach }, - ["ce"] = { "COMMAND", C.peach }, - ["r"] = { "PROMPT", C.teal }, - ["rm"] = { "MORE", C.teal }, - ["r?"] = { "CONFIRM", C.mauve }, - ["!"] = { "SHELL", C.green }, -} - -local view = { - lsp = { - progress = true, - name = false, - exclude_lsp_names = {}, - separator = "|", - }, -} - -local is_lsp_in_excluded_list = function(lsp_name) - for _, excluded_lsp in ipairs(view.lsp.exclude_lsp_names) do - if lsp_name == excluded_lsp then return true end - end - return false -end - -function M.setup(opts) - if opts then - opts.assets = opts.assets or {} - opts.sett = opts.sett or {} - opts.mode_colors = opts.mode_colors or {} - opts.view = opts.view or {} - else - opts = { - assets = {}, - sett = {}, - mode_colors = {}, - view = {}, - } - end - assets = vim.tbl_deep_extend("force", assets, opts.assets) - sett = vim.tbl_deep_extend("force", sett, opts.sett) - mode_colors = vim.tbl_deep_extend("force", mode_colors, opts.mode_colors) - view = vim.tbl_deep_extend("force", view, opts.view) -end - -function M.get() - local shortline = false - - local components = { - active = { {}, {}, {} }, -- left, center, right - inactive = { {} }, - } - - local function is_enabled(min_width) - if shortline then return true end - - return vim.api.nvim_win_get_width(0) > min_width - end - - -- global components - local invi_sep = { - str = " ", - hl = { - fg = sett.bkg, - bg = sett.bkg, - }, - } - - -- helpers - local function any_git_changes() - local gst = vim.b.gitsigns_status_dict -- git stats - if gst then - if - gst["added"] and gst["added"] > 0 - or gst["removed"] and gst["removed"] > 0 - or gst["changed"] and gst["changed"] > 0 - then - return true - end - end - return false - end - - -- #################### STATUSLINE -> - - -- ######## Left - - -- Current vi mode ------> - local vi_mode_hl = function() - return { - fg = sett.text, - bg = mode_colors[vim.fn.mode()][2], - style = "bold", - } - end - - components.active[1][1] = { - provider = " " .. assets.mode_icon .. " ", - hl = function() - return { - fg = sett.text, - bg = mode_colors[vim.fn.mode()][2], - } - end, - } - - components.active[1][2] = { - provider = function() return mode_colors[vim.fn.mode()][1] .. " " end, - hl = vi_mode_hl, - } - - -- there is a dilemma: we need to hide Diffs if there is no git info. We can do that, but this will - -- leave the right_separator colored with purple, and since we can't change the color conditonally - -- then the solution is to create two right_separators: one with a mauve sett.bkg and the other one normal - -- sett.bkg; both have the same fg (vi mode). The mauve one appears if there is git info, else the one with - -- the normal sett.bkg appears. Fixed :) - - -- enable if git diffs are not available - components.active[1][3] = { - provider = assets.right_separator, - hl = function() - return { - fg = mode_colors[vim.fn.mode()][2], - bg = sett.bkg, - } - end, - enabled = function() return not any_git_changes() end, - } - - -- enable if git diffs are available - components.active[1][4] = { - provider = assets.right_separator, - hl = function() - return { - fg = mode_colors[vim.fn.mode()][2], - bg = sett.diffs, - } - end, - enabled = function() return any_git_changes() end, - } - -- Current vi mode ------> - - -- Diffs ------> - components.active[1][5] = { - provider = "git_diff_added", - hl = { - fg = sett.text, - bg = sett.diffs, - }, - icon = " " .. assets.git.added .. " ", - } - - components.active[1][6] = { - provider = "git_diff_changed", - hl = { - fg = sett.text, - bg = sett.diffs, - }, - icon = " " .. assets.git.changed .. " ", - } - - components.active[1][7] = { - provider = "git_diff_removed", - hl = { - fg = sett.text, - bg = sett.diffs, - }, - icon = " " .. assets.git.removed .. " ", - } - - components.active[1][8] = { - provider = " ", - hl = { - fg = sett.bkg, - bg = sett.diffs, - }, - enabled = function() return any_git_changes() end, - } - - components.active[1][9] = { - provider = assets.right_separator, - hl = { - fg = sett.diffs, - bg = sett.bkg, - }, - enabled = function() return any_git_changes() end, - } - -- Diffs ------> - - -- Extras ------> - - -- file progress - components.active[1][10] = { - provider = function() - local current_line = vim.fn.line "." - local total_line = vim.fn.line "$" - - if current_line == 1 then - return "Top" - elseif current_line == vim.fn.line "$" then - return "Bot" - end - local result, _ = math.modf((current_line / total_line) * 100) - return result .. "%%" - end, - -- enabled = shortline or function(winid) - -- return vim.api.nvim_win_get_width(winid) > 90 - -- end, - hl = { - fg = sett.extras, - bg = sett.bkg, - }, - left_sep = invi_sep, - } - - -- position - components.active[1][11] = { - provider = "position", - -- enabled = shortline or function(winid) - -- return vim.api.nvim_win_get_width(winid) > 90 - -- end, - hl = { - fg = sett.extras, - bg = sett.bkg, - }, - left_sep = invi_sep, - } - - -- macro - components.active[1][12] = { - provider = "macro", - enabled = function() return vim.api.nvim_get_option "cmdheight" == 0 end, - hl = { - fg = sett.extras, - bg = sett.bkg, - }, - left_sep = invi_sep, - } - - -- search count - components.active[1][13] = { - provider = "search_count", - enabled = function() return vim.api.nvim_get_option "cmdheight" == 0 end, - hl = { - fg = sett.extras, - bg = sett.bkg, - }, - left_sep = invi_sep, - } - -- Extras ------> - - -- ######## Left - - -- ######## Center - - -- Diagnostics ------> - -- workspace loader - components.active[2][1] = { - provider = function() - if vim.lsp.status then return "" end - local Lsp = vim.lsp.util.get_progress_messages()[1] - - if Lsp then - local msg = Lsp.message or "" - local percentage = Lsp.percentage - if not percentage then return "" end - local title = Lsp.title or "" - local spinners = { - "", - "󰀚", - "", - } - local success_icon = { - "", - "", - "", - } - local ms = vim.loop.hrtime() / 1000000 - local frame = math.floor(ms / 120) % #spinners - - if percentage >= 70 then - return string.format(" %%<%s %s %s (%s%%%%) ", success_icon[frame + 1], title, msg, percentage) - end - - return string.format(" %%<%s %s %s (%s%%%%) ", spinners[frame + 1], title, msg, percentage) - end - - return "" - end, - enabled = is_enabled(80) and view.lsp.progress == true, - hl = { - fg = C.rosewater, - bg = sett.bkg, - }, - } - - -- general diagnostics (errors, warnings. info and hints) - components.active[2][2] = { - provider = "diagnostic_errors", - enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.ERROR) end, - - hl = { - fg = C.red, - bg = sett.bkg, - }, - icon = " " .. assets.lsp.error .. " ", - } - - components.active[2][3] = { - provider = "diagnostic_warnings", - enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.WARN) end, - hl = { - fg = C.yellow, - bg = sett.bkg, - }, - icon = " " .. assets.lsp.warning .. " ", - } - - components.active[2][4] = { - provider = "diagnostic_info", - enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.INFO) end, - hl = { - fg = C.sky, - bg = sett.bkg, - }, - icon = " " .. assets.lsp.info .. " ", - } - - components.active[2][5] = { - provider = "diagnostic_hints", - enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.HINT) end, - hl = { - fg = C.rosewater, - bg = sett.bkg, - }, - icon = " " .. assets.lsp.hint .. " ", - } - -- Diagnostics ------> - - -- ######## Center - - -- ######## Right - - components.active[3][1] = { - provider = "git_branch", - enabled = is_enabled(70), - hl = { - fg = sett.extras, - bg = sett.bkg, - }, - icon = assets.git.branch .. " ", - right_sep = invi_sep, - } - - components.active[3][2] = { - provider = function() - local active_clients = vim.lsp.get_active_clients { bufnr = 0 } - - -- show an indicator that we have running lsps - if view.lsp.name == false and next(active_clients) ~= nil then return assets.lsp.server .. " " .. "Lsp" end - - -- show the actual name of the runing lsps - local index = 0 - local lsp_names = "" - for _, lsp_config in ipairs(active_clients) do - if is_lsp_in_excluded_list(lsp_config.name) then goto continue end - - index = index + 1 - if index == 1 then - lsp_names = assets.lsp.server .. " " .. lsp_config.name - else - lsp_names = lsp_names .. view.lsp.separator .. lsp_config.name - end - - ::continue:: - end - - return lsp_names - end, - - hl = { - fg = sett.extras, - bg = sett.bkg, - }, - - right_sep = invi_sep, - } - - components.active[3][3] = { - provider = function() - local filename = vim.fn.expand "%:t" - local extension = vim.fn.expand "%:e" - local present, icons = pcall(require, "nvim-web-devicons") - local icon = present and icons.get_icon(filename, extension) or assets.file - return (sett.show_modified and "%m" or "") .. " " .. icon .. " " .. filename .. " " - end, - enabled = is_enabled(70), - hl = { - fg = sett.text, - bg = sett.curr_file, - }, - left_sep = { - str = assets.left_separator, - hl = { - fg = sett.curr_file, - bg = sett.bkg, - }, - }, - } - - components.active[3][4] = { - provider = function() - local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t") - return " " .. assets.dir .. " " .. dir_name .. " " - end, - enabled = is_enabled(80), - hl = { - fg = sett.text, - bg = sett.curr_dir, - }, - left_sep = { - str = assets.left_separator, - hl = { - fg = sett.curr_dir, - bg = sett.curr_file, - }, - }, - } - -- ######## Right - - -- Inanctive components - components.inactive[1][1] = { - provider = function() return " " .. string.upper(vim.bo.ft) .. " " end, - hl = { - fg = C.overlay2, - bg = C.mantle, - }, - } - - return components -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/fern.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/fern.lua deleted file mode 100644 index 4e951d9d..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/fern.lua +++ /dev/null @@ -1,9 +0,0 @@ -local M = {} - -function M.get() - return { - FernBranchText = { fg = C.blue }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/fidget.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/fidget.lua deleted file mode 100644 index 90882323..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/fidget.lua +++ /dev/null @@ -1,13 +0,0 @@ -local M = {} - -function M.get() - return { - FidgetTask = { - bg = O.transparent_background and C.none or C.mantle, - fg = C.text, - }, - FidgetTitle = { fg = C.blue }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/flash.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/flash.lua deleted file mode 100644 index 1a746b6b..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/flash.lua +++ /dev/null @@ -1,14 +0,0 @@ -local M = {} - -function M.get() - local bg = O.transparent_background and C.none or C.base - return { - FlashBackdrop = { fg = C.overlay0 }, - FlashLabel = { fg = C.green, bg = bg, style = { "bold" } }, - FlashMatch = { fg = C.lavender, bg = bg }, - FlashCurrent = { fg = C.peach, bg = bg }, - FlashPrompt = { link = "NormalFloat" }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/gitgutter.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/gitgutter.lua deleted file mode 100644 index 6a8c4fc8..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/gitgutter.lua +++ /dev/null @@ -1,11 +0,0 @@ -local M = {} - -function M.get() - return { - GitGutterAdd = { fg = C.green }, - GitGutterChange = { fg = C.yellow }, - GitGutterDelete = { fg = C.red }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/gitsigns.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/gitsigns.lua deleted file mode 100644 index 6bc89403..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/gitsigns.lua +++ /dev/null @@ -1,53 +0,0 @@ -local M = {} - -function M.get() - if type(O.integrations.gitsigns) == "boolean" then - O.integrations.gitsigns = { enabled = true, transparent = false } - end - - if O.transparent_background then - return { - GitSignsAdd = { fg = C.green }, -- diff mode: Added line |diff.txt| - GitSignsChange = { fg = C.yellow }, -- diff mode: Changed line |diff.txt| - GitSignsDelete = { fg = C.red }, -- diff mode: Deleted line |diff.txt| - - GitSignsCurrentLineBlame = { fg = C.surface1 }, - - GitSignsAddPreview = O.transparent_background and { fg = U.darken(C.green, 0.72, C.base), bg = C.none } - or { link = "DiffAdd" }, - GitSignsDeletePreview = O.transparent_background and { fg = U.darken(C.red, 0.72, C.base), bg = C.none } - or { link = "DiffDelete" }, - -- for word diff in previews - GitSignsAddInline = O.transparent_background and { - fg = C.green, - bg = C.none, - style = { "bold" }, - } or { link = "DiffAdd" }, - GitSignsDeleteInline = O.transparent_background and { - fg = C.red, - bg = C.none, - style = { "bold" }, - } or { link = "DiffDelete" }, - GitSignsChangeInline = O.transparent_background and { - fg = C.yellow, - bg = C.none, - style = { "bold" }, - } or { link = "DiffChange" }, - - GitSignsDeleteVirtLn = O.transparent_background and { bg = C.none, fg = C.red } or { link = "DiffDelete" }, - } - else - return { - GitSignsAdd = { fg = C.green }, -- diff mode: Added line |diff.txt| - GitSignsChange = { fg = C.yellow }, -- diff mode: Changed line |diff.txt| - GitSignsDelete = { fg = C.red }, -- diff mode: Deleted line |diff.txt| - - GitSignsCurrentLineBlame = { fg = C.surface1 }, - - GitSignsAddPreview = O.transparent_background and { fg = C.green, bg = C.none } or { link = "DiffAdd" }, - GitSignsDeletePreview = O.transparent_background and { fg = C.red, bg = C.none } or { link = "DiffDelete" }, - } - end -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/harpoon.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/harpoon.lua deleted file mode 100644 index 29bc2078..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/harpoon.lua +++ /dev/null @@ -1,10 +0,0 @@ -local M = {} - -function M.get() - return { - HarpoonWindow = { fg = C.text, bg = O.transparent_background and C.none or C.base }, - HarpoonBorder = { fg = C.blue }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/headlines.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/headlines.lua deleted file mode 100644 index 2b4f49c7..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/headlines.lua +++ /dev/null @@ -1,18 +0,0 @@ -local M = {} - -function M.get() - return { - Dash = { fg = C.overlay2, style = { "bold" } }, - Quote = { link = "@markup.strong" }, - CodeBlock = { bg = C.mantle }, - Headline = { link = "Headline1" }, - Headline1 = { bg = C.surface0, fg = C.red }, - Headline2 = { bg = C.surface0, fg = C.peach }, - Headline3 = { bg = C.surface0, fg = C.yellow }, - Headline4 = { bg = C.surface0, fg = C.green }, - Headline5 = { bg = C.surface0, fg = C.sapphire }, - Headline6 = { bg = C.surface0, fg = C.lavender }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/hop.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/hop.lua deleted file mode 100644 index 1f989837..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/hop.lua +++ /dev/null @@ -1,13 +0,0 @@ -local M = {} - -function M.get() - local bg = O.transparent_background and C.none or C.base - return { - HopNextKey = { bg = bg, fg = C.peach, style = { "bold", "underline" } }, - HopNextKey1 = { bg = bg, fg = C.blue, style = { "bold" } }, - HopNextKey2 = { bg = bg, fg = C.teal, style = { "bold", "italic" } }, - HopUnmatched = { bg = bg, fg = C.overlay0 }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/illuminate.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/illuminate.lua deleted file mode 100644 index f214affe..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/illuminate.lua +++ /dev/null @@ -1,14 +0,0 @@ -local M = {} - -function M.get() - return { - IlluminatedWordText = { bg = U.darken(C.surface1, 0.7, C.base) }, - IlluminatedWordRead = { bg = U.darken(C.surface1, 0.7, C.base) }, - IlluminatedWordWrite = { - bg = U.darken(C.surface1, 0.7, C.base), - style = O.integrations.illuminate.lsp and { "standout" } or {}, - }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/indent_blankline.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/indent_blankline.lua deleted file mode 100644 index 15b94e69..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/indent_blankline.lua +++ /dev/null @@ -1,24 +0,0 @@ -local M = {} - -function M.get() - local scope_color = O.integrations.indent_blankline.scope_color - - local hi = { - IblIndent = { fg = C.surface0 }, - IblScope = { fg = C[scope_color] or C.text }, - } - - if O.integrations.indent_blankline.colored_indent_levels then - hi["RainbowRed"] = { blend = 0, fg = C.red } - hi["RainbowYellow"] = { blend = 0, fg = C.yellow } - hi["RainbowBlue"] = { blend = 0, fg = C.blue } - hi["RainbowOrange"] = { blend = 0, fg = C.peach } - hi["RainbowGreen"] = { blend = 0, fg = C.green } - hi["RainbowViolet"] = { blend = 0, fg = C.mauve } - hi["RainbowCyan"] = { blend = 0, fg = C.teal } - end - - return hi -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/leap.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/leap.lua deleted file mode 100644 index b9bb2943..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/leap.lua +++ /dev/null @@ -1,24 +0,0 @@ -local M = {} - -function M.get() - return { - LeapMatch = { - fg = O.transparent_background and C.pink or U.vary_color({ latte = "#222222" }, U.brighten(C.green, 0.3)), - style = { "underline", "nocombine", O.transparent_background and "bold" or nil }, - }, - LeapLabelPrimary = { - fg = O.transparent_background and C.green or U.vary_color({ latte = "#222222" }, C.base), - bg = O.transparent_background and C.none - or U.vary_color({ latte = U.brighten(C.red, 0.4) }, U.brighten(C.green, 0.3)), - style = { "nocombine", O.transparent_background and "bold" or nil }, - }, - LeapLabelSecondary = { - fg = O.transparent_background and C.blue or U.vary_color({ latte = "#222222" }, C.base), - bg = O.transparent_background and C.none or U.vary_color({ latte = U.brighten(C.sky, 0.3) }, C.sky), - style = { "nocombine", O.transparent_background and "bold" or nil }, - }, - LeapBackdrop = { fg = O.transparent_background and C.overlay0 or C.none }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/lightspeed.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/lightspeed.lua deleted file mode 100644 index c7039ee1..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/lightspeed.lua +++ /dev/null @@ -1,27 +0,0 @@ -local M = {} - -function M.get() - return { - LightspeedLabel = { fg = C.red, style = { "bold", "underline" } }, - LightspeedLabelDistant = { - fg = U.vary_color({ latte = C.blue }, C.sky), - style = { "bold", "underline" }, - }, - LightspeedShortcut = { - fg = "#ffffff", - bg = U.increase_saturation(C.red, 0.7), - style = { "bold" }, - }, - LightspeedMaskedChar = { - fg = U.vary_color({ latte = U.lighten(C.pink, 0.7, C.text) }, U.darken(C.pink, 0.7, C.base)), - }, - LightspeedUnlabeledMatch = { fg = C.text, style = { "bold" } }, - LightspeedGreyWash = { link = "Comment" }, - LightspeedUniqueChar = { link = "LightspeedUnlabeledMatch" }, - LightspeedOneCharMatch = { link = "LightspeedShortcut" }, - LightspeedPendingOpArea = { link = "IncSearch" }, - LightspeedCursor = { link = "Cursor" }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/lsp_saga.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/lsp_saga.lua deleted file mode 100644 index 28d71212..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/lsp_saga.lua +++ /dev/null @@ -1,132 +0,0 @@ -local M = {} - -function M.get() - return { - SagaTitle = { fg = C.teal, style = { "bold" } }, - SagaBorder = { fg = C.blue, bg = C.none }, - SagaNormal = { bg = O.transparent_background and C.none or C.base }, - SagaToggle = { fg = C.green }, - SagaCount = { fg = C.overlay1 }, - SagaBeacon = { bg = U.darken(C.surface0, 0.8, C.crust) }, - SagaVirtLine = { fg = C.surface2 }, - SagaSpinner = { fg = C.mauve, style = { "bold" } }, - SagaSpinnerTitle = { fg = C.mauve, style = { "bold" } }, - SagaText = { fg = C.text }, - SagaSelect = { fg = C.blue, style = { "bold" } }, - SagaSearch = { link = "Search" }, - SagaFinderFname = { fg = C.subtext0, style = { "bold" } }, - ActionFix = { fg = C.pink }, - ActionPreviewTitle = { fg = C.mauve, bg = O.transparent_background and C.none or C.base }, - CodeActionText = { fg = C.green }, - CodeActionNumber = { fg = C.pink }, - SagaImpIcon = { fg = C.pink }, - SagaLightBulb = { link = "DiagnosticSignHint" }, - RenameNormal = { fg = C.text }, - RenameMatch = { link = "Search" }, - DiagnosticText = { fg = C.text }, - SagaWinbarSep = { fg = C.flamingo }, - SagaDetail = { link = "Comment" }, - SagaFileName = { fg = C.overlay2, style = { "bold" } }, - SagaFolderName = { fg = C.overlay2, style = { "bold" } }, - SagaInCurrent = { fg = C.peach }, - - -- Lspkind icons support - LspKindClass = { fg = C.yellow }, - LspKindConstant = { fg = C.peach }, - LspKindConstructor = { fg = C.sapphire }, - LspKindEnum = { fg = C.yellow }, - LspKindEnumMember = { fg = C.teal }, - LspKindEvent = { fg = C.yellow }, - LspKindField = { fg = C.teal }, - LspKindFile = { fg = C.rosewater }, - LspKindFunction = { fg = C.blue }, - LspKindInterface = { fg = C.yellow }, - LspKindKey = { fg = C.red }, - LspKindMethod = { fg = C.blue }, - LspKindModule = { fg = C.blue }, - LspKindNamespace = { fg = C.blue }, - LspKindNumber = { fg = C.peach }, - LspKindOperator = { fg = C.sky }, - LspKindPackage = { fg = C.blue }, - LspKindProperty = { fg = C.teal }, - LspKindStruct = { fg = C.yellow }, - LspKindTypeParameter = { fg = C.blue }, - LspKindVariable = { fg = C.peach }, - LspKindArray = { fg = C.peach }, - LspKindBoolean = { fg = C.peach }, - LspKindNull = { fg = C.yellow }, - LspKindObject = { fg = C.yellow }, - LspKindString = { fg = C.green }, - -- ccls-specific icons. - LspKindTypeAlias = { fg = C.green }, - LspKindParameter = { fg = C.blue }, - LspKindStaticMethod = { fg = C.peach }, - -- Microsoft-specific icons. - LspKindText = { fg = C.green }, - LspKindSnippet = { fg = C.mauve }, - LspKindFolder = { fg = C.blue }, - LspKindUnit = { fg = C.green }, - LspKindValue = { fg = C.peach }, - } -end - -function M.custom_kind() - return { - File = { "󰈙 ", "LspKindFile" }, - Module = { " ", "LspKindModule" }, - Namespace = { "󰌗 ", "LspKindNamespace" }, - Package = { "󰏖 ", "LspKindPackage" }, - Class = { "󰌗 ", "LspKindClass" }, - Method = { " ", "LspKindMethod" }, - Property = { "󰆧 ", "LspKindProperty" }, - Field = { " ", "LspKindField" }, - Constructor = { " ", "LspKindConstructor" }, - Enum = { "󰒻", "LspKindEnum" }, - Interface = { " ", "LspKindInterface" }, - Function = { "󰊕 ", "LspKindFunction" }, - Variable = { " ", "LspKindVariable" }, - Constant = { " ", "LspKindConstant" }, - String = { "󰀬 ", "LspKindString" }, - Number = { "󰎠 ", "LspKindNumber" }, - Boolean = { " ", "LspKindBoolean" }, - Array = { "󰅪 ", "LspKindArray" }, - Object = { "󰅩 ", "LspKindObject" }, - Key = { "󰌋 ", "LspKindKey" }, - Null = { " ", "LspKindNull" }, - EnumMember = { " ", "LspKindEnumMember" }, - Struct = { "󰌗 ", "LspKindStruct" }, - Event = { " ", "LspKindEvent" }, - Operator = { "󰆕 ", "LspKindOperator" }, - TypeParameter = { "󰊄 ", "LspKindTypeParameter" }, - TypeAlias = { " ", "LspKindTypeAlias" }, - Parameter = { " ", "LspKindParameter" }, - StaticMethod = { "󰠄 ", "LspKindStaticMethod" }, - Macro = { " ", "LspKindMacro" }, - Text = { "󰉿 ", "LspKindText" }, - Snippet = { " ", "LspKindSnippet" }, - Folder = { " ", "LspKindFolder" }, - Unit = { "󰉻 ", "LspKindUnit" }, - Value = { " ", "LspKindValue" }, - } -end - --- Backwards compatibility -function M.custom_colors() - local C = require("catppuccin.palettes").get_palette() - return { - normal_bg = C.base, - title_bg = C.green, - red = C.red, - magenta = C.maroon, - orange = C.peach, - yellow = C.yellow, - green = C.green, - cyan = C.sky, - blue = C.blue, - purple = C.mauve, - white = C.text, - black = C.crust, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/lsp_trouble.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/lsp_trouble.lua deleted file mode 100644 index 4a5005ab..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/lsp_trouble.lua +++ /dev/null @@ -1,11 +0,0 @@ -local M = {} - -function M.get() - return { - TroubleText = { fg = C.green }, - TroubleCount = { fg = C.pink, bg = O.transparent_background and C.none or C.surface1 }, - TroubleNormal = { fg = C.text, bg = O.transparent_background and C.none or C.crust }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/markdown.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/markdown.lua deleted file mode 100644 index a852f709..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/markdown.lua +++ /dev/null @@ -1,18 +0,0 @@ -local M = {} - -function M.get() - return { - markdownHeadingDelimiter = { fg = C.peach, style = { "bold" } }, - markdownCode = { fg = C.flamingo }, - markdownCodeBlock = { fg = C.flamingo }, - markdownLinkText = { fg = C.blue, style = { "underline" } }, - markdownH1 = { link = "rainbow1" }, - markdownH2 = { link = "rainbow2" }, - markdownH3 = { link = "rainbow3" }, - markdownH4 = { link = "rainbow4" }, - markdownH5 = { link = "rainbow5" }, - markdownH6 = { link = "rainbow6" }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/mason.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/mason.lua deleted file mode 100644 index ea510773..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/mason.lua +++ /dev/null @@ -1,38 +0,0 @@ -local M = {} - -function M.get() - local bg = O.transparent_background and C.none or C.lavender - local fg = O.transparent_background and C.lavender or C.base - - local secondary_bg = O.transparent_background and C.none or C.blue - local secondary_fg = O.transparent_background and C.blue or C.base - - local muted_bg = O.transparent_background and C.none or C.overlay0 - local muted_fg = O.transparent_background and C.overlay0 or C.base - - return { - MasonHeader = { fg = fg, bg = bg, style = { "bold" } }, - MasonHeaderSecondary = { fg = secondary_fg, bg = secondary_bg, style = { "bold" } }, - - MasonHighlight = { fg = C.green }, - MasonHighlightBlock = { - bg = O.transparent_background and C.none or C.green, - fg = O.transparent_background and C.green or C.base, - }, - MasonHighlightBlockBold = { bg = secondary_bg, fg = secondary_fg, bold = true }, - - MasonHighlightSecondary = { fg = C.mauve }, - MasonHighlightBlockSecondary = { fg = secondary_fg, bg = secondary_bg }, - MasonHighlightBlockBoldSecondary = { fg = fg, bg = bg, bold = true }, - - MasonMuted = { fg = C.overlay0 }, - MasonMutedBlock = { bg = muted_bg, fg = muted_fg }, - MasonMutedBlockBold = { bg = C.yellow, fg = C.base, bold = true }, - - MasonError = { fg = C.red }, - - MasonHeading = { fg = C.lavender, bold = true }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/mini.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/mini.lua deleted file mode 100644 index 07596da0..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/mini.lua +++ /dev/null @@ -1,63 +0,0 @@ -local M = {} - -function M.get() - local transparent_background = require("catppuccin").options.transparent_background - local bg_highlight = transparent_background and "NONE" or C.base - - local inactive_bg = transparent_background and "NONE" or C.mantle - - local indentscope_color = O.integrations.mini.indentscope_color - return { - MiniCompletionActiveParameter = { style = { "underline" } }, - - MiniCursorword = { style = { "underline" } }, - MiniCursorwordCurrent = { style = { "underline" } }, - - MiniIndentscopeSymbol = { fg = C[indentscope_color] or C.text }, - MiniIndentscopePrefix = { style = { "nocombine" } }, -- Make it invisible - - MiniJump = { fg = C.overlay2, bg = C.pink }, - - MiniJump2dSpot = { bg = C.base, fg = C.peach, style = { "bold", "underline" } }, - - MiniStarterCurrent = {}, - MiniStarterFooter = { fg = C.yellow, style = { "italic" } }, - MiniStarterHeader = { fg = C.blue }, - MiniStarterInactive = { fg = C.surface2, style = O.styles.comments }, - MiniStarterItem = { fg = C.text }, - MiniStarterItemBullet = { fg = C.blue }, - MiniStarterItemPrefix = { fg = C.pink }, - MiniStarterSection = { fg = C.flamingo }, - MiniStarterQuery = { fg = C.green }, - - MiniStatuslineDevinfo = { fg = C.subtext1, bg = C.surface1 }, - MiniStatuslineFileinfo = { fg = C.subtext1, bg = C.surface1 }, - MiniStatuslineFilename = { fg = C.text, bg = C.mantle }, - MiniStatuslineInactive = { fg = C.blue, bg = C.mantle }, - MiniStatuslineModeCommand = { fg = C.base, bg = C.peach, style = { "bold" } }, - MiniStatuslineModeInsert = { fg = C.base, bg = C.green, style = { "bold" } }, - MiniStatuslineModeNormal = { fg = C.mantle, bg = C.blue, style = { "bold" } }, - MiniStatuslineModeOther = { fg = C.base, bg = C.teal, style = { "bold" } }, - MiniStatuslineModeReplace = { fg = C.base, bg = C.red, style = { "bold" } }, - MiniStatuslineModeVisual = { fg = C.base, bg = C.mauve, style = { "bold" } }, - - MiniSurround = { bg = C.pink, fg = C.surface1 }, - - MiniTablineCurrent = { fg = C.text, bg = C.base, sp = C.red, style = { "bold", "italic", "underline" } }, - MiniTablineFill = { bg = bg_highlight }, - MiniTablineHidden = { fg = C.text, bg = inactive_bg }, - MiniTablineModifiedCurrent = { fg = C.red, bg = C.none, style = { "bold", "italic" } }, - MiniTablineModifiedHidden = { fg = C.red, bg = C.none }, - MiniTablineModifiedVisible = { fg = C.red, bg = C.none }, - MiniTablineTabpagesection = { fg = C.surface1, bg = C.base }, - MiniTablineVisible = { bg = C.none }, - - MiniTestEmphasis = { style = { "bold" } }, - MiniTestFail = { fg = C.red, style = { "bold" } }, - MiniTestPass = { fg = C.green, style = { "bold" } }, - - MiniTrailspace = { bg = C.red }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/native_lsp.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/native_lsp.lua deleted file mode 100644 index e4ae10a7..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/native_lsp.lua +++ /dev/null @@ -1,100 +0,0 @@ -local M = {} - -function M.get() - local virtual_text = O.integrations.native_lsp.virtual_text - local underlines = O.integrations.native_lsp.underlines - local inlay_hints = O.integrations.native_lsp.inlay_hints - - local error = C.red - local warning = C.yellow - local info = C.sky - local hint = C.teal - local darkening_percentage = 0.095 - - return { - -- These groups are for the native LSP client. Some other LSP clients may - -- use these groups, or use their own. Consult your LSP client's - -- documentation. - LspReferenceText = { bg = C.surface1 }, -- used for highlighting "text" references - LspReferenceRead = { bg = C.surface1 }, -- used for highlighting "read" references - LspReferenceWrite = { bg = C.surface1 }, -- used for highlighting "write" references - -- highlight diagnostics in numberline - - DiagnosticVirtualTextError = { - bg = O.transparent_background and C.none or U.darken(error, darkening_percentage, C.base), - fg = error, - style = virtual_text.errors, - }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default - DiagnosticVirtualTextWarn = { - bg = O.transparent_background and C.none or U.darken(warning, darkening_percentage, C.base), - fg = warning, - style = virtual_text.warnings, - }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default - DiagnosticVirtualTextInfo = { - bg = O.transparent_background and C.none or U.darken(info, darkening_percentage, C.base), - fg = info, - style = virtual_text.information, - }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default - DiagnosticVirtualTextHint = { - bg = O.transparent_background and C.none or U.darken(hint, darkening_percentage, C.base), - fg = hint, - style = virtual_text.hints, - }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default - - DiagnosticError = { bg = C.none, fg = error, style = virtual_text.errors }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default - DiagnosticWarn = { bg = C.none, fg = warning, style = virtual_text.warnings }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default - DiagnosticInfo = { bg = C.none, fg = info, style = virtual_text.information }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default - DiagnosticHint = { bg = C.none, fg = hint, style = virtual_text.hints }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default - - -- for nvim nightly - DiagnosticUnderlineError = { style = underlines.errors, sp = error }, -- Used to underline "Error" diagnostics - DiagnosticUnderlineWarn = { style = underlines.warnings, sp = warning }, -- Used to underline "Warn" diagnostics - DiagnosticUnderlineInfo = { style = underlines.information, sp = info }, -- Used to underline "Info" diagnostics - DiagnosticUnderlineHint = { style = underlines.hints, sp = hint }, -- Used to underline "Hint" diagnostics - - DiagnosticFloatingError = { fg = error }, -- Used to color "Error" diagnostic messages in diagnostics float - DiagnosticFloatingWarn = { fg = warning }, -- Used to color "Warn" diagnostic messages in diagnostics float - DiagnosticFloatingInfo = { fg = info }, -- Used to color "Info" diagnostic messages in diagnostics float - DiagnosticFloatingHint = { fg = hint }, -- Used to color "Hint" diagnostic messages in diagnostics float - - DiagnosticSignError = { fg = error }, -- Used for "Error" signs in sign column - DiagnosticSignWarn = { fg = warning }, -- Used for "Warn" signs in sign column - DiagnosticSignInfo = { fg = info }, -- Used for "Info" signs in sign column - DiagnosticSignHint = { fg = hint }, -- Used for "Hint" signs in sign column - - LspDiagnosticsDefaultError = { fg = error }, -- Used as the mantle highlight group. Other LspDiagnostic highlights link to this by default (except Underline) - LspDiagnosticsDefaultWarning = { fg = warning }, -- Used as the mantle highlight group. Other LspDiagnostic highlights link to this by default (except Underline) - LspDiagnosticsDefaultInformation = { fg = info }, -- Used as the mantle highlight group. Other LspDiagnostic highlights link to this by default (except Underline) - LspDiagnosticsDefaultHint = { fg = hint }, -- Used as the mantle highlight group. Other LspDiagnostic highlights link to this by default (except Underline) - LspSignatureActiveParameter = { fg = C.peach }, - -- LspDiagnosticsFloatingError = { }, -- Used to color "Error" diagnostic messages in diagnostics float - -- LspDiagnosticsFloatingWarning = { }, -- Used to color "Warning" diagnostic messages in diagnostics float - -- LspDiagnosticsFloatingInformation = { }, -- Used to color "Information" diagnostic messages in diagnostics float - -- LspDiagnosticsFloatingHint = { }, -- Used to color "Hint" diagnostic messages in diagnostics float - - LspDiagnosticsError = { fg = error }, - LspDiagnosticsWarning = { fg = warning }, - LspDiagnosticsInformation = { fg = info }, - LspDiagnosticsHint = { fg = hint }, - LspDiagnosticsVirtualTextError = { fg = error, style = virtual_text.errors }, -- Used for "Error" diagnostic virtual text - LspDiagnosticsVirtualTextWarning = { fg = warning, style = virtual_text.warnings }, -- Used for "Warning" diagnostic virtual text - LspDiagnosticsVirtualTextInformation = { fg = info, style = virtual_text.warnings }, -- Used for "Information" diagnostic virtual text - LspDiagnosticsVirtualTextHint = { fg = hint, style = virtual_text.hints }, -- Used for "Hint" diagnostic virtual text - LspDiagnosticsUnderlineError = { style = underlines.errors, sp = error }, -- Used to underline "Error" diagnostics - LspDiagnosticsUnderlineWarning = { style = underlines.warnings, sp = warning }, -- Used to underline "Warning" diagnostics - LspDiagnosticsUnderlineInformation = { style = underlines.information, sp = info }, -- Used to underline "Information" diagnostics - LspDiagnosticsUnderlineHint = { style = underlines.hints, sp = hint }, -- Used to underline "Hint" diagnostics - LspCodeLens = { fg = C.overlay0 }, -- virtual text of the codelens - LspCodeLensSeparator = { link = "LspCodeLens" }, -- virtual text of the codelens separators - LspInlayHint = { - -- fg of `Comment` - fg = C.overlay0, - -- bg of `CursorLine` - bg = (O.transparent_background or not inlay_hints.background) and C.none - or U.vary_color({ latte = U.lighten(C.mantle, 0.70, C.base) }, U.darken(C.surface0, 0.64, C.base)), - }, -- virtual text of the inlay hints - LspInfoBorder = { link = "FloatBorder" }, -- LspInfo border - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/navic.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/navic.lua deleted file mode 100644 index da6bcbcf..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/navic.lua +++ /dev/null @@ -1,39 +0,0 @@ -local M = {} - -function M.get() - local background = O.integrations.navic.custom_bg and O.integrations.navic.custom_bg or C.none - if O.integrations.navic.custom_bg == "lualine" then background = C.mantle end - - return { - NavicIconsFile = { fg = C.blue, bg = background }, - NavicIconsModule = { fg = C.blue, bg = background }, - NavicIconsNamespace = { fg = C.blue, bg = background }, - NavicIconsPackage = { fg = C.blue, bg = background }, - NavicIconsClass = { fg = C.yellow, bg = background }, - NavicIconsMethod = { fg = C.blue, bg = background }, - NavicIconsProperty = { fg = C.green, bg = background }, - NavicIconsField = { fg = C.green, bg = background }, - NavicIconsConstructor = { fg = C.blue, bg = background }, - NavicIconsEnum = { fg = C.green, bg = background }, - NavicIconsInterface = { fg = C.yellow, bg = background }, - NavicIconsFunction = { fg = C.blue, bg = background }, - NavicIconsVariable = { fg = C.flamingo, bg = background }, - NavicIconsConstant = { fg = C.peach, bg = background }, - NavicIconsString = { fg = C.green, style = O.styles.strings, bg = background }, - NavicIconsNumber = { fg = C.peach, bg = background }, - NavicIconsBoolean = { fg = C.peach, bg = background }, - NavicIconsArray = { fg = C.peach, bg = background }, - NavicIconsObject = { fg = C.peach, bg = background }, - NavicIconsKey = { fg = C.pink, style = O.styles.keywords, bg = background }, - NavicIconsNull = { fg = C.peach, bg = background }, - NavicIconsEnumMember = { fg = C.red, bg = background }, - NavicIconsStruct = { fg = C.blue, bg = background }, - NavicIconsEvent = { fg = C.blue, bg = background }, - NavicIconsOperator = { fg = C.sky, bg = background }, - NavicIconsTypeParameter = { fg = C.blue, bg = background }, - NavicText = { fg = C.sapphire, bg = background }, - NavicSeparator = { fg = C.text, bg = background }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/neogit.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/neogit.lua deleted file mode 100644 index b0499d60..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/neogit.lua +++ /dev/null @@ -1,244 +0,0 @@ -local M = {} - -function M.get() - return { - NeogitBranch = { - fg = C.peach, - style = { "bold" }, - }, - NeogitRemote = { - fg = C.green, - style = { "bold" }, - }, - NeogitUnmergedInto = { - link = "Function", - }, - NeogitUnpulledFrom = { - link = "Function", - }, - NeogitObjectId = { - link = "Comment", - }, - NeogitStash = { - link = "Comment", - }, - NeogitRebaseDone = { - link = "Comment", - }, - NeogitHunkHeader = { - bg = U.darken(C.blue, 0.095, C.base), - fg = U.darken(C.blue, 0.5, C.base), - }, - NeogitHunkHeaderHighlight = { - bg = U.darken(C.blue, 0.215, C.base), - fg = C.blue, - }, - NeogitDiffContextHighlight = { - bg = C.surface0, - }, - NeogitDiffDeleteHighlight = { - bg = U.darken(C.red, 0.345, C.base), - fg = U.lighten(C.red, 0.850, C.text), - }, - NeogitDiffAddHighlight = { - bg = U.darken(C.green, 0.345, C.base), - fg = U.lighten(C.green, 0.850, C.text), - }, - NeogitDiffDelete = { - bg = U.darken(C.red, 0.095, C.base), - fg = U.darken(C.red, 0.800, C.base), - }, - NeogitDiffAdd = { - bg = U.darken(C.green, 0.095, C.base), - fg = U.darken(C.green, 0.800, C.base), - }, - NeogitCommitViewHeader = { - bg = U.darken(C.blue, 0.300, C.base), - fg = U.lighten(C.blue, 0.800, C.text), - }, - NeogitChangeModified = { - fg = C.blue, - style = { "bold" }, - }, - NeogitChangeDeleted = { - fg = C.red, - style = { "bold" }, - }, - NeogitChangeAdded = { - fg = C.green, - style = { "bold" }, - }, - NeogitChangeRenamed = { - fg = C.mauve, - style = { "bold" }, - }, - NeogitChangeUpdated = { - fg = C.peach, - style = { "bold" }, - }, - NeogitChangeCopied = { - fg = C.pink, - style = { "bold" }, - }, - NeogitChangeBothModified = { - fg = C.yellow, - style = { "bold" }, - }, - NeogitChangeNewFile = { - fg = C.green, - style = { "bold" }, - }, - NeogitUntrackedfiles = { - fg = C.mauve, - style = { "bold" }, - }, - NeogitUnstagedchanges = { - fg = C.mauve, - style = { "bold" }, - }, - NeogitUnmergedchanges = { - fg = C.mauve, - style = { "bold" }, - }, - NeogitUnpulledchanges = { - fg = C.mauve, - style = { "bold" }, - }, - NeogitRecentcommits = { - fg = C.mauve, - style = { "bold" }, - }, - NeogitStagedchanges = { - fg = C.mauve, - style = { "bold" }, - }, - NeogitStashes = { - fg = C.mauve, - style = { "bold" }, - }, - NeogitRebasing = { - fg = C.mauve, - style = { "bold" }, - }, - NeogitNotificationInfo = { - fg = C.blue, - }, - NeogitNotificationWarning = { - fg = C.yellow, - }, - NeogitNotificationError = { - fg = C.red, - }, - NeogitGraphRed = { - fg = C.red, - }, - NeogitGraphWhite = { - fg = C.base, - }, - NeogitGraphYellow = { - fg = C.yellow, - }, - NeogitGraphGreen = { - fg = C.green, - }, - NeogitGraphCyan = { - fg = C.blue, - }, - NeogitGraphBlue = { - fg = C.blue, - }, - NeogitGraphPurple = { - fg = C.lavender, - }, - NeogitGraphGray = { - fg = C.subtext1, - }, - NeogitGraphOrange = { - fg = C.peach, - }, - NeogitGraphBoldRed = { - fg = C.red, - style = { "bold" }, - }, - NeogitGraphBoldWhite = { - fg = C.white, - style = { "bold" }, - }, - NeogitGraphBoldYellow = { - fg = C.yellow, - style = { "bold" }, - }, - NeogitGraphBoldGreen = { - fg = C.green, - style = { "bold" }, - }, - NeogitGraphBoldCyan = { - fg = C.blue, - style = { "bold" }, - }, - NeogitGraphBoldBlue = { - fg = C.blue, - style = { "bold" }, - }, - NeogitGraphBoldPurple = { - fg = C.lavender, - style = { "bold" }, - }, - NeogitGraphBoldGray = { - fg = C.subtext1, - style = { "bold" }, - }, - NeogitDiffContext = { - bg = C.base, - }, - NeogitPopupBold = { - style = { "bold" }, - }, - NeogitPopupSwitchKey = { - fg = C.lavender, - }, - NeogitPopupOptionKey = { - fg = C.lavender, - }, - NeogitPopupConfigKey = { - fg = C.lavender, - }, - NeogitPopupActionKey = { - fg = C.lavender, - }, - NeogitFilePath = { - fg = C.blue, - style = { "italic" }, - }, - NeogitDiffHeader = { - bg = C.base, - fg = C.blue, - style = { "bold" }, - }, - NeogitDiffHeaderHighlight = { - bg = C.base, - fg = C.peach, - style = { "bold" }, - }, - NeogitUnpushedTo = { - fg = C.lavender, - style = { "bold" }, - }, - NeogitFold = { - fg = C.none, - bg = C.none, - }, - NeogitSectionHeader = { - fg = C.mauve, - style = { "bold" }, - }, - NeogitTagName = { - fg = C.yellow, - }, - NeogitTagDistance = { - fg = C.blue, - }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/neotest.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/neotest.lua deleted file mode 100644 index 5385cc09..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/neotest.lua +++ /dev/null @@ -1,24 +0,0 @@ -local M = {} - -function M.get() - return { - NeotestPassed = { fg = C.green }, - NeotestFailed = { fg = C.red }, - NeotestRunning = { fg = C.yellow }, - NeotestSkipped = { fg = C.blue }, - NeotestTest = { fg = C.text }, - NeotestNamespace = { fg = C.mauve }, - NeotestFocused = { style = { "bold", "underline" } }, - NeotestFile = { fg = C.blue }, - NeotestDir = { fg = C.blue }, - NeotestIndent = { fg = C.overlay1 }, - NeotestExpandMarker = { fg = C.overlay1 }, - NeotestAdapterName = { fg = C.maroon }, - NeotestWinSelect = { fg = C.blue, style = { "bold" } }, - NeotestMarked = { fg = C.peach, style = { "bold" } }, - NeotestTarget = { fg = C.red }, - NeotestUnknown = { fg = C.text }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/neotree.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/neotree.lua deleted file mode 100644 index c5e7f0fc..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/neotree.lua +++ /dev/null @@ -1,46 +0,0 @@ -local M = {} - -function M.get() - local active_bg = O.transparent_background and C.none or C.mantle - local inactive_bg = O.transparent_background and C.none or C.base - return { - NeoTreeDirectoryName = { fg = C.blue }, - NeoTreeDirectoryIcon = { fg = C.blue }, - NeoTreeNormal = { fg = C.text, bg = active_bg }, - NeoTreeNormalNC = { fg = C.text, bg = active_bg }, - NeoTreeExpander = { fg = C.overlay0 }, - NeoTreeIndentMarker = { fg = C.overlay0 }, - NeoTreeRootName = { fg = C.blue, style = { "bold" } }, - NeoTreeSymbolicLinkTarget = { fg = C.pink }, - NeoTreeModified = { fg = C.peach }, - - NeoTreeGitAdded = { fg = C.green }, - NeoTreeGitConflict = { fg = C.red }, - NeoTreeGitDeleted = { fg = C.red }, - NeoTreeGitIgnored = { fg = C.overlay0 }, - NeoTreeGitModified = { fg = C.yellow }, - NeoTreeGitUnstaged = { fg = C.red }, - NeoTreeGitUntracked = { fg = C.mauve }, - NeoTreeGitStaged = { fg = C.green }, - - NeoTreeFloatBorder = { link = "FloatBorder" }, - NeoTreeFloatTitle = { link = "FloatTitle" }, - NeoTreeTitleBar = { fg = C.mantle, bg = C.blue }, - - NeoTreeFileNameOpened = { fg = C.pink }, - NeoTreeDimText = { fg = C.overlay1 }, - NeoTreeFilterTerm = { fg = C.green, style = { "bold" } }, - NeoTreeTabActive = { bg = active_bg, fg = C.lavender, style = { "bold" } }, - NeoTreeTabInactive = { bg = inactive_bg, fg = C.overlay0 }, - NeoTreeTabSeparatorActive = { fg = active_bg, bg = active_bg }, - NeoTreeTabSeparatorInactive = { fg = inactive_bg, bg = inactive_bg }, - NeoTreeVertSplit = { fg = C.base, bg = inactive_bg }, - NeoTreeWinSeparator = { - fg = O.transparent_background and C.surface1 or C.base, - bg = O.transparent_background and C.none or C.base, - }, - NeoTreeStatusLineNC = { fg = C.mantle, bg = C.mantle }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/noice.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/noice.lua deleted file mode 100644 index 45bf6b55..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/noice.lua +++ /dev/null @@ -1,26 +0,0 @@ -local M = {} - -local virtual_text = O.integrations.native_lsp.virtual_text - -function M.get() - return { -- Personally the default integration is already pretty good - NoiceCmdline = { fg = C.text }, - NoiceCmdlineIcon = { fg = C.sky, style = virtual_text.information }, - NoiceCmdlineIconSearch = { fg = C.yellow }, - NoiceCmdlinePopupBorder = { fg = C.lavender }, - NoiceCmdlinePopupBorderSearch = { fg = C.yellow }, - NoiceConfirmBorder = { fg = C.blue }, - NoiceMini = { fg = C.subtext0, blend = 0 }, - NoiceFormatProgressDone = { - bg = O.transparent_background and C.none or U.darken(C.sky, 0.30, C.base), - fg = C.subtext0, - }, - NoiceFormatProgressTodo = { - bg = O.transparent_background and C.none - or U.vary_color({ latte = U.lighten(C.mantle, 0.70, C.base) }, U.darken(C.surface0, 0.64, C.base)), - fg = C.subtext0, - }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/notifier.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/notifier.lua deleted file mode 100644 index 12ecfe40..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/notifier.lua +++ /dev/null @@ -1,11 +0,0 @@ -local M = {} - -function M.get() - return { - NotifierIcon = { fg = C.mauve }, - NotifierContent = { fg = C.overlay2, blend = 0, style = { "italic" } }, - NotifierContentDim = { fg = C.overlay1, blend = 0, style = { "italic" } }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/notify.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/notify.lua deleted file mode 100644 index fcd5002c..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/notify.lua +++ /dev/null @@ -1,25 +0,0 @@ -local M = {} - -function M.get() - return { - NotifyBackground = { bg = (O.transparent_background and vim.o.winblend == 0) and "#000000" or C.mantle }, - - NotifyERRORBorder = { fg = C.red }, - NotifyERRORIcon = { fg = C.red }, - NotifyERRORTitle = { fg = C.red, style = { "italic" } }, - NotifyWARNBorder = { fg = C.yellow }, - NotifyWARNIcon = { fg = C.yellow }, - NotifyWARNTitle = { fg = C.yellow, style = { "italic" } }, - NotifyINFOBorder = { fg = C.blue }, - NotifyINFOIcon = { fg = C.blue }, - NotifyINFOTitle = { fg = C.blue, style = { "italic" } }, - NotifyDEBUGBorder = { fg = C.peach }, - NotifyDEBUGIcon = { fg = C.peach }, - NotifyDEBUGTitle = { fg = C.peach, style = { "italic" } }, - NotifyTRACEBorder = { fg = C.rosewater }, - NotifyTRACEIcon = { fg = C.rosewater }, - NotifyTRACETitle = { fg = C.rosewater, style = { "italic" } }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/nvimtree.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/nvimtree.lua deleted file mode 100644 index 725196ed..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/nvimtree.lua +++ /dev/null @@ -1,27 +0,0 @@ -local M = {} - -function M.get() - return { - NvimTreeFolderName = { fg = C.blue }, - NvimTreeFolderIcon = { fg = C.blue }, - NvimTreeNormal = { fg = C.text, bg = O.transparent_background and C.none or C.mantle }, - NvimTreeOpenedFolderName = { fg = C.blue }, - NvimTreeEmptyFolderName = { fg = C.blue }, - NvimTreeIndentMarker = { fg = C.overlay0 }, - NvimTreeWinSeparator = { - fg = O.transparent_background and C.surface1 or C.base, - bg = O.transparent_background and C.none or C.base, - }, - NvimTreeRootFolder = { fg = C.lavender, style = { "bold" } }, - NvimTreeSymlink = { fg = C.pink }, - NvimTreeStatuslineNc = { fg = C.mantle, bg = C.mantle }, - NvimTreeGitDirty = { fg = C.yellow }, - NvimTreeGitNew = { fg = C.blue }, - NvimTreeGitDeleted = { fg = C.red }, - NvimTreeSpecialFile = { fg = C.flamingo }, - NvimTreeImageFile = { fg = C.text }, - NvimTreeOpenedFile = { fg = C.pink }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/octo.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/octo.lua deleted file mode 100644 index cd1fd64f..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/octo.lua +++ /dev/null @@ -1,78 +0,0 @@ -local M = {} - -function M.get() - return { - -- colors - OctoGrey = { fg = C.base }, - OctoBlue = { fg = C.blue }, - OctoGreen = { fg = C.green }, - OctoRed = { fg = C.red }, - OctoPurple = { fg = C.mauve }, - OctoYellow = { fg = C.yellow }, - -- highlight groups - OctoDirty = { link = "ErrorMsg" }, - OctoIssueTitle = { link = "PreProc" }, - OctoIssueId = { link = "Question" }, - OctoEmpty = { link = "Comment" }, - OctoFloat = { link = "NormalNC" }, - OctoDate = { link = "Comment" }, - OctoSymbol = { link = "Comment" }, - OctoTimelineItemHeading = { link = "Comment" }, - OctoDetailsLabel = { link = "Title" }, - OctoMissingDetails = { link = "Comment" }, - OctoDetailsValue = { link = "Identifier" }, - OctoDiffHunkPosition = { link = "NormalFloat" }, - OctoCommentLine = { link = "TabLineSel" }, - OctoViewer = { fg = C.base, bg = C.blue }, - OctoBubble = { fg = C.text, bg = C.mantle }, - OctoBubbleGrey = { fg = C.text, bg = C.mantle }, - OctoBubbleDelimiterGrey = { fg = C.mantle }, - OctoBubbleGreen = { fg = C.base, bg = C.green }, - OctoBubbleDelimiterGreen = { fg = C.green }, - OctoBubbleBlue = { fg = C.base, bg = C.sky }, - OctoBubbleDelimiterBlue = { fg = C.sky }, - OctoBubbleYellow = { fg = C.base, bg = C.yellow }, - OctoBubbleDelimiterYellow = { fg = C.yellow }, - OctoBubbleRed = { fg = C.base, bg = C.red }, - OctoBubbleDelimiterRed = { fg = C.red }, - OctoBubblePurple = { fg = C.base, bg = C.mauve }, - OctoBubbleDelimiterPurple = { fg = C.mauve }, - OctoUser = { link = "OctoBubble" }, - OctoUserViewer = { link = "OctoViewer" }, - OctoReaction = { link = "OctoBubble" }, - OctoReactionViewer = { link = "OctoViewer" }, - OctoPassingTest = { link = "OctoGreen" }, - OctoFailingTest = { link = "OctoRed" }, - OctoPullAdditions = { link = "OctoGreen" }, - OctoPullDeletions = { link = "OctoRed" }, - OctoPullModifications = { fg = C.peach }, - OctoStateOpen = { fg = C.green, bg = C.mantle }, - OctoStateOpenFloat = { fg = C.green, bg = C.mantle }, - OctoStateClosed = { fg = C.red, bg = C.mantle }, - OctoStateClosedFloat = { fg = C.red, bg = C.mantle }, - OctoStateMerged = { fg = C.mauve, bg = C.mantle }, - OctoStateMergedFloat = { fg = C.mauve, bg = C.mantle }, - OctoStatePending = { fg = C.peach, bg = C.mantle }, - OctoStatePendingFloat = { fg = C.peach, bg = C.mantle }, - OctoStateApproved = { link = "OctoStateOpen" }, - OctoStateApprovedFloat = { link = "OctoStateOpen" }, - OctoStateChangesRequested = { fg = C.maroon, bg = C.mantle }, - OctoStateChangesRequestedFloat = { fg = C.maroon, bg = C.mantle }, - OctoStateCommented = { link = "Normal" }, - OctoStateCommentedFloat = { link = "Normal" }, - OctoStateDismissed = { link = "OctoStateClosed" }, - OctoStateDismissedFloat = { link = "OctoStateClosed" }, - OctoStateSubmittedBubble = { link = "OctoBubbleGreen" }, - OctoFilePanelCounter = { fg = C.blue, style = { "bold" } }, - OctoFilePanelTitle = { fg = C.blue, style = { "bold" } }, - OctoNormalFront = { fg = C.text }, - OctoYellowFloat = { fg = C.yellow, bg = C.mantle }, - OctoPurpleFloat = { fg = C.mauve, bg = C.mantle }, - OctoRedFloat = { fg = C.red, bg = C.mantle }, - OctoGreenFloat = { fg = C.green, bg = C.mantle }, - OctoGreyFloat = { fg = C.text, bg = C.mantle }, - OctoBlueFloat = { fg = C.blue, bg = C.mantle }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/overseer.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/overseer.lua deleted file mode 100644 index 20f47b7b..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/overseer.lua +++ /dev/null @@ -1,18 +0,0 @@ -local M = {} - -function M.get() - return { - OverseerPENDING = { fg = C.grey }, - OverseerRUNNING = { fg = C.yellow }, - OverseerSUCCESS = { fg = C.green }, - OverseerCANCELED = { fg = C.overlay2 }, - OverseerFAILURE = { fg = C.red }, - OverseerTask = { fg = C.blue }, - OverseerTaskBorder = { fg = C.sky }, - OverseerOutput = { fg = C.text }, - OverseerComponent = { fg = C.yellow }, - OverseerField = { fg = C.green }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/pounce.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/pounce.lua deleted file mode 100644 index 608c99f6..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/pounce.lua +++ /dev/null @@ -1,12 +0,0 @@ -local M = {} - -function M.get() - return { - PounceMatch = { bg = U.lighten(C.green, 0.7), fg = C.base, style = { "bold" } }, - PounceGap = { bg = U.darken(C.green, 0.7), fg = C.base, style = { "bold" } }, - PounceAccept = { bg = C.peach, fg = C.base, style = { "bold" } }, - PounceAcceptBest = { bg = C.teal, fg = C.base, style = { "bold" } }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/rainbow_delimiters.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/rainbow_delimiters.lua deleted file mode 100644 index bfaeecf7..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/rainbow_delimiters.lua +++ /dev/null @@ -1,15 +0,0 @@ -local M = {} - -function M.get() - return { - RainbowDelimiterRed = { fg = C.red }, - RainbowDelimiterYellow = { fg = C.yellow }, - RainbowDelimiterBlue = { fg = C.blue }, - RainbowDelimiterOrange = { fg = C.peach }, - RainbowDelimiterGreen = { fg = C.green }, - RainbowDelimiterViolet = { fg = C.mauve }, - RainbowDelimiterCyan = { fg = C.teal }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/sandwich.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/sandwich.lua deleted file mode 100644 index e366c845..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/sandwich.lua +++ /dev/null @@ -1,12 +0,0 @@ -local M = {} - -function M.get() - return { - OperatorSandwichAdd = { bg = C.blue, fg = C.base }, - OperatorSandwichBuns = { bg = C.blue, fg = C.base }, - OperatorSandwichChange = { bg = C.blue, fg = C.base }, - OperatorSandwichDelete = { bg = C.blue, fg = C.base }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/semantic_tokens.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/semantic_tokens.lua deleted file mode 100644 index 6d9094b6..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/semantic_tokens.lua +++ /dev/null @@ -1,48 +0,0 @@ -local M = {} - -function M.get() - if vim.treesitter.highlighter.hl_map then - vim.notify_once( - [[Catppuccin (info): -semantic_tokens integration requires neovim 0.8 -If you want to stay on nvim 0.7, disable the integration. -]], - vim.log.levels.INFO - ) - return {} - end - return { - ["@lsp.type.boolean"] = { link = "@boolean" }, - ["@lsp.type.builtinType"] = { link = "@type.builtin" }, - ["@lsp.type.comment"] = { link = "@comment" }, - ["@lsp.type.enum"] = { link = "@type" }, - ["@lsp.type.enumMember"] = { link = "@constant" }, - ["@lsp.type.escapeSequence"] = { link = "@string.escape" }, - ["@lsp.type.formatSpecifier"] = { link = "@punctuation.special" }, - ["@lsp.type.interface"] = { fg = C.flamingo }, - ["@lsp.type.keyword"] = { link = "@keyword" }, - ["@lsp.type.namespace"] = { link = "@module" }, - ["@lsp.type.number"] = { link = "@number" }, - ["@lsp.type.operator"] = { link = "@operator" }, - ["@lsp.type.parameter"] = { link = "@parameter" }, - ["@lsp.type.property"] = { link = "@property" }, - ["@lsp.type.selfKeyword"] = { link = "@variable.builtin" }, - ["@lsp.type.typeAlias"] = { link = "@type.definition" }, - ["@lsp.type.unresolvedReference"] = { link = "@error" }, - ["@lsp.type.variable"] = {}, -- use treesitter styles for regular variables - ["@lsp.typemod.class.defaultLibrary"] = { link = "@type.builtin" }, - ["@lsp.typemod.enum.defaultLibrary"] = { link = "@type.builtin" }, - ["@lsp.typemod.enumMember.defaultLibrary"] = { link = "@constant.builtin" }, - ["@lsp.typemod.function.defaultLibrary"] = { link = "@function.builtin" }, - ["@lsp.typemod.keyword.async"] = { link = "@keyword.coroutine" }, - ["@lsp.typemod.macro.defaultLibrary"] = { link = "@function.builtin" }, - ["@lsp.typemod.method.defaultLibrary"] = { link = "@function.builtin" }, - ["@lsp.typemod.operator.injected"] = { link = "@operator" }, - ["@lsp.typemod.string.injected"] = { link = "@string" }, - ["@lsp.typemod.type.defaultLibrary"] = { link = "@type.builtin" }, - ["@lsp.typemod.variable.defaultLibrary"] = { link = "@variable.builtin" }, - ["@lsp.typemod.variable.injected"] = { link = "@variable" }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/symbols_outline.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/symbols_outline.lua deleted file mode 100644 index f16b6c28..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/symbols_outline.lua +++ /dev/null @@ -1,13 +0,0 @@ -local M = {} - -function M.get() - return { - -- https://github.com/simrat39/symbols-outline.nvim - FocusedSymbol = { fg = C.yellow, bg = C.none }, - - -- https://github.com/hedyhli/outline.nvim - OutlineCurrent = { link = "FocusedSymbol" }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/telekasten.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/telekasten.lua deleted file mode 100644 index 9af7a855..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/telekasten.lua +++ /dev/null @@ -1,11 +0,0 @@ -local M = {} - -function M.get() - return { - tkLink = { fg = C.blue }, - tkBrackets = { fg = C.pink }, - tkTag = { fg = C.sky }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/telescope.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/telescope.lua deleted file mode 100644 index 58401704..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/telescope.lua +++ /dev/null @@ -1,60 +0,0 @@ -local M = {} - -function M.get() - if O.integrations.telescope.style == "nvchad" then - return { - TelescopeBorder = { - fg = O.transparent_background and C.blue or C.mantle, - bg = O.transparent_background and C.none or C.mantle, - }, - TelescopeMatching = { fg = C.blue }, - TelescopeNormal = { - bg = O.transparent_background and C.none or C.mantle, - }, - TelescopePromptBorder = { - fg = O.transparent_background and C.blue or C.surface0, - bg = O.transparent_background and C.none or C.surface0, - }, - TelescopePromptNormal = { - fg = C.text, - bg = O.transparent_background and C.none or C.surface0, - }, - TelescopePromptPrefix = { - fg = C.flamingo, - bg = O.transparent_background and C.none or C.surface0, - }, - TelescopePreviewTitle = { - fg = O.transparent_background and C.green or C.base, - bg = O.transparent_background and C.none or C.green, - }, - TelescopePromptTitle = { - fg = O.transparent_background and C.red or C.base, - bg = O.transparent_background and C.none or C.red, - }, - TelescopeResultsTitle = { - fg = O.transparent_background and C.lavender or C.mantle, - bg = O.transparent_background and C.none or C.lavender, - }, - TelescopeSelection = { - fg = O.transparent_background and C.flamingo or C.text, - bg = O.transparent_background and C.none or C.surface0, - style = { "bold" }, - }, - TelescopeSelectionCaret = { fg = C.flamingo }, - } - end - - return { - -- TelescopeNormal = { link = "NormalFloat" }, -- Respect telescope's default float bg - TelescopeBorder = { link = "FloatBorder" }, - TelescopeSelectionCaret = { fg = C.flamingo }, - TelescopeSelection = { - fg = O.transparent_background and C.flamingo or C.text, - bg = O.transparent_background and C.none or C.surface0, - style = { "bold" }, - }, - TelescopeMatching = { fg = C.blue }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/treesitter.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/treesitter.lua deleted file mode 100644 index cd4981ec..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/treesitter.lua +++ /dev/null @@ -1,274 +0,0 @@ -local M = {} - -function M.get() - if vim.treesitter.highlighter.hl_map then - vim.notify_once( - [[Catppuccin (info): -nvim-treesitter integration requires neovim 0.8 -If you want to stay on nvim 0.7, either disable the integration or pin catppuccin tag to v0.2.4 and nvim-treesitter commit to 4cccb6f494eb255b32a290d37c35ca12584c74d0. -]], - vim.log.levels.INFO - ) - return {} - end - - local colors = { -- Reference: https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md - -- Identifiers - ["@variable"] = { fg = C.text, style = O.styles.variables or {} }, -- Any variable name that does not have another highlight. - ["@variable.builtin"] = { fg = C.red, style = O.styles.properties or {} }, -- Variable names that are defined by the languages, like this or self. - ["@variable.parameter"] = { fg = C.maroon, style = O.styles.variables or {} }, -- For parameters of a function. - ["@variable.member"] = { fg = C.lavender }, -- For fields. - - ["@constant"] = { link = "Constant" }, -- For constants - ["@constant.builtin"] = { fg = C.peach, style = O.styles.keywords or {} }, -- For constant that are built in the language: nil in Lua. - ["@constant.macro"] = { link = "Macro" }, -- For constants that are defined by macros: NULL in C. - - ["@module"] = { fg = C.lavender, style = O.styles.miscs or { "italic" } }, -- For identifiers referring to modules and namespaces. - ["@label"] = { link = "Label" }, -- For labels: label: in C and :label: in Lua. - - -- Literals - ["@string"] = { link = "String" }, -- For strings. - ["@string.documentation"] = { fg = C.teal, style = O.styles.strings or {} }, -- For strings documenting code (e.g. Python docstrings). - ["@string.regexp"] = { fg = C.peach, style = O.styles.strings or {} }, -- For regexes. - ["@string.escape"] = { fg = C.pink, style = O.styles.strings or {} }, -- For escape characters within a string. - ["@string.special"] = { link = "Special" }, -- other special strings (e.g. dates) - ["@string.special.path"] = { link = "Special" }, -- filenames - ["@string.special.symbol"] = { fg = C.flamingo }, -- symbols or atoms - ["@string.special.url"] = { fg = C.rosewater, style = { "italic", "underline" } }, -- urls, links and emails - - ["@character"] = { link = "Character" }, -- character literals - ["@character.special"] = { link = "SpecialChar" }, -- special characters (e.g. wildcards) - - ["@boolean"] = { link = "Boolean" }, -- For booleans. - ["@number"] = { link = "Number" }, -- For all numbers - ["@number.float"] = { link = "Float" }, -- For floats. - - -- Types - ["@type"] = { link = "Type" }, -- For types. - ["@type.builtin"] = { fg = C.yellow, style = O.styles.properties or { "italic" } }, -- For builtin types. - ["@type.definition"] = { link = "Type" }, -- type definitions (e.g. `typedef` in C) - - ["@attribute"] = { link = "Constant" }, -- attribute annotations (e.g. Python decorators) - ["@property"] = { fg = C.lavender, style = O.styles.properties or {} }, -- Same as TSField. - - -- Functions - ["@function"] = { link = "Function" }, -- For function (calls and definitions). - ["@function.builtin"] = { fg = C.peach, style = O.styles.functions or {} }, -- For builtin functions: table.insert in Lua. - ["@function.call"] = { link = "Function" }, -- function calls - ["@function.macro"] = { fg = C.teal, style = O.styles.functions or {} }, -- For macro defined functions (calls and definitions): each macro_rules in Rust. - - ["@function.method"] = { link = "Function" }, -- For method definitions. - ["@function.method.call"] = { link = "Function" }, -- For method calls. - - ["@constructor"] = { fg = C.sapphire }, -- For constructor calls and definitions: = { } in Lua, and Java constructors. - ["@operator"] = { link = "Operator" }, -- For any operator: +, but also -> and * in C. - - -- Keywords - ["@keyword"] = { link = "Keyword" }, -- For keywords that don't fall in previous categories. - ["@keyword.modifier"] = { link = "Keyword" }, -- For keywords modifying other constructs (e.g. `const`, `static`, `public`) - ["@keyword.type"] = { link = "Keyword" }, -- For keywords describing composite types (e.g. `struct`, `enum`) - ["@keyword.coroutine"] = { link = "Keyword" }, -- For keywords related to coroutines (e.g. `go` in Go, `async/await` in Python) - ["@keyword.function"] = { fg = C.mauve, style = O.styles.keywords or {} }, -- For keywords used to define a function. - ["@keyword.operator"] = { link = "Operator" }, -- For new keyword operator - ["@keyword.import"] = { link = "Include" }, -- For includes: #include in C, use or extern crate in Rust, or require in Lua. - ["@keyword.repeat"] = { link = "Repeat" }, -- For keywords related to loops. - ["@keyword.return"] = { fg = C.mauve, style = O.styles.keywords or {} }, - ["@keyword.debug"] = { link = "Exception" }, -- For keywords related to debugging - ["@keyword.exception"] = { link = "Exception" }, -- For exception related keywords. - - ["@keyword.conditional"] = { link = "Conditional" }, -- For keywords related to conditionnals. - ["@keyword.conditional.ternary"] = { link = "Operator" }, -- For ternary operators (e.g. `?` / `:`) - - ["@keyword.directive"] = { link = "PreProc" }, -- various preprocessor directives & shebangs - ["@keyword.directive.define"] = { link = "Define" }, -- preprocessor definition directives - -- JS & derivative - ["@keyword.export"] = { fg = C.sky, style = O.styles.keywords }, - - -- Punctuation - ["@punctuation.delimiter"] = { link = "Delimiter" }, -- For delimiters (e.g. `;` / `.` / `,`). - ["@punctuation.bracket"] = { fg = C.overlay2 }, -- For brackets and parenthesis. - ["@punctuation.special"] = { link = "Special" }, -- For special punctuation that does not fall in the categories before (e.g. `{}` in string interpolation). - - -- Comment - ["@comment"] = { link = "Comment" }, - ["@comment.documentation"] = { link = "Comment" }, -- For comments documenting code - - ["@comment.error"] = { fg = C.base, bg = C.red }, - ["@comment.warning"] = { fg = C.base, bg = C.yellow }, - ["@comment.hint"] = { fg = C.base, bg = C.blue }, - ["@comment.todo"] = { fg = C.base, bg = C.flamingo }, - ["@comment.note"] = { fg = C.base, bg = C.rosewater }, - - -- Markup - ["@markup"] = { fg = C.text }, -- For strings considerated text in a markup language. - ["@markup.strong"] = { fg = C.maroon, style = { "bold" } }, -- bold - ["@markup.italic"] = { fg = C.maroon, style = { "italic" } }, -- italic - ["@markup.strikethrough"] = { fg = C.text, style = { "strikethrough" } }, -- strikethrough text - ["@markup.underline"] = { link = "Underlined" }, -- underlined text - - ["@markup.heading"] = { fg = C.blue, style = { "bold" } }, -- titles like: # Example - - ["@markup.math"] = { fg = C.blue }, -- math environments (e.g. `$ ... $` in LaTeX) - ["@markup.quote"] = { fg = C.maroon, style = { "bold" } }, -- block quotes - ["@markup.environment"] = { fg = C.pink }, -- text environments of markup languages - ["@markup.environment.name"] = { fg = C.blue }, -- text indicating the type of an environment - - ["@markup.link"] = { link = "Tag" }, -- text references, footnotes, citations, etc. - ["@markup.link.label"] = { link = "Label" }, -- link, reference descriptions - ["@markup.link.url"] = { fg = C.rosewater, style = { "italic", "underline" } }, -- urls, links and emails - - ["@markup.raw"] = { fg = C.teal }, -- used for inline code in markdown and for doc in python (""") - - ["@markup.list"] = { link = "Special" }, - ["@markup.list.checked"] = { fg = C.green }, -- todo notes - ["@markup.list.unchecked"] = { fg = C.overlay1 }, -- todo notes - - -- Diff - ["@diff.plus"] = { link = "diffAdded" }, -- added text (for diff files) - ["@diff.minus"] = { link = "diffRemoved" }, -- deleted text (for diff files) - ["@diff.delta"] = { link = "diffChanged" }, -- deleted text (for diff files) - - -- Tags - ["@tag"] = { fg = C.mauve }, -- Tags like html tag names. - ["@tag.attribute"] = { fg = C.teal, style = O.styles.miscs or { "italic" } }, -- Tags like html tag names. - ["@tag.delimiter"] = { fg = C.sky }, -- Tag delimiter like < > / - - -- Misc - ["@error"] = { link = "Error" }, - - -- Language specific: - -- bash - ["@function.builtin.bash"] = { fg = C.red, style = O.styles.miscs or { "italic" } }, - - -- markdown - ["@markup.heading.1.markdown"] = { link = "rainbow1" }, - ["@markup.heading.2.markdown"] = { link = "rainbow2" }, - ["@markup.heading.3.markdown"] = { link = "rainbow3" }, - ["@markup.heading.4.markdown"] = { link = "rainbow4" }, - ["@markup.heading.5.markdown"] = { link = "rainbow5" }, - ["@markup.heading.6.markdown"] = { link = "rainbow6" }, - - -- java - ["@constant.java"] = { fg = C.teal }, - - -- css - ["@property.css"] = { fg = C.lavender }, - ["@property.id.css"] = { fg = C.blue }, - ["@property.class.css"] = { fg = C.yellow }, - ["@type.css"] = { fg = C.lavender }, - ["@type.tag.css"] = { fg = C.mauve }, - ["@string.plain.css"] = { fg = C.peach }, - ["@number.css"] = { fg = C.peach }, - - -- toml - ["@property.toml"] = { fg = C.blue }, -- Differentiates between string and properties - - -- json - ["@label.json"] = { fg = C.blue }, -- For labels: label: in C and :label: in Lua. - - -- lua - ["@constructor.lua"] = { fg = C.flamingo }, -- For constructor calls and definitions: = { } in Lua. - - -- typescript - ["@property.typescript"] = { fg = C.lavender, style = O.styles.properties or {} }, - ["@constructor.typescript"] = { fg = C.lavender }, - - -- TSX (Typescript React) - ["@constructor.tsx"] = { fg = C.lavender }, - ["@tag.attribute.tsx"] = { fg = C.teal, style = O.styles.miscs or { "italic" } }, - - -- yaml - ["@variable.member.yaml"] = { fg = C.blue }, -- For fields. - - -- Ruby - ["@string.special.symbol.ruby"] = { fg = C.flamingo }, - - -- PHP - ["@function.method.php"] = { link = "Function" }, - ["@function.method.call.php"] = { link = "Function" }, - - -- C/CPP - ["@type.builtin.c"] = { fg = C.yellow, style = {} }, - ["@property.cpp"] = { fg = C.text }, - ["@type.builtin.cpp"] = { fg = C.yellow, style = {} }, - - -- gitcommit - ["@comment.warning.gitcommit"] = { fg = C.yellow }, - - -- Misc - gitcommitSummary = { fg = C.rosewater, style = O.styles.miscs or { "italic" } }, - zshKSHFunction = { link = "Function" }, - } - - -- Legacy highlights - colors["@parameter"] = colors["@variable.parameter"] - colors["@field"] = colors["@variable.member"] - colors["@namespace"] = colors["@module"] - colors["@float"] = colors["@number.float"] - colors["@symbol"] = colors["@string.special.symbol"] - colors["@string.regex"] = colors["@string.regexp"] - - colors["@text"] = colors["@markup"] - colors["@text.strong"] = colors["@markup.strong"] - colors["@text.emphasis"] = colors["@markup.italic"] - colors["@text.underline"] = colors["@markup.underline"] - colors["@text.strike"] = colors["@markup.strikethrough"] - colors["@text.uri"] = colors["@markup.link.url"] - colors["@text.math"] = colors["@markup.math"] - colors["@text.environment"] = colors["@markup.environment"] - colors["@text.environment.name"] = colors["@markup.environment.name"] - - colors["@text.title"] = colors["@markup.heading"] - colors["@text.literal"] = colors["@markup.raw"] - colors["@text.reference"] = colors["@markup.link"] - - colors["@text.todo.checked"] = colors["@markup.list.checked"] - colors["@text.todo.unchecked"] = colors["@markup.list.unchecked"] - - colors["@comment.note"] = colors["@comment.hint"] - - -- @text.todo is now for todo comments, not todo notes like in markdown - colors["@text.todo"] = colors["@comment.todo"] - colors["@text.warning"] = colors["@comment.warning"] - colors["@text.note"] = colors["@comment.note"] - colors["@text.danger"] = colors["@comment.error"] - - -- @text.uri is now - -- > @markup.link.url in markup links - -- > @string.special.url outside of markup - colors["@text.uri"] = colors["@markup.link.uri"] - - colors["@method"] = colors["@function.method"] - colors["@method.call"] = colors["@function.method.call"] - - colors["@text.diff.add"] = colors["@diff.plus"] - colors["@text.diff.delete"] = colors["@diff.minus"] - - colors["@type.qualifier"] = colors["@keyword.modifier"] - colors["@keyword.storage"] = colors["@keyword.modifier"] - colors["@define"] = colors["@keyword.directive.define"] - colors["@preproc"] = colors["@keyword.directive"] - colors["@storageclass"] = colors["@keyword.storage"] - colors["@conditional"] = colors["@keyword.conditional"] - colors["@exception"] = colors["@keyword.exception"] - colors["@include"] = colors["@keyword.import"] - colors["@repeat"] = colors["@keyword.repeat"] - - colors["@symbol.ruby"] = colors["@string.special.symbol.ruby"] - - colors["@variable.member.yaml"] = colors["@field.yaml"] - - colors["@text.title.1.markdown"] = colors["@markup.heading.1.markdown"] - colors["@text.title.2.markdown"] = colors["@markup.heading.2.markdown"] - colors["@text.title.3.markdown"] = colors["@markup.heading.3.markdown"] - colors["@text.title.4.markdown"] = colors["@markup.heading.4.markdown"] - colors["@text.title.5.markdown"] = colors["@markup.heading.5.markdown"] - colors["@text.title.6.markdown"] = colors["@markup.heading.6.markdown"] - - colors["@method.php"] = colors["@function.method.php"] - colors["@method.call.php"] = colors["@function.method.call.php"] - - return colors -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/treesitter_context.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/treesitter_context.lua deleted file mode 100644 index a21518ec..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/treesitter_context.lua +++ /dev/null @@ -1,18 +0,0 @@ -local M = {} - -function M.get() - return O.transparent_background and { - TreesitterContextBottom = { sp = C.dim, style = { "underline" } }, - } or { - TreesitterContextBottom = { - sp = C.surface0, - style = { "underline" }, - }, - TreesitterContextLineNumber = { - fg = C.surface1, - bg = C.mantle, - }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/ts_rainbow.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/ts_rainbow.lua deleted file mode 100644 index c2827dd2..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/ts_rainbow.lua +++ /dev/null @@ -1,15 +0,0 @@ -local M = {} - -function M.get() - return { - rainbowcol1 = { fg = C.red }, - rainbowcol2 = { fg = C.teal }, - rainbowcol3 = { fg = C.yellow }, - rainbowcol4 = { fg = C.blue }, - rainbowcol5 = { fg = C.pink }, - rainbowcol6 = { fg = C.flamingo }, - rainbowcol7 = { fg = C.green }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/ts_rainbow2.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/ts_rainbow2.lua deleted file mode 100644 index 651ea848..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/ts_rainbow2.lua +++ /dev/null @@ -1,15 +0,0 @@ -local M = {} - -function M.get() - return { - TSRainbowRed = { fg = C.red }, - TSRainbowYellow = { fg = C.yellow }, - TSRainbowBlue = { fg = C.blue }, - TSRainbowOrange = { fg = C.peach }, - TSRainbowGreen = { fg = C.green }, - TSRainbowViolet = { fg = C.mauve }, - TSRainbowCyan = { fg = C.teal }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/ufo.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/ufo.lua deleted file mode 100644 index 9e823a6d..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/ufo.lua +++ /dev/null @@ -1,10 +0,0 @@ -local M = {} - -M.get = function() - return { - UfoFoldedFg = { fg = C.lavender }, - UfoFoldedEllipsis = { fg = C.crust, bg = C.blue }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/vim_sneak.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/vim_sneak.lua deleted file mode 100644 index fa09bca2..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/vim_sneak.lua +++ /dev/null @@ -1,10 +0,0 @@ -local M = {} - -function M.get() - return { - Sneak = { fg = C.overlay2, bg = C.pink }, - SneakScope = { bg = C.text }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/vimwiki.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/vimwiki.lua deleted file mode 100644 index b7009716..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/vimwiki.lua +++ /dev/null @@ -1,20 +0,0 @@ -local M = {} - -function M.get() - return { - VimwikiLink = { fg = C.sky, bg = C.none }, - VimwikiHeaderChar = { fg = C.grey, bg = C.none }, - VimwikiHR = { fg = C.yellow, bg = C.none }, - VimwikiList = { fg = C.peach, bg = C.none }, - VimwikiTag = { fg = C.peach, bg = C.none }, - VimwikiMarkers = { fg = C.subtext0, bg = C.none }, - VimwikiHeader1 = { fg = C.peach, bg = C.none, style = { "bold" } }, - VimwikiHeader2 = { fg = C.green, bg = C.none, style = { "bold" } }, - VimwikiHeader3 = { fg = C.blue, bg = C.none, style = { "bold" } }, - VimwikiHeader4 = { fg = C.sky, bg = C.none, style = { "bold" } }, - VimwikiHeader5 = { fg = C.yellow, bg = C.none, style = { "bold" } }, - VimwikiHeader6 = { fg = C.mauve, bg = C.none, style = { "bold" } }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/which_key.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/which_key.lua deleted file mode 100644 index 3983d449..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/which_key.lua +++ /dev/null @@ -1,15 +0,0 @@ -local M = {} - -function M.get() - return { - WhichKey = { link = "NormalFloat" }, - WhichKeyBorder = { link = "FloatBorder" }, - - WhichKeyGroup = { fg = C.blue }, - WhichKeySeparator = { fg = C.overlay0 }, - WhichKeyDesc = { fg = C.pink }, - WhichKeyValue = { fg = C.overlay0 }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/window_picker.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/window_picker.lua deleted file mode 100644 index 06af3e56..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/integrations/window_picker.lua +++ /dev/null @@ -1,12 +0,0 @@ -local M = {} - -function M.get() - return { - WindowPickerStatusLine = { fg = C.red, style = { "bold" } }, - WindowPickerStatusLineNC = { fg = C.red, style = { "bold" } }, - WindowPickerWinBar = { fg = C.red, style = { "bold" } }, - WindowPickerWinBarNC = { fg = C.red, style = { "bold" } }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/syntax.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/syntax.lua deleted file mode 100644 index 055ddfe1..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/syntax.lua +++ /dev/null @@ -1,102 +0,0 @@ -local M = {} - -function M.get() - return { - Comment = { fg = C.overlay0, style = O.styles.comments }, -- just comments - SpecialComment = { link = "Special" }, -- special things inside a comment - Constant = { fg = C.peach }, -- (preferred) any constant - String = { fg = C.green, style = O.styles.strings or {} }, -- a string constant: "this is a string" - Character = { fg = C.teal }, -- a character constant: 'c', '\n' - Number = { fg = C.peach, style = O.styles.numbers or {} }, -- a number constant: 234, 0xff - Float = { link = "Number" }, -- a floating point constant: 2.3e10 - Boolean = { fg = C.peach, style = O.styles.booleans or {} }, -- a boolean constant: TRUE, false - Identifier = { fg = C.flamingo, style = O.styles.variables or {} }, -- (preferred) any variable name - Function = { fg = C.blue, style = O.styles.functions or {} }, -- function name (also: methods for classes) - Statement = { fg = C.mauve }, -- (preferred) any statement - Conditional = { fg = C.mauve, style = O.styles.conditionals or {} }, -- if, then, else, endif, switch, etc. - Repeat = { fg = C.mauve, style = O.styles.loops or {} }, -- for, do, while, etc. - Label = { fg = C.sapphire }, -- case, default, etc. - Operator = { fg = C.sky, style = O.styles.operators or {} }, -- "sizeof", "+", "*", etc. - Keyword = { fg = C.mauve, style = O.styles.keywords or {} }, -- any other keyword - Exception = { fg = C.mauve, style = O.styles.keywords or {} }, -- try, catch, throw - - PreProc = { fg = C.pink }, -- (preferred) generic Preprocessor - Include = { fg = C.mauve, style = O.styles.keywords or {} }, -- preprocessor #include - Define = { link = "PreProc" }, -- preprocessor #define - Macro = { fg = C.mauve }, -- same as Define - PreCondit = { link = "PreProc" }, -- preprocessor #if, #else, #endif, etc. - - StorageClass = { fg = C.yellow }, -- static, register, volatile, etc. - Structure = { fg = C.yellow }, -- struct, union, enum, etc. - Special = { fg = C.pink }, -- (preferred) any special symbol - Type = { fg = C.yellow, style = O.styles.types or {} }, -- (preferred) int, long, char, etc. - Typedef = { link = "Type" }, -- A typedef - SpecialChar = { link = "Special" }, -- special character in a constant - Tag = { fg = C.lavender, style = { "bold" } }, -- you can use CTRL-] on this - Delimiter = { fg = C.overlay2 }, -- character that needs attention - Debug = { link = "Special" }, -- debugging statements - - Underlined = { style = { "underline" } }, -- (preferred) text that stands out, HTML links - Bold = { style = { "bold" } }, - Italic = { style = { "italic" } }, - -- ("Ignore", below, may be invisible...) - -- Ignore = { }, -- (preferred) left blank, hidden |hl-Ignore| - - Error = { fg = C.red }, -- (preferred) any erroneous construct - Todo = { bg = C.flamingo, fg = C.base, style = { "bold" } }, -- (preferred) anything that needs extra attention; mostly the keywords TODO FIXME and XXX - qfLineNr = { fg = C.yellow }, - qfFileName = { fg = C.blue }, - htmlH1 = { fg = C.pink, style = { "bold" } }, - htmlH2 = { fg = C.blue, style = { "bold" } }, - -- mkdHeading = { fg = C.peach, style = { "bold" } }, - -- mkdCode = { bg = C.terminal_black, fg = C.text }, - mkdCodeDelimiter = { bg = C.base, fg = C.text }, - mkdCodeStart = { fg = C.flamingo, style = { "bold" } }, - mkdCodeEnd = { fg = C.flamingo, style = { "bold" } }, - -- mkdLink = { fg = C.blue, style = { "underline" } }, - - -- debugging - debugPC = { bg = O.transparent_background and C.none or C.crust }, -- used for highlighting the current line in terminal-debug - debugBreakpoint = { bg = C.base, fg = C.overlay0 }, -- used for breakpoint colors in terminal-debug - -- illuminate - illuminatedWord = { bg = C.surface1 }, - illuminatedCurWord = { bg = C.surface1 }, - -- diff - diffAdded = { fg = C.green }, - diffRemoved = { fg = C.red }, - diffChanged = { fg = C.blue }, - diffOldFile = { fg = C.yellow }, - diffNewFile = { fg = C.peach }, - diffFile = { fg = C.blue }, - diffLine = { fg = C.overlay0 }, - diffIndexLine = { fg = C.teal }, - DiffAdd = { bg = U.darken(C.green, 0.18, C.base) }, -- diff mode: Added line |diff.txt| - DiffChange = { bg = U.darken(C.blue, 0.07, C.base) }, -- diff mode: Changed line |diff.txt| - DiffDelete = { bg = U.darken(C.red, 0.18, C.base) }, -- diff mode: Deleted line |diff.txt| - DiffText = { bg = U.darken(C.blue, 0.30, C.base) }, -- diff mode: Changed text within a changed line |diff.txt| - -- NeoVim - healthError = { fg = C.red }, - healthSuccess = { fg = C.teal }, - healthWarning = { fg = C.yellow }, - -- misc - - -- glyphs - GlyphPalette1 = { fg = C.red }, - GlyphPalette2 = { fg = C.teal }, - GlyphPalette3 = { fg = C.yellow }, - GlyphPalette4 = { fg = C.blue }, - GlyphPalette6 = { fg = C.teal }, - GlyphPalette7 = { fg = C.text }, - GlyphPalette9 = { fg = C.red }, - - -- rainbow - rainbow1 = { fg = C.red }, - rainbow2 = { fg = C.peach }, - rainbow3 = { fg = C.yellow }, - rainbow4 = { fg = C.green }, - rainbow5 = { fg = C.sapphire }, - rainbow6 = { fg = C.lavender }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/terminal.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/terminal.lua deleted file mode 100644 index 26f4fd30..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/groups/terminal.lua +++ /dev/null @@ -1,31 +0,0 @@ -local M = {} - -function M.get() - return { - terminal_color_0 = C.overlay0, - terminal_color_8 = C.overlay1, - - terminal_color_1 = C.red, - terminal_color_9 = C.red, - - terminal_color_2 = C.green, - terminal_color_10 = C.green, - - terminal_color_3 = C.yellow, - terminal_color_11 = C.yellow, - - terminal_color_4 = C.blue, - terminal_color_12 = C.blue, - - terminal_color_5 = C.pink, - terminal_color_13 = C.pink, - - terminal_color_6 = C.sky, - terminal_color_14 = C.sky, - - terminal_color_7 = C.text, - terminal_color_15 = C.text, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/init.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/init.lua deleted file mode 100644 index ad205f95..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/init.lua +++ /dev/null @@ -1,231 +0,0 @@ -local is_vim = vim.fn.has "nvim" ~= 1 -if is_vim then require "catppuccin.lib.vim" end - ----@type Catppuccin -local M = { - default_options = { - flavour = "auto", - background = { - light = "latte", - dark = "mocha", - }, - compile_path = vim.fn.stdpath "cache" .. "/catppuccin", - transparent_background = false, - show_end_of_buffer = false, - term_colors = false, - kitty = vim.env.KITTY_WINDOW_ID and true or false, - dim_inactive = { - enabled = false, - shade = "dark", - percentage = 0.15, - }, - no_italic = false, - no_bold = false, - no_underline = false, - styles = { - comments = { "italic" }, - conditionals = { "italic" }, - loops = {}, - functions = {}, - keywords = {}, - strings = {}, - variables = {}, - numbers = {}, - booleans = {}, - properties = {}, - types = {}, - operators = {}, - }, - default_integrations = true, - integrations = { - alpha = true, - cmp = true, - dap = true, - dap_ui = true, - dashboard = true, - diffview = false, - flash = true, - gitsigns = true, - markdown = true, - neogit = true, - neotree = true, - nvimtree = true, - ufo = true, - rainbow_delimiters = true, - semantic_tokens = not is_vim, - telescope = { enabled = true }, - treesitter = not is_vim, - treesitter_context = true, - barbecue = { - dim_dirname = true, - bold_basename = true, - dim_context = false, - alt_background = false, - }, - illuminate = { - enabled = true, - lsp = false, - }, - indent_blankline = { - enabled = true, - scope_color = "", - colored_indent_levels = false, - }, - native_lsp = { - enabled = true, - virtual_text = { - errors = { "italic" }, - hints = { "italic" }, - warnings = { "italic" }, - information = { "italic" }, - }, - underlines = { - errors = { "underline" }, - hints = { "underline" }, - warnings = { "underline" }, - information = { "underline" }, - }, - inlay_hints = { - background = true, - }, - }, - navic = { - enabled = false, - custom_bg = "NONE", - }, - dropbar = { - enabled = true, - color_mode = false, - }, - colorful_winsep = { - enabled = false, - color = "red", - }, - }, - color_overrides = {}, - highlight_overrides = {}, - }, - flavours = { latte = 1, frappe = 2, macchiato = 3, mocha = 4 }, - path_sep = jit and (jit.os == "Windows" and "\\" or "/") or package.config:sub(1, 1), -} - -M.options = M.default_options - -function M.compile() - local user_flavour = M.flavour - for flavour, _ in pairs(M.flavours) do - M.flavour = flavour - require("catppuccin.lib." .. (is_vim and "vim." or "") .. "compiler").compile(flavour) - end - M.flavour = user_flavour -- Restore user flavour after compile -end - -local function get_flavour(default) - local flavour - if default and default == M.flavour and vim.o.background ~= (M.flavour == "latte" and "light" or "dark") then - flavour = M.options.background[vim.o.background] - else - flavour = default - end - - if flavour and not M.flavours[flavour] then - vim.notify( - string.format( - "Catppuccin (error): Invalid flavour '%s', flavour must be 'latte', 'frappe', 'macchiato', 'mocha' or 'auto'", - flavour - ), - vim.log.levels.ERROR - ) - flavour = nil - end - return flavour or M.options.flavour or vim.g.catppuccin_flavour or M.options.background[vim.o.background] -end - -local did_setup = false - -function M.load(flavour) - if M.options.flavour == "auto" then -- set colorscheme based on o:background - M.options.flavour = nil -- ensure that this will only run once on startup - end - if not did_setup then M.setup() end - M.flavour = get_flavour(flavour) - local compiled_path = M.options.compile_path .. M.path_sep .. M.flavour - local f = loadfile(compiled_path) - if not f then - M.compile() - f = assert(loadfile(compiled_path), "could not load cache") - end - f(flavour or M.options.flavour or vim.g.catppuccin_flavour) -end - ----@type fun(user_conf: CatppuccinOptions?) -function M.setup(user_conf) - did_setup = true - -- Parsing user config - user_conf = user_conf or {} - - if user_conf.default_integrations == false then M.default_options.integrations = {} end - - M.options = vim.tbl_deep_extend("keep", user_conf, M.default_options) - M.options.highlight_overrides.all = user_conf.custom_highlights or M.options.highlight_overrides.all - - -- Get cached hash - local cached_path = M.options.compile_path .. M.path_sep .. "cached" - local file = io.open(cached_path) - local cached = nil - if file then - cached = file:read() - file:close() - end - - -- Get current hash - local git_path = debug.getinfo(1).source:sub(2, -24) .. ".git" - local git = vim.fn.getftime(git_path) -- 2x faster vim.loop.fs_stat - local hash = require("catppuccin.lib.hashing").hash(user_conf) - .. (git == -1 and git_path or git) -- no .git in /nix/store -> cache path - .. (vim.o.winblend == 0 and 1 or 0) -- :h winblend - .. (vim.o.pumblend == 0 and 1 or 0) -- :h pumblend - - -- Recompile if hash changed - if cached ~= hash then - M.compile() - file = io.open(cached_path, "wb") - if file then - file:write(hash) - file:close() - end - end -end - -if is_vim then return M end - -vim.api.nvim_create_user_command( - "Catppuccin", - function(inp) vim.api.nvim_command("colorscheme catppuccin-" .. get_flavour(inp.args)) end, - { - nargs = 1, - complete = function(line) - return vim.tbl_filter(function(val) return vim.startswith(val, line) end, vim.tbl_keys(M.flavours)) - end, - } -) - -vim.api.nvim_create_user_command("CatppuccinCompile", function() - for name, _ in pairs(package.loaded) do - if name:match "^catppuccin." then package.loaded[name] = nil end - end - M.compile() - vim.notify("Catppuccin (info): compiled cache!", vim.log.levels.INFO) - vim.cmd.colorscheme "catppuccin" -end, {}) - -if vim.g.catppuccin_debug then - vim.api.nvim_create_autocmd("BufWritePost", { - pattern = "*/catppuccin/*", - callback = function() - vim.schedule(function() vim.cmd "CatppuccinCompile" end) - end, - }) -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/compiler.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/compiler.lua deleted file mode 100644 index 5c844567..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/compiler.lua +++ /dev/null @@ -1,104 +0,0 @@ -local path_sep = require("catppuccin").path_sep -local O = require("catppuccin").options -local M = {} - --- Credit: https://github.com/EdenEast/nightfox.nvim -local fmt = string.format - -local function inspect(t) - local list = {} - for k, v in pairs(t) do - local tv = type(v) - if tv == "string" then - table.insert(list, fmt([[%s = "%s"]], k, v)) - elseif tv == "table" then - table.insert(list, fmt([[%s = %s]], k, inspect(v))) - else - table.insert(list, fmt([[%s = %s]], k, tostring(v))) - end - end - return fmt([[{ %s }]], table.concat(list, ", ")) -end - -function M.compile(flavour) - local theme = require("catppuccin.lib.mapper").apply(flavour) - local lines = { - string.format( - [[ -return string.dump(function(flavour) -vim.o.termguicolors = true -if vim.g.colors_name then vim.cmd("hi clear") end -if flavour then vim.o.background = "%s" end -vim.g.colors_name = "catppuccin-%s" -local h = vim.api.nvim_set_hl]], - flavour == "latte" and "light" or "dark", - flavour - ), - } - if path_sep == "\\" then O.compile_path = O.compile_path:gsub("/", "\\") end - - local tbl = vim.tbl_deep_extend("keep", theme.custom_highlights, theme.integrations, theme.syntax, theme.editor) - - if O.term_colors == true then - for k, v in pairs(theme.terminal) do - table.insert(lines, fmt('vim.g.%s = "%s"', k, v)) - end - end - - for group, color in pairs(tbl) do - if color.style then - for _, style in pairs(color.style) do - color[style] = true - if O.no_italic and style == "italic" then color[style] = false end - if O.no_bold and style == "bold" then color[style] = false end - if O.no_underline and style == "underline" then color[style] = false end - end - end - color.style = nil - if color.link and (theme.custom_highlights[group] and not theme.custom_highlights[group].link) then - color.link = nil - end - table.insert(lines, fmt([[h(0, "%s", %s)]], group, inspect(color))) - end - table.insert(lines, "end, true)") - if vim.fn.isdirectory(O.compile_path) == 0 then vim.fn.mkdir(O.compile_path, "p") end - - if vim.g.catppuccin_debug then -- Debugging purpose - local deb = io.open(O.compile_path .. path_sep .. flavour .. ".lua", "wb") - if deb then - deb:write(table.concat(lines, "\n")) - deb:close() - end - end - - local f = loadstring(table.concat(lines, "\n")) - if not f then - local err_path = (path_sep == "/" and "/tmp" or os.getenv "TMP") .. "/catppuccin_error.lua" - print(string.format( - [[Catppuccin (error): Most likely some mistake made in your catppuccin config -You can open %s for debugging - -If you think this is a bug, kindly open an issue and attach %s file -Below is the error message that we captured: -]], - err_path, - err_path - )) - local err = io.open(err_path, "wb") - if err then - err:write(table.concat(lines, "\n")) - err:close() - end - dofile(err_path) - return - end - - local file = assert( - io.open(O.compile_path .. path_sep .. flavour, "wb"), - "Permission denied while writing compiled file to " .. O.compile_path .. path_sep .. flavour - ) - file:write(f()) - file:close() -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/hashing.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/hashing.lua deleted file mode 100644 index d2272f15..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/hashing.lua +++ /dev/null @@ -1,26 +0,0 @@ -local M = {} -local B = bit or bit32 or require "catppuccin.lib.vim.bit" - -local hash_str = function(str) -- djb2, https://theartincode.stanis.me/008-djb2/ - local hash = 5381 - for i = 1, #str do - hash = B.lshift(hash, 5) + hash + string.byte(str, i) - end - return hash -end - -function M.hash(v) -- Xor hashing: https://codeforces.com/blog/entry/85900 - local t = type(v) - if t == "table" then - local hash = 0 - for p, u in next, v do - hash = B.bxor(hash, hash_str(p .. M.hash(u))) - end - return hash - elseif t == "function" then - return M.hash(v(require("catppuccin.palettes").get_palette())) - end - return tostring(v) -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/highlighter.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/highlighter.lua deleted file mode 100644 index d6887437..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/highlighter.lua +++ /dev/null @@ -1,20 +0,0 @@ --- DEPRECATED MODULE -local M = {} - -function M.highlight(group, color) - if color.style then - for _, style in ipairs(color.style) do - color[style] = true - end - end - color.style = nil - vim.api.nvim_set_hl(0, group, color) -end - -function M.syntax(tbl) - for group, colors in pairs(tbl) do - M.highlight(group, colors) - end -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/hsluv.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/hsluv.lua deleted file mode 100644 index 36354164..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/hsluv.lua +++ /dev/null @@ -1,290 +0,0 @@ ---[[ -Lua implementation of HSLuv and HPLuv color spaces -Homepage: http://www.hsluv.org/ - -Copyright (C) 2019 Alexei Boronine - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and -associated documentation files (the "Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the -following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial -portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT -LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -]] -local hsluv = {} - -hsluv.hexChars = "0123456789abcdef" - -local distance_line_from_origin = function(line) return math.abs(line.intercept) / math.sqrt((line.slope ^ 2) + 1) end - -local length_of_ray_until_intersect = function(theta, line) - return line.intercept / (math.sin(theta) - line.slope * math.cos(theta)) -end - -hsluv.get_bounds = function(l) - local result = {} - local sub2 - local sub1 = ((l + 16) ^ 3) / 1560896 - if sub1 > hsluv.epsilon then - sub2 = sub1 - else - sub2 = l / hsluv.kappa - end - - for i = 1, 3 do - local m1 = hsluv.m[i][1] - local m2 = hsluv.m[i][2] - local m3 = hsluv.m[i][3] - - for t = 0, 1 do - local top1 = (284517 * m1 - 94839 * m3) * sub2 - local top2 = (838422 * m3 + 769860 * m2 + 731718 * m1) * l * sub2 - 769860 * t * l - local bottom = (632260 * m3 - 126452 * m2) * sub2 + 126452 * t - table.insert(result, { slope = top1 / bottom, intercept = top2 / bottom }) - end - end - return result -end - -hsluv.max_safe_chroma_for_l = function(l) - local bounds = hsluv.get_bounds(l) - local min = 1.7976931348623157e+308 - - for i = 1, 6 do - local length = distance_line_from_origin(bounds[i]) - if length >= 0 then min = math.min(min, length) end - end - return min -end - -hsluv.max_safe_chroma_for_lh = function(l, h) - local hrad = h / 360 * math.pi * 2 - local bounds = hsluv.get_bounds(l) - local min = 1.7976931348623157e+308 - - for i = 1, 6 do - local bound = bounds[i] - local length = length_of_ray_until_intersect(hrad, bound) - if length >= 0 then min = math.min(min, length) end - end - return min -end - -hsluv.dot_product = function(a, b) - local sum = 0 - for i = 1, 3 do - sum = sum + a[i] * b[i] - end - return sum -end - -hsluv.from_linear = function(c) - if c <= 0.0031308 then - return 12.92 * c - else - return 1.055 * (c ^ 0.416666666666666685) - 0.055 - end -end - -hsluv.to_linear = function(c) - if c > 0.04045 then - return ((c + 0.055) / 1.055) ^ 2.4 - else - return c / 12.92 - end -end - -hsluv.xyz_to_rgb = function(tuple) - return { - hsluv.from_linear(hsluv.dot_product(hsluv.m[1], tuple)), - hsluv.from_linear(hsluv.dot_product(hsluv.m[2], tuple)), - hsluv.from_linear(hsluv.dot_product(hsluv.m[3], tuple)), - } -end - -hsluv.rgb_to_xyz = function(tuple) - local rgbl = { hsluv.to_linear(tuple[1]), hsluv.to_linear(tuple[2]), hsluv.to_linear(tuple[3]) } - return { - hsluv.dot_product(hsluv.minv[1], rgbl), - hsluv.dot_product(hsluv.minv[2], rgbl), - hsluv.dot_product(hsluv.minv[3], rgbl), - } -end - -hsluv.y_to_l = function(Y) - if Y <= hsluv.epsilon then - return Y / hsluv.refY * hsluv.kappa - else - return 116 * ((Y / hsluv.refY) ^ 0.333333333333333315) - 16 - end -end - -hsluv.l_to_y = function(L) - if L <= 8 then - return hsluv.refY * L / hsluv.kappa - else - return hsluv.refY * (((L + 16) / 116) ^ 3) - end -end - -hsluv.xyz_to_luv = function(tuple) - local X = tuple[1] - local Y = tuple[2] - local divider = X + 15 * Y + 3 * tuple[3] - local varU = 4 * X - local varV = 9 * Y - if divider ~= 0 then - varU = varU / divider - varV = varV / divider - else - varU = 0 - varV = 0 - end - local L = hsluv.y_to_l(Y) - if L == 0 then return { 0, 0, 0 } end - return { L, 13 * L * (varU - hsluv.refU), 13 * L * (varV - hsluv.refV) } -end - -hsluv.luv_to_xyz = function(tuple) - local L = tuple[1] - local U = tuple[2] - local V = tuple[3] - if L == 0 then return { 0, 0, 0 } end - local varU = U / (13 * L) + hsluv.refU - local varV = V / (13 * L) + hsluv.refV - local Y = hsluv.l_to_y(L) - local X = 0 - (9 * Y * varU) / (((varU - 4) * varV) - varU * varV) - return { X, Y, (9 * Y - 15 * varV * Y - varV * X) / (3 * varV) } -end - -hsluv.luv_to_lch = function(tuple) - local L = tuple[1] - local U = tuple[2] - local V = tuple[3] - local C = math.sqrt(U * U + V * V) - local H - if C < 0.00000001 then - H = 0 - else - H = math.atan2(V, U) * 180.0 / 3.1415926535897932 - if H < 0 then H = 360 + H end - end - return { L, C, H } -end - -hsluv.lch_to_luv = function(tuple) - local L = tuple[1] - local C = tuple[2] - local Hrad = tuple[3] / 360.0 * 2 * math.pi - return { L, math.cos(Hrad) * C, math.sin(Hrad) * C } -end - -hsluv.hsluv_to_lch = function(tuple) - local H = tuple[1] - local S = tuple[2] - local L = tuple[3] - if L > 99.9999999 then return { 100, 0, H } end - if L < 0.00000001 then return { 0, 0, H } end - return { L, hsluv.max_safe_chroma_for_lh(L, H) / 100 * S, H } -end - -hsluv.lch_to_hsluv = function(tuple) - local L = tuple[1] - local C = tuple[2] - local H = tuple[3] - local max_chroma = hsluv.max_safe_chroma_for_lh(L, H) - if L > 99.9999999 then return { H, 0, 100 } end - if L < 0.00000001 then return { H, 0, 0 } end - - return { H, C / max_chroma * 100, L } -end - -hsluv.hpluv_to_lch = function(tuple) - local H = tuple[1] - local S = tuple[2] - local L = tuple[3] - if L > 99.9999999 then return { 100, 0, H } end - if L < 0.00000001 then return { 0, 0, H } end - return { L, hsluv.max_safe_chroma_for_l(L) / 100 * S, H } -end - -hsluv.lch_to_hpluv = function(tuple) - local L = tuple[1] - local C = tuple[2] - local H = tuple[3] - if L > 99.9999999 then return { H, 0, 100 } end - if L < 0.00000001 then return { H, 0, 0 } end - return { H, C / hsluv.max_safe_chroma_for_l(L) * 100, L } -end - -hsluv.rgb_to_hex = function(tuple) - local h = "#" - for i = 1, 3 do - local c = math.floor(tuple[i] * 255 + 0.5) - local digit2 = math.fmod(c, 16) - local x = (c - digit2) / 16 - local digit1 = math.floor(x) - h = h .. string.sub(hsluv.hexChars, digit1 + 1, digit1 + 1) - h = h .. string.sub(hsluv.hexChars, digit2 + 1, digit2 + 1) - end - return h -end - -hsluv.hex_to_rgb = function(hex) - hex = string.lower(hex) - local ret = {} - for i = 0, 2 do - local char1 = string.sub(hex, i * 2 + 2, i * 2 + 2) - local char2 = string.sub(hex, i * 2 + 3, i * 2 + 3) - local digit1 = string.find(hsluv.hexChars, char1) - 1 - local digit2 = string.find(hsluv.hexChars, char2) - 1 - ret[i + 1] = (digit1 * 16 + digit2) / 255.0 - end - return ret -end - -hsluv.lch_to_rgb = function(tuple) return hsluv.xyz_to_rgb(hsluv.luv_to_xyz(hsluv.lch_to_luv(tuple))) end - -hsluv.rgb_to_lch = function(tuple) return hsluv.luv_to_lch(hsluv.xyz_to_luv(hsluv.rgb_to_xyz(tuple))) end - -hsluv.hsluv_to_rgb = function(tuple) return hsluv.lch_to_rgb(hsluv.hsluv_to_lch(tuple)) end - -hsluv.rgb_to_hsluv = function(tuple) return hsluv.lch_to_hsluv(hsluv.rgb_to_lch(tuple)) end - -hsluv.hpluv_to_rgb = function(tuple) return hsluv.lch_to_rgb(hsluv.hpluv_to_lch(tuple)) end - -hsluv.rgb_to_hpluv = function(tuple) return hsluv.lch_to_hpluv(hsluv.rgb_to_lch(tuple)) end - -hsluv.hsluv_to_hex = function(tuple) return hsluv.rgb_to_hex(hsluv.hsluv_to_rgb(tuple)) end - -hsluv.hpluv_to_hex = function(tuple) return hsluv.rgb_to_hex(hsluv.hpluv_to_rgb(tuple)) end - -hsluv.hex_to_hsluv = function(s) return hsluv.rgb_to_hsluv(hsluv.hex_to_rgb(s)) end - -hsluv.hex_to_hpluv = function(s) return hsluv.rgb_to_hpluv(hsluv.hex_to_rgb(s)) end - -hsluv.m = { - { 3.240969941904521, -1.537383177570093, -0.498610760293 }, - { -0.96924363628087, 1.87596750150772, 0.041555057407175 }, - { 0.055630079696993, -0.20397695888897, 1.056971514242878 }, -} -hsluv.minv = { - { 0.41239079926595, 0.35758433938387, 0.18048078840183 }, - { 0.21263900587151, 0.71516867876775, 0.072192315360733 }, - { 0.019330818715591, 0.11919477979462, 0.95053215224966 }, -} -hsluv.refY = 1.0 -hsluv.refU = 0.19783000664283 -hsluv.refV = 0.46831999493879 -hsluv.kappa = 903.2962962 -hsluv.epsilon = 0.0088564516 - -return hsluv diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/mapper.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/mapper.lua deleted file mode 100644 index 2f60323d..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/mapper.lua +++ /dev/null @@ -1,72 +0,0 @@ -local M = {} - -function M.apply(flavour) - flavour = flavour or require("catppuccin").flavour - - local _O, _C, _U = O, C, U -- Borrowing global var (setfenv doesn't work with require) - O = require("catppuccin").options - C = require("catppuccin.palettes").get_palette(flavour) - U = require "catppuccin.utils.colors" - - C.none = "NONE" - - local dim_percentage = O.dim_inactive.percentage - C.dim = O.dim_inactive.shade == "dark" - and U.vary_color( - { latte = U.darken(C.base, dim_percentage, C.mantle) }, - U.darken(C.base, dim_percentage, C.mantle) - ) - or U.vary_color( - { latte = U.lighten("#FBFCFD", dim_percentage, C.base) }, - U.lighten(C.surface0, dim_percentage, C.base) - ) - - local theme = {} - theme.syntax = require("catppuccin.groups.syntax").get() - theme.editor = require("catppuccin.groups.editor").get() - local final_integrations = {} - - -- https://github.com/catppuccin/nvim/pull/624 - if type(O.integrations.dap) == "table" and O.integrations.dap.enable_ui ~= nil then - O.integrations.dap_ui = O.integrations.dap.enable_ui - O.integrations.dap.enable_ui = nil - end - - for integration in pairs(O.integrations) do - local cot = false - if type(O.integrations[integration]) == "table" then - if O.integrations[integration].enabled == true then cot = true end - else - if O.integrations[integration] == true then - local default = require("catppuccin").default_options.integrations[integration] - O.integrations[integration] = type(default) == "table" and default or {} - O.integrations[integration].enabled = true - cot = true - end - end - - if cot then - final_integrations = vim.tbl_deep_extend( - "force", - final_integrations, - require("catppuccin.groups.integrations." .. integration).get() - ) - end - end - - theme.integrations = final_integrations -- plugins - theme.terminal = require("catppuccin.groups.terminal").get() -- terminal colors - local user_highlights = O.highlight_overrides - if type(user_highlights[flavour]) == "function" then user_highlights[flavour] = user_highlights[flavour](C) end - theme.custom_highlights = vim.tbl_deep_extend( - "keep", - user_highlights[flavour] or {}, - type(user_highlights.all) == "function" and user_highlights.all(C) or user_highlights.all or {} - ) - - O, C, U = _O, _C, _U -- Returning global var - - return theme -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/vim/bit.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/vim/bit.lua deleted file mode 100644 index ea565fe5..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/vim/bit.lua +++ /dev/null @@ -1,79 +0,0 @@ --- Reference(stripped down): https://github.com/davidm/lua-bit-numberlua/blob/master/lmod/bit/numberlua.lua -local M = {} - -local floor = math.floor - -local MOD = 2 ^ 32 - -local function memoize(f) - local mt = {} - local t = setmetatable({}, mt) - function mt:__index(k) - local v = f(k) - t[k] = v - return v - end - - return t -end - -local function make_bitop_uncached(t, m) - local function bitop(a, b) - local res, p = 0, 1 - while a ~= 0 and b ~= 0 do - local am, bm = a % m, b % m - res = res + t[am][bm] * p - a = (a - am) / m - b = (b - bm) / m - p = p * m - end - res = res + (a + b) * p - return res - end - - return bitop -end - -local function make_bitop(t) - local op1 = make_bitop_uncached(t, 2 ^ 1) - local op2 = memoize(function(a) - return memoize(function(b) return op1(a, b) end) - end) - return make_bitop_uncached(op2, 2 ^ (t.n or 1)) -end - -M.bxor = make_bitop { [0] = { [0] = 0, [1] = 1 }, [1] = { [0] = 1, [1] = 0 }, n = 4 } -local bxor = M.bxor - -local lshift, rshift - -lshift = function(a, disp) -- Lua5.2 inspired - if disp < 0 then return rshift(a, -disp) end - return (a * 2 ^ disp) % 2 ^ 32 -end - -rshift = function(a, disp) -- Lua5.2 inspired - if disp < 0 then return lshift(a, -disp) end - return floor(a % 2 ^ 32 / 2 ^ disp) -end - -local function bit_tobit(x) - x = x % MOD - if x >= 0x80000000 then x = x - MOD end - return x -end - -local function bit_bxor(a, b, c, ...) - if c then - return bit_bxor(bit_bxor(a, b), c, ...) - elseif b then - return bit_tobit(bxor(a % MOD, b % MOD)) - else - return bit_tobit(a) - end -end - -return { - bxor = bit_bxor, - lshift = function(x, n) return bit_tobit(lshift(x % MOD, n % 32)) end, -} diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/vim/compiler.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/vim/compiler.lua deleted file mode 100644 index cf2bbdd2..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/vim/compiler.lua +++ /dev/null @@ -1,107 +0,0 @@ -local path_sep = require("catppuccin").path_sep -local O = require("catppuccin").options -local M = {} - --- Reference: https://github.com/EdenEast/nightfox.nvim -local fmt = string.format - -function M.compile(flavour) - local theme = require("catppuccin.lib.mapper").apply(flavour) - local lines = { - string.format( - [=[ -return string.dump(function() -vim.command[[ -if exists("colors_name") - hi clear -endif -set termguicolors -set background=%s -let g:colors_name = "catppuccin-%s"]=], - (flavour == "latte" and "light" or "dark"), - flavour - ), - } - - local tbl = vim.tbl_deep_extend("keep", theme.custom_highlights, theme.integrations, theme.syntax, theme.editor) - - if O.term_colors == true then - for k, v in pairs(theme.terminal) do - table.insert(lines, fmt("let g:%s = '%s'", k, v)) - end - end - - for group, color in pairs(tbl) do - if color.link and (theme.custom_highlights[group] and not theme.custom_highlights[group].link) then - color.link = nil - end - if color.link then - table.insert(lines, fmt([[highlight! link %s %s]], group, color.link)) - else - if color.style then - local rstyle = {} - for _, style in pairs(color.style) do - if O.no_italic and style == "italic" then style = nil end - if O.no_bold and style == "bold" then style = nil end - if O.no_underline and style == "underline" then style = nil end - if style then rstyle[#rstyle + 1] = style end - end - color.style = table.concat(rstyle, ",") - end - if color.style == "" then color.style = nil end - table.insert( - lines, - fmt( - [[highlight %s guifg=%s guibg=%s gui=%s guisp=%s]], - group, - color.fg or "NONE", - color.bg or "NONE", - color.style or "NONE", - color.sp or "NONE" - ) - ) - end - end - table.insert(lines, "]]end, true)") - if vim.fn.isdirectory(O.compile_path) == 0 then vim.fn.mkdir(O.compile_path, "p") end - local ls = loadstring or load - - if vim.g.catppuccin_debug then -- Debugging purpose - local deb = io.open(O.compile_path .. path_sep .. flavour .. ".lua", "wb") - if deb then - deb:write(table.concat(lines, "\n")) - deb:close() - end - end - - local f = ls(table.concat(lines, "\n")) - if not f then - local err_path = (path_sep == "/" and "/tmp" or os.getenv "TMP") .. "/catppuccin_error.lua" - print(string.format( - [[Catppuccin (error): Most likely some mistake made in your catppuccin config -You can open %s for debugging - -If you think this is a bug, kindly open an issue and attach %s file -Below is the error message that we captured: -]], - err_path, - err_path - )) - local err = io.open(err_path, "wb") - if err then - err:write(table.concat(lines, "\n")) - err:close() - end - dofile(err_path) - return - end - - local file = assert( - io.open(O.compile_path .. path_sep .. flavour, "wb"), - "Permission denied while writing compiled file to " .. O.compile_path .. path_sep .. flavour - ) - file:write(f()) - file:close() -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/vim/init.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/vim/init.lua deleted file mode 100644 index 3ea1a1b7..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/lib/vim/init.lua +++ /dev/null @@ -1,83 +0,0 @@ --- TODO: private _G.vim -vim.command [[command! CatppuccinCompile lua require('catppuccin').compile() print("Catppuccin (info): compiled cache!")]] - -vim.o = setmetatable({}, { - __index = function(_, k) - if k == "background" then return vim.eval "&background" end - end, -}) - -vim.fn.stdpath = function(what) - if what ~= "cache" then return end - if package.config:sub(1, 1) == "\\" then - return vim.fn.expand "%localappdata%" .. [[Temp\vim]] - else - return (os.getenv "XDG_CACHE_HOME" or vim.fn.expand "$HOME/.cache") .. "/vim" - end -end - -vim.env = setmetatable({}, { - __index = function(_, k) return os.getenv(k) end, -}) - --- Reference: https://github.com/neovim/neovim/blob/master/runtime/lua/vim/shared.lua -local function tbl_isempty(t) - assert(type(t) == "table", string.format("Expected table, got %s", type(t))) - return next(t) == nil -end - -local function tbl_islist(t) - if type(t) ~= "table" then return false end - - local count = 0 - - for k, _ in pairs(t) do - if type(k) == "number" then - count = count + 1 - else - return false - end - end - - if count > 0 then - return true - else - -- TODO(bfredl): in the future, we will always be inside nvim - -- then this check can be deleted. - if vim._empty_dict_mt == nil then return false end - return getmetatable(t) ~= vim._empty_dict_mt - end -end - -local function can_merge(v) return type(v) == "table" and (tbl_isempty(v) or not tbl_islist(v)) end - -local function tbl_extend(behavior, deep_extend, ...) - if behavior ~= "error" and behavior ~= "keep" and behavior ~= "force" then - error('invalid "behavior": ' .. tostring(behavior)) - end - - if select("#", ...) < 2 then - error("wrong number of arguments (given " .. tostring(1 + select("#", ...)) .. ", expected at least 3)") - end - - local ret = {} - if vim._empty_dict_mt ~= nil and getmetatable(select(1, ...)) == vim._empty_dict_mt then ret = vim.empty_dict() end - - for i = 1, select("#", ...) do - local tbl = select(i, ...) - if tbl then - for k, v in pairs(tbl) do - if deep_extend and can_merge(v) and can_merge(ret[k]) then - ret[k] = tbl_extend(behavior, true, ret[k], v) - elseif behavior ~= "force" and ret[k] ~= nil then - if behavior == "error" then error("key found in more than one map: " .. k) end -- Else behavior is "keep". - else - ret[k] = v - end - end - end - end - return ret -end - -function vim.tbl_deep_extend(behavior, ...) return tbl_extend(behavior, true, ...) end diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/palettes/frappe.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/palettes/frappe.lua deleted file mode 100644 index 911d0af4..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/palettes/frappe.lua +++ /dev/null @@ -1,28 +0,0 @@ -return { - rosewater = "#f2d5cf", - flamingo = "#eebebe", - pink = "#f4b8e4", - mauve = "#ca9ee6", - red = "#e78284", - maroon = "#ea999c", - peach = "#ef9f76", - yellow = "#e5c890", - green = "#a6d189", - teal = "#81c8be", - sky = "#99d1db", - sapphire = "#85c1dc", - blue = "#8caaee", - lavender = "#babbf1", - text = "#c6d0f5", - subtext1 = "#b5bfe2", - subtext0 = "#a5adce", - overlay2 = "#949cbb", - overlay1 = "#838ba7", - overlay0 = "#737994", - surface2 = "#626880", - surface1 = "#51576d", - surface0 = "#414559", - base = "#303446", - mantle = "#292c3c", - crust = "#232634", -} diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/palettes/init.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/palettes/init.lua deleted file mode 100644 index 68030c45..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/palettes/init.lua +++ /dev/null @@ -1,21 +0,0 @@ -local M = {} - -function M.get_palette(flavour) - local flvr = flavour or require("catppuccin").flavour or vim.g.catppuccin_flavour or "mocha" - local _, palette = pcall(require, "catppuccin.palettes." .. flvr) - local O = require("catppuccin").options - local ans = vim.tbl_deep_extend("keep", O.color_overrides.all or {}, O.color_overrides[flvr] or {}, palette or {}) - if O.kitty then -- https://github.com/kovidgoyal/kitty/issues/2917 - for accent, hex in pairs(ans) do - local red_green_string = hex:sub(1, 5) - local blue_value = tonumber(hex:sub(6, 7), 16) - - -- Slightly increase or decrease brightness of the blue channel - blue_value = blue_value == 255 and blue_value - 1 or blue_value + 1 - ans[accent] = string.format("%s%.2x", red_green_string, blue_value) - end - end - return ans -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/palettes/latte.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/palettes/latte.lua deleted file mode 100644 index d03f661e..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/palettes/latte.lua +++ /dev/null @@ -1,28 +0,0 @@ -return { - rosewater = "#dc8a78", - flamingo = "#dd7878", - pink = "#ea76cb", - mauve = "#8839ef", - red = "#d20f39", - maroon = "#e64553", - peach = "#fe640b", - yellow = "#df8e1d", - green = "#40a02b", - teal = "#179299", - sky = "#04a5e5", - sapphire = "#209fb5", - blue = "#1e66f5", - lavender = "#7287fd", - text = "#4c4f69", - subtext1 = "#5c5f77", - subtext0 = "#6c6f85", - overlay2 = "#7c7f93", - overlay1 = "#8c8fa1", - overlay0 = "#9ca0b0", - surface2 = "#acb0be", - surface1 = "#bcc0cc", - surface0 = "#ccd0da", - base = "#eff1f5", - mantle = "#e6e9ef", - crust = "#dce0e8", -} diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/palettes/macchiato.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/palettes/macchiato.lua deleted file mode 100644 index f5d95c02..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/palettes/macchiato.lua +++ /dev/null @@ -1,28 +0,0 @@ -return { - rosewater = "#f4dbd6", - flamingo = "#f0c6c6", - pink = "#f5bde6", - mauve = "#c6a0f6", - red = "#ed8796", - maroon = "#ee99a0", - peach = "#f5a97f", - yellow = "#eed49f", - green = "#a6da95", - teal = "#8bd5ca", - sky = "#91d7e3", - sapphire = "#7dc4e4", - blue = "#8aadf4", - lavender = "#b7bdf8", - text = "#cad3f5", - subtext1 = "#b8c0e0", - subtext0 = "#a5adcb", - overlay2 = "#939ab7", - overlay1 = "#8087a2", - overlay0 = "#6e738d", - surface2 = "#5b6078", - surface1 = "#494d64", - surface0 = "#363a4f", - base = "#24273a", - mantle = "#1e2030", - crust = "#181926", -} diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/palettes/mocha.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/palettes/mocha.lua deleted file mode 100644 index 296c0008..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/palettes/mocha.lua +++ /dev/null @@ -1,28 +0,0 @@ -return { - rosewater = "#f5e0dc", - flamingo = "#f2cdcd", - pink = "#f5c2e7", - mauve = "#cba6f7", - red = "#f38ba8", - maroon = "#eba0ac", - peach = "#fab387", - yellow = "#f9e2af", - green = "#a6e3a1", - teal = "#94e2d5", - sky = "#89dceb", - sapphire = "#74c7ec", - blue = "#89b4fa", - lavender = "#b4befe", - text = "#cdd6f4", - subtext1 = "#bac2de", - subtext0 = "#a6adc8", - overlay2 = "#9399b2", - overlay1 = "#7f849c", - overlay0 = "#6c7086", - surface2 = "#585b70", - surface1 = "#45475a", - surface0 = "#313244", - base = "#1e1e2e", - mantle = "#181825", - crust = "#11111b", -} diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/types.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/types.lua deleted file mode 100644 index 8b98a293..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/types.lua +++ /dev/null @@ -1,278 +0,0 @@ ----@class Catppuccin ----@field options CatppuccinOptions ----@field setup fun(opts: CatppuccinOptions?) - ----@alias CtpFlavor "mocha" | "macchiato" | "frappe" | "latte" | "auto" ----@alias CtpColor "rosewater" | "flamingo" | "pink" | "mauve" | "red" | "maroon" | "peach" | "yellow" | "green" | "teal" | "sky" | "sapphire" | "blue" | "lavender" | "text" | "subtext1" | "subtext0" | "overlay2" | "overlay1" | "overlay0" | "surface2" | "surface1" | "surface0" | "base" | "mantle" | "crust" ----@class CtpFlavors: {all: T, mocha: T, macchiato: T, frappe: T, latte: T } ----@class CtpColors: {rosewater: T, flamingo: T, pink: T, mauve: T, red: T, maroon: T, peach: T, yellow: T, green: T, teal: T, sky: T, sapphire: T, blue: T, lavender: T, text: T, subtext1: T, subtext0: T, overlay2: T, overlay1: T, overlay0: T, surface2: T, surface1: T, surface0: T, base: T, mantle: T, crust: T, none: T } - ----@class CatppuccinOptions --- Changes the flavor based on the background. See `:h background` for more info. ----@field background CtpBackground? --- By default catppuccin writes the compiled results into the system's cache directory. --- You can change the cache dir by changing this value. ----@field compile_path string? --- Whether to enable transparency. ----@field transparent_background boolean? --- Toggle the `~` characters after the end of buffers. ----@field show_end_of_buffer boolean? --- If true, sets terminal colors (e.g. `g:terminal_color_0`). ----@field term_colors boolean? --- Workaround for kitty transparency issue: https://github.com/kovidgoyal/kitty/issues/2917 ----@field kitty boolean? --- Settings for dimming of inactive windows. ----@field dim_inactive CtpDimInactive? --- Disables all italic styles. ----@field no_italic boolean? --- Disables all bold styles. ----@field no_bold boolean? --- Disables all underline styles. ----@field no_underline boolean? --- Handles the style of general hl groups (see `:h highlight-groups`). ----@field styles CtpStyles? --- Should default integrations be used. ----@field default_integrations boolean? --- Toggle integrations. Integrations allow Catppuccin to set the theme of various plugins. ----@field integrations CtpIntegrations? --- Catppuccin colors can be overwritten here. ----@field color_overrides CtpColors | CtpFlavors> | nil --- Catppuccin highlights can be overwritten here. ----@field highlight_overrides CtpHighlightOverrides? --- Global highlight overrides. ----@field custom_highlights CtpHighlightOverrideFn | {[string]: CtpHighlight} | nil --- The default flavor to use on startup. ----@field flavour CtpFlavor? - ----@class CtpBackground --- Catppuccin flavor to use when `:set background=dark` is set. ----@field dark CtpFlavor? --- Catppuccin flavor to use when `:set background=light` is set. ----@field light CtpFlavor? - ----@class CtpDimInactive --- Whether to dim inactive windows. ----@field enabled boolean --- Whether to darken or lighten inactive windows. ----@field shade "dark" | "light" | nil --- Percentage of the shade to apply to the inactive window ----@field percentage number? - ----@class CtpStyles --- Change the style of comments. ----@field comments CtpHighlightArgs[]? --- Change the style of conditionals. ----@field conditionals CtpHighlightArgs[]? --- Change the style of loops. ----@field loops CtpHighlightArgs[]? --- Change the style of functions. ----@field functions CtpHighlightArgs[]? --- Change the style of keywords. ----@field keywords CtpHighlightArgs[]? --- Change the style of strings. ----@field strings CtpHighlightArgs[]? --- Change the style of variables. ----@field variables CtpHighlightArgs[]? --- Change the style of numbers. ----@field numbers CtpHighlightArgs[]? --- Change the style of booleans. ----@field booleans CtpHighlightArgs[]? --- Change the style of properties. ----@field properties CtpHighlightArgs[]? --- Change the style of types. ----@field types CtpHighlightArgs[]? --- Change the style of operators. ----@field operators CtpHighlightArgs[]? --- Change the style of miscs. ----@field miscs CtpHighlightArgs[]? - ----@class CtpNativeLspStyles --- Change the style of LSP errors. ----@field errors CtpHighlightArgs[]? --- Change the style of LSP hints. ----@field hints CtpHighlightArgs[]? --- Change the style of LSP warnings. ----@field warnings CtpHighlightArgs[]? --- Change the style of LSP information. ----@field information CtpHighlightArgs[]? - ----@class CtpNativeLspInlayHints --- Toggle the background of inlay hints. ----@field background boolean? - ----@class CtpIntegrations ----@field aerial boolean? ----@field alpha boolean? ----@field barbar boolean? --- Use this to set it up: --- --- ```lua --- require("barbecue").setup { --- -- valid options: --- -- "catppuccin-latte" --- -- "catppuccin-frappe" --- -- "catppuccin-macchiato" --- -- "catppuccin-mocha" --- theme = "catppuccin", --- } ----``` ----@field barbecue CtpIntegrationBarbecue | boolean? ----@field beacon boolean? ----@field colorful_winsep CtpIntegrationColorfulWinsep | boolean? ----@field cmp boolean? --- `coc.nvim` links to `native_lsp` highlight groups, so you can use --- `native_lsp.virtual_text` and `native_lsp.underlines` to style diagnostics. ----@field coc_nvim boolean? --- ```lua --- local sign = vim.fn.sign_define --- --- sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = ""}) --- sign("DapBreakpointCondition", { text = "●", texthl = "DapBreakpointCondition", linehl = "", numhl = ""}) --- sign("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl = ""}) --- ``` ----@field dap boolean? ----@field dap_ui boolean? ----@field dashboard boolean? ----@field diffview boolean? ----@field dropbar CtpIntegrationDropbar | boolean? ----@field fern boolean? --- Set `notification.window.winblend` to `0` in your `fidget` config: --- --- ```lua --- require("fidget").setup { --- notification = { --- window = { winblend = 0 }, --- } --- } --- ``` ----@field fidget boolean? ----@field flash boolean? ----@field gitgutter boolean? ----@field gitsigns boolean? ----@field harpoon boolean? ----@field headlines boolean? ----@field hop boolean? ----@field illuminate CtpIntegrationIlluminate | boolean? ----@field indent_blankline CtpIntegrationIndentBlankline | boolean? ----@field leap boolean? ----@field lightspeed boolean? --- For custom Lsp kind icon and colors, adjust your `lspsaga` config: --- --- ```lua --- require("lspsaga").setup { --- ui = { --- kind = require("catppuccin.groups.integrations.lsp_saga").custom_kind(), --- }, --- } --- ``` ----@field lsp_saga boolean? ----@field lsp_trouble boolean? ----@field markdown boolean? ----@field mason boolean? ----@field native_lsp CtpIntegrationNativeLsp | boolean? --- You **NEED** to enable highlight in your `nvim-navic` config or it won't work: --- --- ```lua --- require("nvim-navic").setup { --- highlight = true --- } --- ``` ----@field navic CtpIntegrationNavic | boolean? ----@field neogit boolean? ----@field neotest boolean? ----@field neotree boolean? ----@field noice boolean? ----@field notify boolean? ----@field nvimtree boolean? ----@field octo boolean? ----@field overseer boolean? ----@field pounce boolean? ----@field rainbow_delimiters boolean? ----@field sandwich boolean? ----@field semantic_tokens boolean? ----@field symbols_outline boolean? ----@field telekasten boolean? ----@field telescope CtpIntegrationTelescope | boolean? ----@field treesitter boolean? ----@field treesitter_context boolean? ----@field ts_rainbow boolean? ----@field ts_rainbow2 boolean? ----@field vim_sneak boolean? ----@field vimwiki boolean? ----@field which_key boolean? ----@field window_picker boolean? - ----@class CtpIntegrationBarbecue --- Whether to use the alternative background. ----@field alt_background boolean? --- Whether the basename should be bold. ----@field bold_basename boolean? --- Whether the context should be dimmed. ----@field dim_context boolean? --- Whether the directory name should be dimmed. ----@field dim_dirname boolean? - ----@class CtpIntegrationColorfulWinsep --- Whether to enable the colorful-winsep integration. ----@field enabled boolean --- Set to a Catppuccin color name to use for the split separator. ----@field color CtpColor? - ----@class CtpIntegrationDropbar --- Whether to enable the dropbar integration. ----@field enabled boolean --- Set to true to apply color to the text in dropbar, false to only apply it to the icons. ----@field color_mode boolean? - ----@class CtpIntegrationIndentBlankline --- Whether to enable the integration. ----@field enabled boolean --- Sets the color of the scope line ----@field scope_color CtpColor? --- Enables char highlights per indent level. --- Follow the instructions on the plugins GitHub repo to set it up. ----@field colored_indent_levels boolean? - ----@class CtpIntegrationMini --- Whether to enable the integration. ----@field enabled boolean --- Sets the color of the scope line ----@field indentscope_color CtpColor? - ----@class CtpIntegrationNativeLsp --- Whether to enable the Native LSP integration. ----@field enabled boolean --- Styles to apply to virtual text. ----@field virtual_text CtpNativeLspStyles? --- Styles to apply to underlines. ----@field underlines CtpNativeLspStyles? --- Inlay hints options. ----@field inlay_hints CtpNativeLspInlayHints? - ----@class CtpIntegrationNavic --- Whether to enable the navic integration. ----@field enabled boolean --- Override the background color for navic. ----@field custom_bg CtpColor | "NONE" | "lualine" | nil - ----@class CtpIntegrationTelescope --- Whether to enable the telescope integration ----@field enabled boolean? --- The style of Telescope ----@field style "classic" | "nvchad" | nil - ----@class CtpIntegrationIlluminate --- Whether to enable the vim-illuminate integration ----@field enabled boolean? --- Whether to standout IlluminatedWordWrite hl group ----@field lsp boolean? - ----@alias CtpHighlightArgs "bold" | "underline" | "undercurl" | "underdouble" | "underdotted" | "underdashed" | "strikethrough" | "reverse" | "inverse" | "italic" | "standout" | "altfont" | "nocombine" | "NONE" ----@alias CtpHighlightOverrideFn fun(colors: CtpColors): { [string]: CtpHighlight} ----@alias CtpHighlightOverrides CtpFlavors - ----@class CtpHighlight ----@field fg string? ----@field bg string? ----@field style CtpHighlightArgs[]? ----@field link string? diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/utils/barbecue.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/utils/barbecue.lua deleted file mode 100644 index cfef00b9..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/utils/barbecue.lua +++ /dev/null @@ -1,53 +0,0 @@ -return function(flavour) - local C = require("catppuccin.palettes").get_palette(flavour) - local O = require("catppuccin").options - - local transparent_bg = O.transparent_background and C.none or C.mantle - - local dirname_color = O.integrations.barbecue.dim_dirname and C.overlay1 or C.text - local basename_bold = O.integrations.barbecue.bold_basename - local context_color = O.integrations.barbecue.dim_context and C.overlay1 or C.text - local background_color = O.integrations.barbecue.alt_background and transparent_bg or C.none - - local M = { - normal = { fg = C.text, bg = background_color }, - - ellipsis = { fg = C.overlay1 }, - separator = { fg = C.overlay1 }, - modified = { fg = C.peach }, - - dirname = { fg = dirname_color }, - basename = { fg = C.text, bold = basename_bold }, - context = { fg = context_color }, - - -- Same keys as navic - context_file = { fg = C.blue }, - context_module = { fg = C.blue }, - context_namespace = { fg = C.blue }, - context_package = { fg = C.blue }, - context_class = { fg = C.yellow }, - context_method = { fg = C.blue }, - context_property = { fg = C.green }, - context_field = { fg = C.green }, - context_constructor = { fg = C.blue }, - context_enum = { fg = C.green }, - context_interface = { fg = C.yellow }, - context_function = { fg = C.blue }, - context_variable = { fg = C.flamingo }, - context_constant = { fg = C.peach }, - context_string = { fg = C.green }, - context_number = { fg = C.peach }, - context_boolean = { fg = C.peach }, - context_array = { fg = C.blue }, - context_object = { fg = C.blue }, - context_key = { fg = C.flamingo }, - context_null = { fg = C.peach }, - context_enum_member = { fg = C.red }, - context_struct = { fg = C.blue }, - context_event = { fg = C.blue }, - context_operator = { fg = C.blue }, - context_type_parameter = { fg = C.blue }, - } - - return M -end diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/utils/colors.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/utils/colors.lua deleted file mode 100644 index ddf0ff17..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/utils/colors.lua +++ /dev/null @@ -1,170 +0,0 @@ -local M = {} - -local hsluv = require "catppuccin.lib.hsluv" - -M.bg = "#000000" -M.fg = "#ffffff" -M.day_brightness = 0.3 - ----@param hex_str string hexadecimal value of a color -local hex_to_rgb = function(hex_str) - local hex = "[abcdef0-9][abcdef0-9]" - local pat = "^#(" .. hex .. ")(" .. hex .. ")(" .. hex .. ")$" - hex_str = string.lower(hex_str) - - assert(string.find(hex_str, pat) ~= nil, "hex_to_rgb: invalid hex_str: " .. tostring(hex_str)) - - local red, green, blue = string.match(hex_str, pat) - return { tonumber(red, 16), tonumber(green, 16), tonumber(blue, 16) } -end - ----@param fg string forecrust color ----@param bg string background color ----@param alpha number number between 0 and 1. 0 results in bg, 1 results in fg -function M.blend(fg, bg, alpha) - bg = hex_to_rgb(bg) - fg = hex_to_rgb(fg) - - local blendChannel = function(i) - local ret = (alpha * fg[i] + ((1 - alpha) * bg[i])) - return math.floor(math.min(math.max(0, ret), 255) + 0.5) - end - - return string.format("#%02X%02X%02X", blendChannel(1), blendChannel(2), blendChannel(3)) -end - -function M.darken(hex, amount, bg) return M.blend(hex, bg or M.bg, math.abs(amount)) end - -function M.lighten(hex, amount, fg) return M.blend(hex, fg or M.fg, math.abs(amount)) end - -function M.brighten(color, percentage) - local hsl = hsluv.hex_to_hsluv(color) - local larpSpace = 100 - hsl[3] - if percentage < 0 then larpSpace = hsl[3] end - hsl[3] = hsl[3] + larpSpace * percentage - return hsluv.hsluv_to_hex(hsl) -end - -function M.invertColor(color) - if color ~= "NONE" then - local hsl = hsluv.hex_to_hsluv(color) - hsl[3] = 100 - hsl[3] - if hsl[3] < 40 then hsl[3] = hsl[3] + (100 - hsl[3]) * M.day_brightness end - return hsluv.hsluv_to_hex(hsl) - end - return color -end - -function M.string_to_color(colors, value, default) - if not value or value == "" then return default end - - -- If the value is a hex color code then return it - local hex = "[abcdef0-9][abcdef0-9]" - local pat = "^#" .. hex .. hex .. hex .. "$" - if string.match(value, pat) then return value end - - local acceptable_colors = { "black", "red", "green", "blue", "magenta", "cyan", "text", "orange", "pink" } - for _, ac in ipairs(acceptable_colors) do - if string.match(value, ac) then return colors[value] end - end - - -- Did not match anything to return default - return default -end - -function M.color_is_bright(r, g, b) - -- Counting the perceptive luminance - human eye favors green color - local luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255 - if luminance > 0.5 then - return true -- Bright colors, black font - else - return false -- Dark colors, text font - end -end - -function M.hex2rgb(hex) - return tonumber("0x" .. hex:sub(1, 2)), tonumber("0x" .. hex:sub(3, 4)), tonumber("0x" .. hex:sub(5, 6)) -end - -function M.assert_brightness(color) - local hex = color:gsub("#", "") - local r = M.hex2rgb(string.sub(hex, 1, 2)) - local g = M.hex2rgb(string.sub(hex, 3, 4)) - local b = M.hex2rgb(string.sub(hex, 5, 6)) - - if M.color_is_bright(tonumber(r), tonumber(g), tonumber(b)) == true then - return true -- bright - end - - return false -- dull -end - -function M.vary_color(palettes, default) - local flvr = require("catppuccin").flavour - - if palettes[flvr] ~= nil then return palettes[flvr] end - return default -end - -local function rgb2Hex(rgb) - local hexadecimal = "#" - - for _, value in pairs(rgb) do - local hex = "" - - while value > 0 do - local index = math.fmod(value, 16) + 1 - value = math.floor(value / 16) - hex = string.sub(hsluv.hexChars, index, index) .. hex - end - - if string.len(hex) == 0 then - hex = "00" - elseif string.len(hex) == 1 then - hex = "0" .. hex - end - - hexadecimal = hexadecimal .. hex - end - - return hexadecimal -end - -function M.increase_saturation(hex, percentage) - local rgb = hex_to_rgb(hex) - - local saturation_float = percentage - - table.sort(rgb) - local rgb_intensity = { - min = rgb[1] / 255, - mid = rgb[2] / 255, - max = rgb[3] / 255, - } - - if rgb_intensity.max == rgb_intensity.min then - -- all colors have same intensity, which means - -- the original color is gray, so we can't change saturation. - return hex - end - - local new_intensities = {} - new_intensities.max = rgb_intensity.max - new_intensities.min = rgb_intensity.max * (1 - saturation_float) - - if rgb_intensity.mid == rgb_intensity.min then - new_intensities.mid = new_intensities.min - else - local intensity_proportion = (rgb_intensity.max - rgb_intensity.mid) / (rgb_intensity.mid - rgb_intensity.min) - new_intensities.mid = (intensity_proportion * new_intensities.min + rgb_intensity.max) - / (intensity_proportion + 1) - end - - for i, v in pairs(new_intensities) do - new_intensities[i] = math.floor(v * 255) - end - table.sort(new_intensities) - return (rgb2Hex { new_intensities.max, new_intensities.min, new_intensities.mid }) -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/utils/lualine.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/utils/lualine.lua deleted file mode 100644 index 8f0b1f0b..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/utils/lualine.lua +++ /dev/null @@ -1,46 +0,0 @@ -return function(flavour) - local C = require("catppuccin.palettes").get_palette(flavour) - local O = require("catppuccin").options - local catppuccin = {} - - local transparent_bg = O.transparent_background and "NONE" or C.mantle - - catppuccin.normal = { - a = { bg = C.blue, fg = C.mantle, gui = "bold" }, - b = { bg = C.surface0, fg = C.blue }, - c = { bg = transparent_bg, fg = C.text }, - } - - catppuccin.insert = { - a = { bg = C.green, fg = C.base, gui = "bold" }, - b = { bg = C.surface0, fg = C.green }, - } - - catppuccin.terminal = { - a = { bg = C.green, fg = C.base, gui = "bold" }, - b = { bg = C.surface0, fg = C.green }, - } - - catppuccin.command = { - a = { bg = C.peach, fg = C.base, gui = "bold" }, - b = { bg = C.surface0, fg = C.peach }, - } - - catppuccin.visual = { - a = { bg = C.mauve, fg = C.base, gui = "bold" }, - b = { bg = C.surface0, fg = C.mauve }, - } - - catppuccin.replace = { - a = { bg = C.red, fg = C.base, gui = "bold" }, - b = { bg = C.surface0, fg = C.red }, - } - - catppuccin.inactive = { - a = { bg = transparent_bg, fg = C.blue }, - b = { bg = transparent_bg, fg = C.surface1, gui = "bold" }, - c = { bg = transparent_bg, fg = C.overlay0 }, - } - - return catppuccin -end diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/utils/reactive.lua b/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/utils/reactive.lua deleted file mode 100644 index ca8bfc26..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/catppuccin/utils/reactive.lua +++ /dev/null @@ -1,135 +0,0 @@ -local M = {} - -function M.cursor(name, palette) - return { - name = name, - init = function() vim.opt.guicursor:append "a:ReactiveCursor" end, - modes = { - i = { - hl = { - ReactiveCursor = { bg = palette.teal }, - }, - }, - no = { - operators = { - d = { - hl = { - ReactiveCursor = { bg = palette.red }, - }, - }, - y = { - hl = { - ReactiveCursor = { bg = palette.peach }, - }, - }, - c = { - hl = { - ReactiveCursor = { bg = palette.blue }, - }, - }, - }, - }, - R = { - hl = { - ReactiveCursor = { bg = palette.sapphire }, - }, - }, - -- visual - [{ "v", "V", "\x16" }] = { - hl = { - ReactiveCursor = { bg = palette.mauve }, - }, - }, - -- select - [{ "s", "S", "\x13" }] = { - hl = { - ReactiveCursor = { bg = palette.pink }, - }, - }, - }, - } -end - -function M.cursorline(name, palette) - local darken = require("catppuccin.utils.colors").darken - - return { - name = name, - static = { - winhl = { - inactive = { - CursorLine = { bg = darken(palette.surface0, 0.75) }, - CursorLineNr = { bg = darken(palette.surface0, 0.75) }, - }, - }, - }, - modes = { - -- insert mode - i = { - winhl = { - CursorLine = { bg = darken(palette.sky, 0.3) }, - CursorLineNr = { bg = darken(palette.sky, 0.3) }, - }, - }, - -- normal mode - n = { - winhl = { - CursorLine = { bg = palette.surface0 }, - CursorLineNr = { bg = palette.surface0 }, - }, - }, - -- operator-pending mode - no = { - operators = { - [{ "gu", "gU", "g~", "~" }] = { - winhl = { - CursorLine = { bg = palette.surface2 }, - CursorLineNr = { bg = palette.surface2 }, - }, - }, - -- delete operator - d = { - winhl = { - CursorLine = { bg = darken(palette.red, 0.4) }, - CursorLineNr = { bg = darken(palette.red, 0.4) }, - }, - }, - -- yank operator - y = { - winhl = { - CursorLine = { bg = darken(palette.peach, 0.3) }, - CursorLineNr = { bg = darken(palette.peach, 0.3) }, - }, - }, - -- change operator - c = { - winhl = { - CursorLine = { bg = darken(palette.blue, 0.4) }, - CursorLineNr = { bg = darken(palette.blue, 0.4) }, - }, - }, - }, - }, - R = { - winhl = { - CursorLine = { bg = darken(palette.sapphire, 0.4) }, - CursorLineNr = { bg = darken(palette.sapphire, 0.4) }, - }, - }, - -- visual mode - [{ "v", "V", "\x16" }] = { - winhl = { - Visual = { bg = darken(palette.mauve, 0.4) }, - }, - }, - -- select mode - [{ "s", "S", "\x13" }] = { - winhl = { - Visual = { bg = darken(palette.pink, 0.4) }, - }, - }, - }, - } -end - -return M diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/astro/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/astro/rainbow-delimiters.scm deleted file mode 100644 index 9ed95ce1..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/astro/rainbow-delimiters.scm +++ /dev/null @@ -1,13 +0,0 @@ -(element - (start_tag - "<" @delimiter - (tag_name) @delimiter - ">" @delimiter) - (end_tag - "" @delimiter @sentinel)) @container - -(interpolation - "{" @delimiter - "}" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/bash/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/bash/rainbow-delimiters.scm deleted file mode 100644 index b9473ccb..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/bash/rainbow-delimiters.scm +++ /dev/null @@ -1,37 +0,0 @@ -(command_substitution - "$(" @delimiter - ")" @delimiter @sentinel) @container - -(expansion - "${" @delimiter - (":-" @delimiter)? - "}" @delimiter @sentinel) @container - -;;; The double-bracket variant is a bashism -(test_command - ["[[" "["] @delimiter - ["]]" "]"] @delimiter @sentinel) @container - -(subshell - "(" @delimiter - ")" @delimiter @sentinel) @container - -(array - "(" @delimiter - ")" @delimiter @sentinel) @container - -(function_definition - "(" @delimiter - ")" @delimiter @sentinel) @container - -(arithmetic_expansion - "$((" @delimiter - "))" @delimiter @sentinel) @container - -(compound_statement - "{" @delimiter - "}" @delimiter @sentinel) @container - -(subscript - "[" @delimiter - "]" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/c_sharp/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/c_sharp/rainbow-delimiters.scm deleted file mode 100644 index 87e2175b..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/c_sharp/rainbow-delimiters.scm +++ /dev/null @@ -1,143 +0,0 @@ -(parenthesized_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(argument_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parameter_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(if_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(foreach_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(for_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(while_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(do_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(tuple_type - "(" @delimiter - ")" @delimiter @sentinel) @container - -(tuple_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(attribute_argument_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(attribute_list - "[" @delimiter - "]" @delimiter @sentinel) @container - -(switch_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(switch_body - "{" @delimiter - "}" @delimiter @sentinel) @container - -(switch_expression - "{" @delimiter - "}" @delimiter @sentinel) @container - -(default_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(catch_declaration - "(" @delimiter - ")" @delimiter @sentinel) @container - -(catch_filter_clause - "(" @delimiter - ")" @delimiter @sentinel) @container - -(using_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(lock_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(cast_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(typeof_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(sizeof_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(checked_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(declaration_list - "{" @delimiter - "}" @delimiter @sentinel) @container - -(accessor_list - "{" @delimiter - "}" @delimiter @sentinel) @container - -(block - "{" @delimiter - "}" @delimiter @sentinel) @container - -(anonymous_object_creation_expression - "{" @delimiter - "}" @delimiter @sentinel) @container - -(enum_member_declaration_list - "{" @delimiter - "}" @delimiter @sentinel) @container - -(type_parameter_list - "<" @delimiter - ">" @delimiter @sentinel) @container - -(type_argument_list - "<" @delimiter - ">" @delimiter @sentinel) @container - -(initializer_expression - "{" @delimiter - "}" @delimiter @sentinel) @container - -(array_rank_specifier - "[" @delimiter - "]" @delimiter @sentinel) @container - -(bracketed_argument_list - "[" @delimiter - "]" @delimiter @sentinel) @container - -(implicit_array_creation_expression - "[" @delimiter - "]" @delimiter @sentinel) @container - -(implicit_stackalloc_expression - "[" @delimiter - "]" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/catppuccin-frappe.lua b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/catppuccin-frappe.lua deleted file mode 100644 index aafd00c3..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/catppuccin-frappe.lua +++ /dev/null @@ -1 +0,0 @@ -return require "catppuccin.utils.lualine" "frappe" diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/catppuccin-latte.lua b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/catppuccin-latte.lua deleted file mode 100644 index 2b11e17f..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/catppuccin-latte.lua +++ /dev/null @@ -1 +0,0 @@ -return require "catppuccin.utils.lualine" "latte" diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/catppuccin-macchiato.lua b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/catppuccin-macchiato.lua deleted file mode 100644 index c8102ca3..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/catppuccin-macchiato.lua +++ /dev/null @@ -1 +0,0 @@ -return require "catppuccin.utils.lualine" "macchiato" diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/catppuccin-mocha.lua b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/catppuccin-mocha.lua deleted file mode 100644 index d5b190cf..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/catppuccin-mocha.lua +++ /dev/null @@ -1 +0,0 @@ -return require "catppuccin.utils.lualine" "mocha" diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/catppuccin.lua b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/catppuccin.lua deleted file mode 100644 index 4e18b44c..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/catppuccin.lua +++ /dev/null @@ -1 +0,0 @@ -return require "catppuccin.utils.lualine"() diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/clojure/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/clojure/rainbow-delimiters.scm deleted file mode 100644 index a4b6a953..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/clojure/rainbow-delimiters.scm +++ /dev/null @@ -1,19 +0,0 @@ -(list_lit - "(" @delimiter - ")" @delimiter @sentinel) @container - -(vec_lit - "[" @delimiter - "]" @delimiter @sentinel) @container - -(map_lit - "{" @delimiter - "}" @delimiter @sentinel) @container - -(set_lit - "{" @delimiter - "}" @delimiter @sentinel) @container - -(anon_fn_lit - "(" @delimiter - ")" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/commonlisp/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/commonlisp/rainbow-delimiters.scm deleted file mode 100644 index 3b216d0d..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/commonlisp/rainbow-delimiters.scm +++ /dev/null @@ -1,13 +0,0 @@ -(list_lit - "(" @delimiter - _* - ")" @delimiter @sentinel) @container - -(defun - "(" @delimiter - _* - ")" @delimiter @sentinel) @container - -(loop_macro - "(" @delimiter - ")" @delimiter @sentinel ) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/cpp/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/cpp/rainbow-delimiters.scm deleted file mode 100644 index 81648921..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/cpp/rainbow-delimiters.scm +++ /dev/null @@ -1,61 +0,0 @@ -;;; NOTE: The C and C++ grammar have diverged, so I cannot include the C query. - -(parameter_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(argument_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(condition_clause - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parenthesized_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(compound_statement - "{" @delimiter - "}" @delimiter @sentinel) @container - -(for_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(cast_expression - "(" @delimiter - ")" @delimiter @sentinel) - -(initializer_list - "{" @delimiter - "}" @delimiter @sentinel) @container - -(array_declarator - "[" @delimiter - "]" @delimiter @sentinel) @container - -(subscript_argument_list - "[" @delimiter - "]" @delimiter @sentinel) @container - -(field_declaration_list - "{" @delimiter - "}" @delimiter @sentinel) @container - -(declaration_list - "{" @delimiter - "}" @delimiter @sentinel) @container - -(template_parameter_list - "<" @delimiter - ">" @delimiter @sentinel) @container - -(initializer_list - "{" @delimiter - "}" @delimiter @sentinel) @container - -(template_argument_list - "<" @delimiter - ">" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/css/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/css/rainbow-delimiters.scm deleted file mode 100644 index cef27cbe..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/css/rainbow-delimiters.scm +++ /dev/null @@ -1,19 +0,0 @@ -(block - "{" @delimiter - "}" @delimiter @sentinel) @container - -(parenthesized_query - "(" @delimiter - ")" @delimiter @sentinel) @container - -(feature_query - "(" @delimiter - ")" @delimiter @sentinel) @container - -(arguments - "(" @delimiter - ")" @delimiter @sentinel) @container - -(attribute_selector - "[" @delimiter - "]" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/cuda/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/cuda/rainbow-delimiters.scm deleted file mode 100644 index b910498c..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/cuda/rainbow-delimiters.scm +++ /dev/null @@ -1,5 +0,0 @@ -; inherits: cpp - -(kernel_call_syntax - "<<<" @delimiter - ">>>" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/cue/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/cue/rainbow-delimiters.scm deleted file mode 100644 index 17fd570e..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/cue/rainbow-delimiters.scm +++ /dev/null @@ -1,31 +0,0 @@ -(struct_lit - "{" @delimiter - "}" @delimiter @sentinel) @container - -(list_lit - "[" @delimiter - "]" @delimiter @sentinel) @container - -(label - "[" @delimiter - "]" @delimiter @sentinel) @container - -(arguments - "(" @delimiter - ")" @delimiter @sentinel) @container - -(attribute - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parenthesized_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(import_spec_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(interpolation - "\\(" @delimiter - ")" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/elixir/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/elixir/rainbow-delimiters.scm deleted file mode 100644 index 8e84fc9c..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/elixir/rainbow-delimiters.scm +++ /dev/null @@ -1,34 +0,0 @@ -(call - (arguments - "(" @delimiter - ")" @delimiter @sentinel) @container) - -(block - "(" @delimiter - ")" @delimiter @sentinel) @container - -(string - (interpolation - "#{" @delimiter - "}" @delimiter @sentinel) @container) - -(tuple - "{" @delimiter - "}" @delimiter @sentinel) @container - -(list - "[" @delimiter - "]" @delimiter @sentinel) @container - -(access_call - "[" @delimiter - "]" @delimiter @sentinel) @container - -(bitstring - "<<" @delimiter - ">>" @delimiter @sentinel) @container - -(map - "%" @delimiter - "{" @delimiter - "}" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/fish/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/fish/rainbow-delimiters.scm deleted file mode 100644 index c1b238ce..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/fish/rainbow-delimiters.scm +++ /dev/null @@ -1,15 +0,0 @@ -(command_substitution - "(" @delimiter - ")" @delimiter @sentinel) @container - -(concatenation - "[" @delimiter - "]" @delimiter @sentinel) @container - -(list_element_access - "[" @delimiter - "]" @delimiter @sentinel) @container - -(brace_expansion - "{" @delimiter - "}" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/go/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/go/rainbow-delimiters.scm deleted file mode 100644 index 9a4a575a..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/go/rainbow-delimiters.scm +++ /dev/null @@ -1,79 +0,0 @@ -(parenthesized_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(import_spec_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(var_declaration - "(" @delimiter - ")" @delimiter @sentinel) @container - -(const_declaration - "(" @delimiter - ")" @delimiter @sentinel) @container - -(type_assertion_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(field_declaration_list - "{" @delimiter - "}" @delimiter @sentinel) @container - -(argument_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parameter_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(block - "{" @delimiter - "}" @delimiter @sentinel) @container - -(expression_switch_statement - "{" @delimiter - "}" @delimiter @sentinel) @container - -(type_switch_statement - "{" @delimiter - "}" @delimiter @sentinel) @container - -(literal_value - "{" @delimiter - "}" @delimiter @sentinel) @container - -(array_type - "[" @delimiter - "]" @delimiter @sentinel) @container - -(slice_type - "[" @delimiter - "]" @delimiter @sentinel) @container - -(map_type - "[" @delimiter - "]" @delimiter @sentinel) @container - -(interface_type - "{" @delimiter - "}" @delimiter @sentinel) @container - -(type_parameter_list - "[" @delimiter - "]" @delimiter @sentinel) @container - -(type_arguments - "[" @delimiter - "]" @delimiter @sentinel) @container - -(index_expression - "[" @delimiter - "]" @delimiter @sentinel) @container - -(slice_expression - "[" @delimiter - "]" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/hcl/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/hcl/rainbow-delimiters.scm deleted file mode 100644 index 7693e4f6..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/hcl/rainbow-delimiters.scm +++ /dev/null @@ -1,47 +0,0 @@ -(tuple - (tuple_start "[") @delimiter - (tuple_end "]") @delimiter @sentinel) @container - -(for_tuple_expr - (tuple_start "[") @delimiter - (tuple_end "]") @delimiter @sentinel) @container - -(new_index - "[" @delimiter - "]" @delimiter @sentinel) @container - -(function_call - "(" @delimiter - ")" @delimiter @sentinel) @container - -(expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(binary_operation - "(" @delimiter - ")" @delimiter @sentinel) @container - -(unary_operation - "(" @delimiter - ")" @delimiter @sentinel) @container - -(block - (block_start "{") @delimiter - (block_end "}") @delimiter @sentinel) @container - -(object - (object_start "{") @delimiter - (object_end "}") @delimiter @sentinel) @container - -(for_object_expr - (object_start "{") @delimiter - (object_end "}") @delimiter @sentinel) @container - -(template_interpolation - (template_interpolation_start) @delimiter - (template_interpolation_end) @delimiter @sentinel) @container - -(_ - (template_directive_start) @delimiter - (template_directive_end) @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/html/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/html/rainbow-delimiters.scm deleted file mode 100644 index 24e63db6..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/html/rainbow-delimiters.scm +++ /dev/null @@ -1,69 +0,0 @@ -;;; A pair of delimiter tags with any content in-between. -;;; Last tag should be a sentinel. - -;;; If instead you want rainbow-delimiters to only highlight -;;; the tag names without any of "<", "" or "/>", then -;;; you can make your own query file, e.g., -;;; 'rainbow-tag-names' -;;; and use the following with -;;; x @delimiter -;;; deleted for x equal to any of "<", "" or "/>". - -(element - (start_tag - "<" @delimiter - (tag_name) @delimiter - ">" @delimiter) - (end_tag - "" @delimiter @sentinel)) @container - -(element - (self_closing_tag - "<" @delimiter - (tag_name) @delimiter - "/>" @delimiter @sentinel)) @container - -(element - (start_tag - "<" @delimiter - (tag_name) @delimiter @_tag_name - ">" @delimiter @sentinel) - (#any-of? @_tag_name - "area" - "base" - "br" - "col" - "embed" - "hr" - "img" - "input" - "link" - "meta" - "param" - "source" - "track" - "wbr") -) @container - -(style_element - (start_tag - "<" @delimiter - (tag_name) @delimiter - ">" @delimiter) - (element (self_closing_tag) @delimiter)* - (end_tag - "" @delimiter @sentinel)) @container - -(script_element - (start_tag - "<" @delimiter - (tag_name) @delimiter - ">" @delimiter) - (end_tag - "" @delimiter @sentinel)) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/janet_simple/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/janet_simple/rainbow-delimiters.scm deleted file mode 100644 index 02947931..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/janet_simple/rainbow-delimiters.scm +++ /dev/null @@ -1,23 +0,0 @@ -(par_tup_lit - "(" @delimiter - ")" @delimiter @sentinel) @container - -(par_arr_lit - "@(" @delimiter - ")" @delimiter @sentinel) @container - -(sqr_tup_lit - "[" @delimiter - "]" @delimiter @sentinel) @container - -(sqr_arr_lit - "@[" @delimiter - "]" @delimiter @sentinel) @container - -(struct_lit - "{" @delimiter - "}" @delimiter @sentinel) @container - -(tbl_lit - "@{" @delimiter - "}" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/java/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/java/rainbow-delimiters.scm deleted file mode 100644 index bca00206..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/java/rainbow-delimiters.scm +++ /dev/null @@ -1,70 +0,0 @@ -(class_body - "{" @delimiter - "}" @delimiter @sentinel) @container - -(block - "{" @delimiter - "}" @delimiter @sentinel) @container - -(array_initializer - "{" @delimiter - "}" @delimiter @sentinel) @container - -(formal_parameters - "(" @delimiter - ")" @delimiter @sentinel) @container - -(resource_specification - "(" @delimiter - ")" @delimiter @sentinel) @container - -(catch_clause - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parenthesized_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(cast_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(inferred_parameters - "(" @delimiter - ")" @delimiter @sentinel) @container - -(argument_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(annotation_argument_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(for_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(enhanced_for_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(constructor_body - "{" @delimiter - "}" @delimiter @sentinel) @container - -;; Treat it as a single delimiter because it will always have the same color -(dimensions) @container @delimiter @sentinel - -(dimensions_expr - "[" @delimiter - "]" @delimiter @sentinel) @container - -(array_access - "[" @delimiter - "]" @delimiter @sentinel) @container - -(type_arguments - "<" @delimiter - ">" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/javascript/rainbow-delimiters-react.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/javascript/rainbow-delimiters-react.scm deleted file mode 100644 index 229898a2..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/javascript/rainbow-delimiters-react.scm +++ /dev/null @@ -1,102 +0,0 @@ -;;; This query includes React support as well. - -;; String interpolation inside template strings -(template_substitution - "${" @delimiter - "}" @delimiter @sentinel) @container - -(object - "{" @delimiter - "}" @delimiter @sentinel) @container - -(statement_block - "{" @delimiter - "}" @delimiter @sentinel) @container - -(class_body - "{" @delimiter - "}" @delimiter @sentinel) @container - -(switch_body - "{" @delimiter - "}" @delimiter @sentinel) @container - -(arguments - "(" @delimiter - ")" @delimiter @sentinel) @container - -(formal_parameters - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parenthesized_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(for_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(for_in_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(subscript_expression - "[" @delimiter - "]" @delimiter @sentinel) @container - -(named_imports - "{" @delimiter - "}" @delimiter @sentinel) @container - -(export_clause - "{" @delimiter - "}" @delimiter @sentinel) @container - -(object_pattern - "{" @delimiter - "}" @delimiter @sentinel) @container - -(array - "[" @delimiter - "]" @delimiter @sentinel) @container - -(array_pattern - "[" @delimiter - "]" @delimiter @sentinel) @container - - -;;; React.js support -(jsx_element - open_tag: (jsx_opening_element - "<" @delimiter - name: (identifier) @delimiter - ">" @delimiter) - close_tag: (jsx_closing_element - "" @delimiter @sentinel)) @container - -(jsx_element - open_tag: (jsx_opening_element - "<" @delimiter - name: (member_expression) @delimiter - ">" @delimiter) - close_tag: (jsx_closing_element - "" @delimiter @sentinel)) @container - -(jsx_self_closing_element - "<" @delimiter - name: (identifier) @delimiter - "/>" @delimiter @sentinel) @container - -(jsx_self_closing_element - "<" @delimiter - name: (member_expression) @delimiter - "/>" @delimiter @sentinel) @container - -(jsx_expression - "{" @delimiter - "}" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/javascript/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/javascript/rainbow-delimiters.scm deleted file mode 100644 index 766a017b..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/javascript/rainbow-delimiters.scm +++ /dev/null @@ -1,68 +0,0 @@ -;;; This query only covers Javascript without any React support. It exists so -;;; that Typescript query can inherit it. - -;; String interpolation inside template strings -(template_substitution - "${" @delimiter - "}" @delimiter @sentinel) @container - -(object - "{" @delimiter - "}" @delimiter @sentinel) @container - -(statement_block - "{" @delimiter - "}" @delimiter @sentinel) @container - -(class_body - "{" @delimiter - "}" @delimiter @sentinel) @container - -(switch_body - "{" @delimiter - "}" @delimiter @sentinel) @container - -(arguments - "(" @delimiter - ")" @delimiter @sentinel) @container - -(formal_parameters - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parenthesized_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(for_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(for_in_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(subscript_expression - "[" @delimiter - "]" @delimiter @sentinel) @container - -(named_imports - "{" @delimiter - "}" @delimiter @sentinel) @container - -(export_clause - "{" @delimiter - "}" @delimiter @sentinel) @container - -(object_pattern - "{" @delimiter - "}" @delimiter @sentinel) @container - -(array - "[" @delimiter - "]" @delimiter @sentinel) @container - -(array_pattern - "[" @delimiter - "]" @delimiter @sentinel) @container - diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/javascript/rainbow-parens.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/javascript/rainbow-parens.scm deleted file mode 100644 index 766a017b..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/javascript/rainbow-parens.scm +++ /dev/null @@ -1,68 +0,0 @@ -;;; This query only covers Javascript without any React support. It exists so -;;; that Typescript query can inherit it. - -;; String interpolation inside template strings -(template_substitution - "${" @delimiter - "}" @delimiter @sentinel) @container - -(object - "{" @delimiter - "}" @delimiter @sentinel) @container - -(statement_block - "{" @delimiter - "}" @delimiter @sentinel) @container - -(class_body - "{" @delimiter - "}" @delimiter @sentinel) @container - -(switch_body - "{" @delimiter - "}" @delimiter @sentinel) @container - -(arguments - "(" @delimiter - ")" @delimiter @sentinel) @container - -(formal_parameters - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parenthesized_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(for_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(for_in_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(subscript_expression - "[" @delimiter - "]" @delimiter @sentinel) @container - -(named_imports - "{" @delimiter - "}" @delimiter @sentinel) @container - -(export_clause - "{" @delimiter - "}" @delimiter @sentinel) @container - -(object_pattern - "{" @delimiter - "}" @delimiter @sentinel) @container - -(array - "[" @delimiter - "]" @delimiter @sentinel) @container - -(array_pattern - "[" @delimiter - "]" @delimiter @sentinel) @container - diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/javascript/rainbow-tags-react.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/javascript/rainbow-tags-react.scm deleted file mode 100644 index a9c2fe81..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/javascript/rainbow-tags-react.scm +++ /dev/null @@ -1,29 +0,0 @@ -(jsx_element - open_tag: (jsx_opening_element - "<" @delimiter - name: (identifier) @delimiter - ">" @delimiter) - close_tag: (jsx_closing_element - "" @delimiter @sentinel)) @container - -(jsx_element - open_tag: (jsx_opening_element - "<" @delimiter - name: (member_expression) @delimiter - ">" @delimiter) - close_tag: (jsx_closing_element - "" @delimiter @sentinel)) @container - -(jsx_self_closing_element - "<" @delimiter - name: (identifier) @delimiter - "/>" @delimiter @sentinel) @container - -(jsx_self_closing_element - "<" @delimiter - name: (member_expression) @delimiter - "/>" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/json/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/json/rainbow-delimiters.scm deleted file mode 100644 index 8ff0d788..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/json/rainbow-delimiters.scm +++ /dev/null @@ -1,7 +0,0 @@ -(object - "{" @delimiter - "}" @delimiter @sentinel) @container - -(array - "[" @delimiter - "]" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/julia/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/julia/rainbow-delimiters.scm deleted file mode 100644 index e45fec43..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/julia/rainbow-delimiters.scm +++ /dev/null @@ -1,27 +0,0 @@ -(vector_expression - "[" @delimiter - "]" @delimiter @sentinel) @container - -(matrix_expression - "[" @delimiter - "]" @delimiter @sentinel) @container - -(argument_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parenthesized_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(comprehension_expression - "[" @delimiter - "]" @delimiter @sentinel) @container - -(tuple_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(curly_expression - "{" @delimiter - "}" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/kotlin/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/kotlin/rainbow-delimiters.scm deleted file mode 100644 index 7001e259..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/kotlin/rainbow-delimiters.scm +++ /dev/null @@ -1,55 +0,0 @@ -(class_body - "{" @delimiter - "}" @delimiter @sentinel) @container - -(function_body - "{" @delimiter - "}" @delimiter @sentinel) @container - -(control_structure_body - "{" @delimiter - "}" @delimiter @sentinel) @container - - -(lambda_literal - "{" @delimiter - "}" @delimiter @sentinel) @container - -(primary_constructor - "(" @delimiter - ")" @delimiter @sentinel) @container - -(function_value_parameters - "(" @delimiter - ")" @delimiter @sentinel) @container - -(value_arguments - "(" @delimiter - ")" @delimiter @sentinel) @container - -(multi_variable_declaration - "(" @delimiter - ")" @delimiter @sentinel) @container - -(for_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(when_expression - (when_subject - "(" @delimiter - ")" @delimiter)? - "{" @delimiter - "}" @delimiter @sentinel) @container - -(indexing_suffix - "[" @delimiter - "]" @delimiter @sentinel) @container - -(type_parameters - "<" @delimiter - ">" @delimiter @sentinel) @container - -(type_arguments - "<" @delimiter - ">" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/latex/rainbow-blocks.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/latex/rainbow-blocks.scm deleted file mode 100644 index ba71cd16..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/latex/rainbow-blocks.scm +++ /dev/null @@ -1,11 +0,0 @@ -(inline_formula - "$" @delimiter - "$" @delimiter @sentinel) @container - -(generic_environment - (begin) @delimiter - (end) @delimiter @sentinel) @container - -(math_environment - (begin) @delimiter - (end) @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/latex/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/latex/rainbow-delimiters.scm deleted file mode 100644 index 6189163e..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/latex/rainbow-delimiters.scm +++ /dev/null @@ -1,15 +0,0 @@ -(curly_group - "{" @delimiter - "}" @delimiter @sentinel) @container - -(curly_group_text - "{" @delimiter - "}" @delimiter @sentinel) @container - -(curly_group_text_list - "{" @delimiter - "}" @delimiter @sentinel) @container - -(inline_formula - "$" @delimiter - "$" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/lua/rainbow-blocks.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/lua/rainbow-blocks.scm deleted file mode 100644 index 5ac26c5c..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/lua/rainbow-blocks.scm +++ /dev/null @@ -1,69 +0,0 @@ -;;; Note: Some patterns are commented out because currently Neovim can capture -;;; only one node at a time. Once it becomes possible to capture multiple -;;; nodes they should be commented back in. - - -(function_declaration - "function" @delimiter - "end" @delimiter @sentinel) @container - -(function_definition - "function" @delimiter - "end" @delimiter @sentinel) @container - -(if_statement - "if" @delimiter - "then" @delimiter - (elseif_statement - "elseif" @delimiter - "then" @delimiter)* - (else_statement - "else" @delimiter)? - "end" @delimiter @sentinel) @container - -(while_statement - "while" @delimiter - "do" @delimiter - "end" @delimiter @sentinel) @container - -(repeat_statement - "repeat" @delimiter - "until" @delimiter @sentinel) @container - -(for_statement - "for" @delimiter - (for_generic_clause - "in" @delimiter)? - "do" @delimiter - "end" @delimiter @sentinel) @container - -(do_statement - "do" @delimiter - "end" @delimiter @sentinel) @container - - -;;; Copied over from rainbow-parens - -(arguments - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parameters - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parenthesized_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(table_constructor - "{" @delimiter - "}" @delimiter @sentinel) @container - -(bracket_index_expression - "[" @delimiter - "]" @delimiter @sentinel) @container - -(field - "[" @delimiter - "]" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/lua/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/lua/rainbow-delimiters.scm deleted file mode 100644 index bb2a046d..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/lua/rainbow-delimiters.scm +++ /dev/null @@ -1,23 +0,0 @@ -(arguments - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parameters - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parenthesized_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(table_constructor - "{" @delimiter - "}" @delimiter @sentinel) @container - -(bracket_index_expression - "[" @delimiter - "]" @delimiter @sentinel) @container - -(field - "[" @delimiter - "]" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/luadoc/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/luadoc/rainbow-delimiters.scm deleted file mode 100644 index e7cdb20f..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/luadoc/rainbow-delimiters.scm +++ /dev/null @@ -1,40 +0,0 @@ -(function_type - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parenthesized_type - "(" @delimiter - ")" @delimiter @sentinel) @container - -;;; I wanted to use something like -; (union_type -; "|" @delimiter @sentinel -; ) @container -;;; too, but it doesn't fully work with the current parser - -(array_type - "[" @delimiter - "]" @delimiter @sentinel) @container - -(table_type - "<" @delimiter - ">" @delimiter @sentinel) @container - -(table_literal_type - "{" @delimiter - "}" @delimiter @sentinel) @container - -(indexed_field - "[" @delimiter - "]" @delimiter @sentinel) @container - -(tuple_type - "(" @delimiter - ")" @delimiter @sentinel) @container - -(_ - "[" @delimiter - . - field: (_) - . - "]" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/make/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/make/rainbow-delimiters.scm deleted file mode 100644 index 4378129b..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/make/rainbow-delimiters.scm +++ /dev/null @@ -1 +0,0 @@ -;;; Nothing I can think of, everything gets taken from the injected bash query. diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/markdown/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/markdown/rainbow-delimiters.scm deleted file mode 100644 index 701e470b..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/markdown/rainbow-delimiters.scm +++ /dev/null @@ -1,3 +0,0 @@ -;;; Intentionally empty. Markdown can have other languages embedded and we -;;; want to let those grammars handle the highlighting. This query only exists -;;; to satisfy the requirements of this plugin. diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/nim/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/nim/rainbow-delimiters.scm deleted file mode 100644 index e98aba49..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/nim/rainbow-delimiters.scm +++ /dev/null @@ -1,47 +0,0 @@ -(array_construction - "[" @delimiter - "]" @delimiter @sentinel) @container -(tuple_construction - "(" @delimiter - ")" @delimiter @sentinel) @container -(tuple_deconstruct_declaration - "(" @delimiter - ")" @delimiter @sentinel) @container -(curly_construction - "{" @delimiter - ":"? @delimiter - "}" @delimiter @sentinel) @container - -(parenthesized - "(" @delimiter - ")" @delimiter @sentinel) @container - -(argument_list - "(" @delimiter - ")" @delimiter @sentinel) @container -(parameter_declaration_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(bracket_expression - "[" @delimiter - "]" @delimiter @sentinel) @container -(field_declaration_list - "[" @delimiter - "]" @delimiter @sentinel) @container -(generic_parameter_list - "[" @delimiter - "]" @delimiter @sentinel) @container - -(cast - "[" @delimiter - "]" @delimiter - "(" @delimiter - ")" @delimiter @sentinel) @container - -(term_rewriting_pattern - "{" @delimiter - "}" @delimiter @sentinel) @container -(curly_expression - "{" @delimiter - "}" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/nix/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/nix/rainbow-delimiters.scm deleted file mode 100644 index cb347941..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/nix/rainbow-delimiters.scm +++ /dev/null @@ -1,27 +0,0 @@ -(attrset_expression - ("{" @delimiter) - ("}" @delimiter @sentinel)) @container - -(rec_attrset_expression - ("{" @delimiter) - ("}" @delimiter @sentinel)) @container - -(formals - ("{" @delimiter) - ("}" @delimiter @sentinel)) @container - -(list_expression - ("[" @delimiter) - ("]" @delimiter @sentinel)) @container - -(parenthesized_expression - ("(" @delimiter) - (")" @delimiter @sentinel)) @container - -(interpolation - ("${" @delimiter) - ("}" @delimiter @sentinel)) @container - -(inherit_from - "(" @delimiter - ")" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/perl/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/perl/rainbow-delimiters.scm deleted file mode 100644 index eb532196..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/perl/rainbow-delimiters.scm +++ /dev/null @@ -1,86 +0,0 @@ -(argument - "(" @delimiter - ")" @delimiter @sentinel) @container - -(array - "(" @delimiter - ")" @delimiter @sentinel) @container - -(array_dereference - "{" @delimiter - "}" @delimiter @sentinel) @container - -(array_ref - "[" @delimiter - "]" @delimiter @sentinel) @container - -(array_ref - "(" @delimiter - ")" @delimiter @sentinel) @container - -(block - "{" @delimiter - "}" @delimiter @sentinel) @container - -(hash_access_variable - "->{" @delimiter - "}" @delimiter @sentinel) @container - -(hash_access_variable - "{" @delimiter - "}" @delimiter @sentinel) @container - -(hash_ref - "+" @delimiter - "{" @delimiter - "}" @delimiter @sentinel) @container - -(multi_var_declaration - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parenthesized_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(standalone_block - "{" @delimiter - "}" @delimiter @sentinel) @container - -(parenthesized_argument - "(" @delimiter - ")" @delimiter @sentinel) @container - -(list_block - "{" @delimiter - "}" @delimiter @sentinel) @container - -(word_list_qw - (start_delimiter_qw) @delimiter - (end_delimiter_qw) @delimiter @sentinel) @container - -(regex_pattern_qr - (start_delimiter) @delimiter - (end_delimiter) @delimiter @sentinel) @container - -(command_qx_quoted - (start_delimiter) @delimiter - (end_delimiter) @delimiter @sentinel) @container - -(string_qq_quoted - (start_delimiter) @delimiter - (end_delimiter) @delimiter @sentinel) @container - -(patter_matcher_m - (start_delimiter) @delimiter - (end_delimiter) @delimiter @sentinel) @container - -(substitution_pattern_s - (start_delimiter) @delimiter - (separator_delimiter) @delimiter - (end_delimiter) @delimiter @sentinel) @container - -(transliteration_tr_or_y - (start_delimiter) @delimiter - (separator_delimiter) @delimiter - (end_delimiter) @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/python/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/python/rainbow-delimiters.scm deleted file mode 100644 index dca135fb..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/python/rainbow-delimiters.scm +++ /dev/null @@ -1,75 +0,0 @@ -;; NOTE: When updating this file update the Starlark test file as well if -;; applicable. - -(list - "[" @delimiter - "]" @delimiter @sentinel) @container - -(list_pattern - "[" @delimiter - "]" @delimiter @sentinel) @container - -(list_comprehension - "[" @delimiter - "]" @delimiter @sentinel) @container - -(dictionary - "{" @delimiter - "}" @delimiter @sentinel) @container - -(dict_pattern - "{" @delimiter - "}" @delimiter @sentinel) @container - -(dictionary_comprehension - "{" @delimiter - "}" @delimiter @sentinel) @container - -(set - "{" @delimiter - "}" @delimiter @sentinel) @container - -(set_comprehension - "{" @delimiter - "}" @delimiter @sentinel) @container - -(tuple - "(" @delimiter - ")" @delimiter @sentinel) @container - -(tuple_pattern - "(" @delimiter - ")" @delimiter @sentinel) @container - -(generator_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parameters - "(" @delimiter - ")" @delimiter @sentinel) @container - -(argument_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parenthesized_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(subscript - "[" @delimiter - "]" @delimiter @sentinel) @container - -(type_parameter - "[" @delimiter - "]" @delimiter @sentinel) @container - -(import_from_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(string - (interpolation - "{" @delimiter - "}" @delimiter @sentinel) @container) diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/query/rainbow-blocks.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/query/rainbow-blocks.scm deleted file mode 100644 index 9c249729..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/query/rainbow-blocks.scm +++ /dev/null @@ -1,28 +0,0 @@ -;; Note: These queries are very useful when looking at a large -;; tree of queries like in `InspectTree` -(named_node - "(" @delimiter - (identifier) @delimiter - ")" @delimiter @sentinel) @container - -(grouping - "(" @delimiter - ")" @delimiter @sentinel) @container - -(list - "[" @delimiter - "]" @delimiter @sentinel) @container - -(predicate - "(" @delimiter - ")" @delimiter @sentinel) @container - -(field_definition - (identifier) @delimiter @sentinel) @container - -;; For more highlighting the following can be added too: -; (parameters -; (identifier) @delimiter @sentinel) @container -; -; (negated_field -; (identifier) @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/query/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/query/rainbow-delimiters.scm deleted file mode 100644 index fff8c317..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/query/rainbow-delimiters.scm +++ /dev/null @@ -1,15 +0,0 @@ -(named_node - "(" @delimiter - ")" @delimiter @sentinel) @container - -(grouping - "(" @delimiter - ")" @delimiter @sentinel) @container - -(list - "[" @delimiter - "]" @delimiter @sentinel) @container - -(predicate - "(" @delimiter - ")" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/r/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/r/rainbow-delimiters.scm deleted file mode 100644 index f76b3ac3..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/r/rainbow-delimiters.scm +++ /dev/null @@ -1,36 +0,0 @@ -(call - "(" @delimiter - ")" @delimiter @sentinel) @container - -(subset - "[" @delimiter - "]" @delimiter @sentinel) @container - -(subset2 - "[[" @delimiter - "]]" @delimiter @sentinel) @container - -(if - "(" @delimiter - ")" @delimiter @sentinel) @container - -(for - "(" @delimiter - ")" @delimiter @sentinel) @container - -(while - "(" @delimiter - ")" @delimiter @sentinel) @container - -(switch - "(" @delimiter - ")" @delimiter @sentinel) @container - -(function_definition - (formal_parameters - "(" @delimiter - ")" @delimiter @sentinel)) @container - -(brace_list - "{" @delimiter - "}" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/rasi/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/rasi/rainbow-delimiters.scm deleted file mode 100644 index 2295469c..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/rasi/rainbow-delimiters.scm +++ /dev/null @@ -1,52 +0,0 @@ -(block - "{" @delimiter - "}" @delimiter @sentinel) @container - -(environ_value - "$" @delimiter - "{" @delimiter - "}" @delimiter @sentinel) @container - -(environ_value - "(" @delimiter - ")" @delimiter @sentinel) @container - -(list_value - "[" @delimiter - "]" @delimiter @sentinel) @container - -(distance_calc - "(" @delimiter - ")" @delimiter @sentinel) @container - -(feature_query - "(" @delimiter - ")" @delimiter @sentinel) @container - -(reference_value - "(" @delimiter - ")" @delimiter @sentinel) @container - -(rgb_color - "(" @delimiter - ")" @delimiter @sentinel) @container - -(hsl_color - "(" @delimiter - ")" @delimiter @sentinel) @container - -(hwb_color - "(" @delimiter - ")" @delimiter @sentinel) @container - -(cmyk_color - "(" @delimiter - ")" @delimiter @sentinel) @container - -(url_image - "(" @delimiter - ")" @delimiter @sentinel) @container - -(gradient_image - "(" @delimiter - ")" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/regex/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/regex/rainbow-delimiters.scm deleted file mode 100644 index 9d117932..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/regex/rainbow-delimiters.scm +++ /dev/null @@ -1,17 +0,0 @@ -(anonymous_capturing_group - "(" @delimiter - ")" @delimiter @sentinel) @container - -;;; The inversion `^` should be an opening node as well -(character_class - "[" @delimiter - "]" @delimiter @sentinel) @container - -(count_quantifier - "{" @delimiter - "}" @delimiter @sentinel) @container - -;;; We should probably include the character after `?` like `=` as well -(lookaround_assertion - "(?" @delimiter - ")" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/rst/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/rst/rainbow-delimiters.scm deleted file mode 100644 index 5da7b9e5..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/rst/rainbow-delimiters.scm +++ /dev/null @@ -1,3 +0,0 @@ -;;; Intentionally empty. ReStructuredText can have other languages embedded -;;; and we want to let those grammars handle the highlighting. This query only -;;; exists to satisfy the requirements of this plugin. diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/ruby/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/ruby/rainbow-delimiters.scm deleted file mode 100644 index 48b1a664..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/ruby/rainbow-delimiters.scm +++ /dev/null @@ -1,19 +0,0 @@ -(block - "{" @delimiter - "}" @delimiter @sentinel) @container - -(hash - "{" @delimiter - "}" @delimiter @sentinel) @container - -(array - "[" @delimiter - "]" @delimiter @sentinel) @container - -(parenthesized_statements - "(" @delimiter - ")" @delimiter @sentinel) @container - -(block_parameters - "|" @delimiter - "|" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/rust/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/rust/rainbow-delimiters.scm deleted file mode 100644 index b42420c9..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/rust/rainbow-delimiters.scm +++ /dev/null @@ -1,133 +0,0 @@ -(parenthesized_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(declaration_list - "{" @delimiter - "}" @delimiter @sentinel) @container - -(field_declaration_list - "{" @delimiter - "}" @delimiter @sentinel) @container - -(ordered_field_declaration_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(enum_variant_list - "{" @delimiter - "}" @delimiter @sentinel) @container - -(use_list - "{" @delimiter - "}" @delimiter @sentinel) @container - -(field_initializer_list - "{" @delimiter - "}" @delimiter @sentinel) @container - -(parameters - "(" @delimiter - ")" @delimiter @sentinel) @container - -(arguments - "(" @delimiter - ")" @delimiter @sentinel) @container - -(block - "{" @delimiter - "}" @delimiter @sentinel) @container - -(match_block - "{" @delimiter - "}" @delimiter @sentinel) @container - -(tuple_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(tuple_type - "(" @delimiter - ")" @delimiter @sentinel) @container - -(token_tree - "{" @delimiter - "}" @delimiter @sentinel) @container - -(token_tree - "(" @delimiter - ")" @delimiter @sentinel) @container - -(token_tree - "[" @delimiter - "]" @delimiter @sentinel) @container - -(token_tree_pattern - "(" @delimiter - ")" @delimiter @sentinel) @container - -(token_repetition_pattern - "$" @delimiter - "(" @delimiter - ")" @delimiter @sentinel) @container - -(token_repetition - "$" @delimiter - "(" @delimiter - ")" @delimiter @sentinel) @container - -(attribute_item - "[" @delimiter - "]" @delimiter @sentinel) @container - -(inner_attribute_item - "[" @delimiter - "]" @delimiter @sentinel) @container - -(type_arguments - "<" @delimiter - ">" @delimiter @sentinel) @container - -(type_parameters - "<" @delimiter - ">" @delimiter @sentinel) @container - -(closure_parameters - "|" @delimiter - "|" @delimiter @sentinel) @container - -(array_expression - "[" @delimiter - "]" @delimiter @sentinel) @container - -(array_type - "[" @delimiter - "]" @delimiter @sentinel) @container - -(index_expression - "[" @delimiter - "]" @delimiter @sentinel) @container - -(tuple_struct_pattern - "(" @delimiter - ")" @delimiter @sentinel) @container - -(tuple_pattern - "(" @delimiter - ")" @delimiter @sentinel) @container - -(struct_pattern - "{" @delimiter - "}" @delimiter @sentinel) @container - -(slice_pattern - "[" @delimiter - "]" @delimiter @sentinel) @container - -(macro_definition - "{" @delimiter - "}" @delimiter @sentinel) @container - -(visibility_modifier - "(" @delimiter - ")" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/scheme/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/scheme/rainbow-delimiters.scm deleted file mode 100644 index 41bbada2..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/scheme/rainbow-delimiters.scm +++ /dev/null @@ -1,7 +0,0 @@ -(list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(list - "[" @delimiter - "]" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/scss/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/scss/rainbow-delimiters.scm deleted file mode 100644 index af30cd70..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/scss/rainbow-delimiters.scm +++ /dev/null @@ -1,5 +0,0 @@ -; inherits: css - -(parameters - "(" @delimiter - ")" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/sql/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/sql/rainbow-delimiters.scm deleted file mode 100644 index e6c8e03e..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/sql/rainbow-delimiters.scm +++ /dev/null @@ -1,28 +0,0 @@ -(subquery - "(" @delimiter - ")" @delimiter @sentinel) @container - -(invocation - "(" @delimiter - ")" @delimiter @sentinel) @container - -(list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(where - "(" @delimiter - ")" @delimiter @sentinel) @container - -(binary_expression - "(" @delimiter - ")" @delimiter @sentinel - ) @container - -; The following can cause problems with (((()))) -(term - "(" @delimiter - ; ("(" ")")* ; to fix _some_ problems, this can be uncommented - ")" @delimiter @sentinel - ) @container - diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/starlark/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/starlark/rainbow-delimiters.scm deleted file mode 100644 index 2f28ba57..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/starlark/rainbow-delimiters.scm +++ /dev/null @@ -1,56 +0,0 @@ -;; This is mostly identical to Python, without `generator_expression`. -;; NOTE: if you update queries for Python, please consider adding the changes -;; to this file as well, given that the tree-sitter's node types exist. See -;; https://github.com/amaanq/tree-sitter-starlark/blob/master/src/node-types.json - -(list - "[" @delimiter - "]" @delimiter @sentinel) @container - -(list_comprehension - "[" @delimiter - "]" @delimiter @sentinel) @container - -(dictionary - "{" @delimiter - "}" @delimiter @sentinel) @container - -(dictionary_comprehension - "{" @delimiter - "}" @delimiter @sentinel) @container - -(set - "{" @delimiter - "}" @delimiter @sentinel) @container - -(set_comprehension - "{" @delimiter - "}" @delimiter @sentinel) @container - -(tuple - "(" @delimiter - ")" @delimiter @sentinel) @container - -(tuple_pattern - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parameters - "(" @delimiter - ")" @delimiter @sentinel) @container - -(argument_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parenthesized_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(subscript - "[" @delimiter - "]" @delimiter @sentinel) @container - -(type_parameter - "[" @delimiter - "]" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/svelte/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/svelte/rainbow-delimiters.scm deleted file mode 100644 index 0d483a5c..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/svelte/rainbow-delimiters.scm +++ /dev/null @@ -1,35 +0,0 @@ -(script_element - (start_tag - "<" @delimiter - (tag_name) @delimiter - ">" @delimiter) - (end_tag - "" @delimiter @sentinel)) @container - -(style_element - (start_tag - "<" @delimiter - (tag_name) @delimiter - ">" @delimiter) - (end_tag - "" @delimiter @sentinel)) @container - -(element - (self_closing_tag - "<" @delimiter - (tag_name) @delimiter - "/>" @delimiter @sentinel)) @container - -(element - (start_tag - "<" @delimiter - (tag_name) @delimiter - ">" @delimiter) - (end_tag - "" @delimiter @sentinel)) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/svelte/rainbow-delimiters.txt b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/svelte/rainbow-delimiters.txt deleted file mode 100644 index 38e926b1..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/svelte/rainbow-delimiters.txt +++ /dev/null @@ -1,53 +0,0 @@ -(script_element - (start_tag - "<" @delimiter - (tag_name) @delimiter - ">" @delimiter) - (end_tag - "" @delimiter @sentinel)) @container - -(style_element - (start_tag - "<" @delimiter - (tag_name) @delimiter - ">" @delimiter) - (end_tag - "" @delimiter @sentinel)) @container - -(element - (self_closing_tag - "<" @delimiter - (tag_name) @delimiter - "/>" @delimiter @sentinel)) @container - -(element - (start_tag - "<" @delimiter - (tag_name) @delimiter - ">" @delimiter) - (end_tag - "" @delimiter @sentinel)) @container - -(const_expr - "{" @delimiter - "@" @delimiter - (special_block_keyword) @delimiter - "}" @delimiter @sentinel) @container - -(each_statement - (each_start_expr - "{" @delimiter - "#" @delimiter - (special_block_keyword) @delimiter - "}" @delimiter) @container - (each_end_expr - "{" @delimiter - "/" @delimiter - (special_block_keyword) @delimiter - "}" @delimiter @sentinel)) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/teal/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/teal/rainbow-delimiters.scm deleted file mode 100644 index a8a0967d..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/teal/rainbow-delimiters.scm +++ /dev/null @@ -1,19 +0,0 @@ -(arguments - "(" @delimiter - ")" @delimiter @sentinel) @container - -(table_constructor - "{" @delimiter - "}" @delimiter @sentinel) @container - -(table_entry - "[" @delimiter - "]" @delimiter @sentinel) @container - -(index - "[" @delimiter - "]" @delimiter @sentinel) @container - -(field - "[" @delimiter - "]" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/templ/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/templ/rainbow-delimiters.scm deleted file mode 100644 index a28443e3..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/templ/rainbow-delimiters.scm +++ /dev/null @@ -1,61 +0,0 @@ -; inherits: go - -;; HTML elements - -(element - (tag_start - "<" @delimiter - (element_identifier) @delimiter - ">" @delimiter) - (tag_end - "" @delimiter @sentinel)) @container - -(element - (self_closing_tag - "<" @delimiter - (element_identifier) @delimiter - "/>" @delimiter @sentinel)) @container - -(style_element - ("<" @delimiter - "style" @delimiter - ">" @delimiter) - ("" @delimiter @sentinel)) @container - -(script_element - ("<" @delimiter - "script" @delimiter - ">" @delimiter) - ("" @delimiter @sentinel)) @container - -;; Brackets - -(component_block - "{" @delimiter - "}" @delimiter @sentinel) @container - -(script_block - "{" @delimiter - "}" @delimiter @sentinel) @container - -(css_declaration - "{" @delimiter - "}" @delimiter @sentinel) @container - -(component_switch_statement - "{" @delimiter - "}" @delimiter @sentinel) @container - -(component_children_expression - "{" @delimiter - "}" @delimiter @sentinel) @container - -(expression - "{" @delimiter - "}" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/toml/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/toml/rainbow-delimiters.scm deleted file mode 100644 index 46170e6c..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/toml/rainbow-delimiters.scm +++ /dev/null @@ -1,15 +0,0 @@ -(table - "[" @delimiter - "]" @delimiter @sentinel) @container - -(array - "[" @delimiter - "]" @delimiter @sentinel) @container - -(inline_table - "{" @delimiter - "}" @delimiter @sentinel) @container - -(table_array_element - "[[" @delimiter - "]]" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/typescript/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/typescript/rainbow-delimiters.scm deleted file mode 100644 index 9818cb7e..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/typescript/rainbow-delimiters.scm +++ /dev/null @@ -1,25 +0,0 @@ -; inherits: javascript - -(interface_body - "{" @delimiter - "}" @delimiter @sentinel) @container - -(enum_body - "{" @delimiter - "}" @delimiter @sentinel) @container - -(type_arguments - "<" @delimiter - ">" @delimiter @sentinel) @container - -(type_parameters - "<" @delimiter - ">" @delimiter @sentinel) @container - -(lookup_type - "[" @delimiter - "]" @delimiter @sentinel) @container - -(object_type - "{" @delimiter - "}" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/typescript/rainbow-parens.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/typescript/rainbow-parens.scm deleted file mode 100644 index 9818cb7e..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/typescript/rainbow-parens.scm +++ /dev/null @@ -1,25 +0,0 @@ -; inherits: javascript - -(interface_body - "{" @delimiter - "}" @delimiter @sentinel) @container - -(enum_body - "{" @delimiter - "}" @delimiter @sentinel) @container - -(type_arguments - "<" @delimiter - ">" @delimiter @sentinel) @container - -(type_parameters - "<" @delimiter - ">" @delimiter @sentinel) @container - -(lookup_type - "[" @delimiter - "]" @delimiter @sentinel) @container - -(object_type - "{" @delimiter - "}" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/verilog/rainbow-blocks.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/verilog/rainbow-blocks.scm deleted file mode 100644 index e14b56cf..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/verilog/rainbow-blocks.scm +++ /dev/null @@ -1,83 +0,0 @@ -; match blocks - -(seq_block - "begin" @delimiter - "end" @delimiter @sentinel) @container - -; match parentheses - -(packed_dimension - "[" @delimiter - "]" @delimiter @sentinel) @container - -(data_type - "{" @delimiter - "}" @delimiter @sentinel) @container - -(parameter_port_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(named_port_connection - "(" @delimiter - ")" @delimiter @sentinel) @container - -(list_of_port_declarations - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parameter_value_assignment - "(" @delimiter - ")" @delimiter @sentinel) @container - -(named_parameter_assignment - "(" @delimiter - ")" @delimiter @sentinel) @container - -(hierarchical_instance - "(" @delimiter - ")" @delimiter @sentinel) @container - -(cast - "(" @delimiter - ")" @delimiter @sentinel) @container - -(conditional_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(event_control - "(" @delimiter - ")" @delimiter @sentinel) @container - -(primary - "(" @delimiter - ")" @delimiter @sentinel) @container - -(constant_primary - "(" @delimiter - ")" @delimiter @sentinel) @container - -(concatenation - "{" @delimiter - "}" @delimiter @sentinel) @container - -(constant_concatenation - "{" @delimiter - "}" @delimiter @sentinel) @container - -(multiple_concatenation - "{" @delimiter - "}" @delimiter @sentinel) @container - -(constant_select1 - "[" @delimiter - "]" @delimiter @sentinel) @container - -(bit_select1 - "[" @delimiter - "]" @delimiter @sentinel) @container - -(select1 - "[" @delimiter - "]" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/verilog/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/verilog/rainbow-delimiters.scm deleted file mode 100644 index 3743925c..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/verilog/rainbow-delimiters.scm +++ /dev/null @@ -1,75 +0,0 @@ -(packed_dimension - "[" @delimiter - "]" @delimiter @sentinel) @container - -(data_type - "{" @delimiter - "}" @delimiter @sentinel) @container - -(parameter_port_list - "(" @delimiter - ")" @delimiter @sentinel) @container - -(named_port_connection - "(" @delimiter - ")" @delimiter @sentinel) @container - -(list_of_port_declarations - "(" @delimiter - ")" @delimiter @sentinel) @container - -(parameter_value_assignment - "(" @delimiter - ")" @delimiter @sentinel) @container - -(named_parameter_assignment - "(" @delimiter - ")" @delimiter @sentinel) @container - -(hierarchical_instance - "(" @delimiter - ")" @delimiter @sentinel) @container - -(cast - "(" @delimiter - ")" @delimiter @sentinel) @container - -(conditional_statement - "(" @delimiter - ")" @delimiter @sentinel) @container - -(event_control - "(" @delimiter - ")" @delimiter @sentinel) @container - -(primary - "(" @delimiter - ")" @delimiter @sentinel) @container - -(constant_primary - "(" @delimiter - ")" @delimiter @sentinel) @container - -(concatenation - "{" @delimiter - "}" @delimiter @sentinel) @container - -(constant_concatenation - "{" @delimiter - "}" @delimiter @sentinel) @container - -(multiple_concatenation - "{" @delimiter - "}" @delimiter @sentinel) @container - -(constant_select1 - "[" @delimiter - "]" @delimiter @sentinel) @container - -(bit_select1 - "[" @delimiter - "]" @delimiter @sentinel) @container - -(select1 - "[" @delimiter - "]" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/vim/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/vim/rainbow-delimiters.scm deleted file mode 100644 index f606d228..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/vim/rainbow-delimiters.scm +++ /dev/null @@ -1,29 +0,0 @@ -;;; Note: The Vim grammar places all parentheses on the same level. This means -;;; an expression like (((3))) does not have three levels of nesting, but only -;;; one. All the parentheses and the integer literal are on the same level. -;;; This makes it impossible to apply alternating highlights. -(list - "[" @delimiter - "]" @delimiter @sentinel) @container - -(dictionnary ;; this is no typo, "dictionary" is misspelled in the parser - "{" @delimiter - (dictionnary_entry - ":" @delimiter) - "}" @delimiter @sentinel) @container - -(call_expression - "(" @delimiter - ")" @delimiter @sentinel) @container - -(unary_operation - "(" @delimiter - ")" @delimiter @sentinel) @container - -(binary_operation - "(" @delimiter - ")" @delimiter @sentinel) @container - -(ternary_expression - "(" @delimiter - ")" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/vimdoc/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/vimdoc/rainbow-delimiters.scm deleted file mode 100644 index d53527c8..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/vimdoc/rainbow-delimiters.scm +++ /dev/null @@ -1,3 +0,0 @@ -;;; Intentionally empty. Vim help files can have other languages embedded and -;;; we want to let those grammars handle the highlighting. This query only -;;; exists to satisfy the requirements of this plugin. diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/vue/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/vue/rainbow-delimiters.scm deleted file mode 100644 index fb7bb619..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/vue/rainbow-delimiters.scm +++ /dev/null @@ -1,52 +0,0 @@ -;;; A Vue file is made up of top-level tags which contain code written in other -;;; languages - -(element - (start_tag - "<" @delimiter - (tag_name) @delimiter - ">" @delimiter) - (end_tag - "" @delimiter @sentinel)) @container - -(element - (self_closing_tag - "<" @delimiter - (tag_name) @delimiter - "/>" @delimiter @sentinel)) @container - -(template_element - (start_tag - "<" @delimiter - (tag_name) @delimiter - ">" @delimiter) - (end_tag - "" @delimiter @sentinel)) @container - -(script_element - (start_tag - "<" @delimiter - (tag_name) @delimiter - ">" @delimiter) - (end_tag - "" @delimiter @sentinel)) @container - -(style_element - (start_tag - "<" @delimiter - (tag_name) @delimiter - ">" @delimiter) - (end_tag - "" @delimiter @sentinel)) @container - -(interpolation - "{{" @delimiter - "}}" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/xml/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/xml/rainbow-delimiters.scm deleted file mode 100644 index fbe7b0a7..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/xml/rainbow-delimiters.scm +++ /dev/null @@ -1,15 +0,0 @@ -(element - (STag - "<" @delimiter - (Name) @delimiter - ">" @delimiter) - (ETag - "" @delimiter @sentinel))@container - -(element - (EmptyElemTag - "<" @delimiter - (Name) @delimiter - "/>" @delimiter @sentinel)) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/yaml/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/yaml/rainbow-delimiters.scm deleted file mode 100644 index 5d70a3e4..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/yaml/rainbow-delimiters.scm +++ /dev/null @@ -1,7 +0,0 @@ -(flow_mapping - "{" @delimiter - "}" @delimiter @sentinel) @container - -(flow_sequence - "[" @delimiter - "]" @delimiter @sentinel) @container diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-frappe-cursor.lua b/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-frappe-cursor.lua deleted file mode 100644 index 3cbc8c67..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-frappe-cursor.lua +++ /dev/null @@ -1,4 +0,0 @@ -local palette = require("catppuccin.palettes").get_palette "frappe" -local presets = require "catppuccin.utils.reactive" - -return presets.cursor("catppuccin-frappe-cursor", palette) diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-frappe-cursorline.lua b/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-frappe-cursorline.lua deleted file mode 100644 index 4e8a1b44..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-frappe-cursorline.lua +++ /dev/null @@ -1,78 +0,0 @@ -local darken = require("catppuccin.utils.colors").darken -local palette = require("catppuccin.palettes").get_palette "frappe" - -return { - name = "catppuccin-frappe-cursorline", - static = { - winhl = { - inactive = { - CursorLine = { bg = darken(palette.surface0, 0.85) }, - CursorLineNr = { bg = darken(palette.surface0, 0.85) }, - }, - }, - }, - modes = { - i = { - winhl = { - CursorLine = { bg = darken(palette.sky, 0.4) }, - CursorLineNr = { bg = darken(palette.sky, 0.4) }, - }, - }, - n = { - winhl = { - CursorLine = { bg = palette.surface0 }, - CursorLineNr = { bg = palette.surface0 }, - }, - }, - no = { - operators = { - [{ "gu", "gU", "g~", "~" }] = { - winhl = { - CursorLine = { bg = palette.surface2 }, - CursorLineNr = { bg = palette.surface2 }, - }, - }, - -- delete operator - d = { - winhl = { - CursorLine = { bg = darken(palette.red, 0.4) }, - CursorLineNr = { bg = darken(palette.red, 0.4) }, - }, - }, - -- yank operator - y = { - winhl = { - CursorLine = { bg = darken(palette.peach, 0.4) }, - CursorLineNr = { bg = darken(palette.peach, 0.4) }, - }, - }, - -- change operator - c = { - winhl = { - CursorLine = { bg = darken(palette.blue, 0.5) }, - CursorLineNr = { bg = darken(palette.blue, 0.5) }, - }, - }, - }, - }, - -- replace mode - R = { - winhl = { - CursorLine = { bg = darken(palette.sapphire, 0.5) }, - CursorLineNr = { bg = darken(palette.sapphire, 0.5) }, - }, - }, - -- visual mode - [{ "v", "V", "\x16" }] = { - winhl = { - Visual = { bg = darken(palette.mauve, 0.4) }, - }, - }, - -- select mode - [{ "s", "S", "\x13" }] = { - winhl = { - Visual = { bg = darken(palette.pink, 0.4) }, - }, - }, - }, -} diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-latte-cursor.lua b/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-latte-cursor.lua deleted file mode 100644 index 3c9a660e..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-latte-cursor.lua +++ /dev/null @@ -1,8 +0,0 @@ -local palette = require("catppuccin.palettes").get_palette "latte" -local presets = require "catppuccin.utils.reactive" - -local preset = presets.cursor("catppuccin-latte-cursor", palette) - -preset.modes.R.hl.ReactiveCursor = { bg = palette.flamingo } - -return preset diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-latte-cursorline.lua b/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-latte-cursorline.lua deleted file mode 100644 index 77e647bf..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-latte-cursorline.lua +++ /dev/null @@ -1,77 +0,0 @@ -local lighten = require("catppuccin.utils.colors").lighten -local palette = require("catppuccin.palettes").get_palette "latte" - -return { - name = "catppuccin-latte-cursorline", - static = { - winhl = { - inactive = { - CursorLine = { bg = lighten(palette.surface0, 0.5) }, - CursorLineNr = { bg = lighten(palette.surface0, 0.5) }, - }, - }, - }, - modes = { - i = { - winhl = { - CursorLine = { bg = lighten(palette.teal, 0.4) }, - CursorLineNr = { bg = lighten(palette.teal, 0.4) }, - }, - }, - n = { - winhl = { - CursorLine = { bg = palette.surface0 }, - CursorLineNr = { bg = palette.surface0 }, - }, - }, - no = { - operators = { - [{ "gu", "gU", "g~", "~" }] = { - winhl = { - CursorLine = { bg = palette.surface2 }, - CursorLineNr = { bg = palette.surface2 }, - }, - }, - -- delete operator - d = { - winhl = { - CursorLine = { bg = lighten(palette.red, 0.3) }, - CursorLineNr = { bg = lighten(palette.red, 0.3) }, - }, - }, - -- yank operator - y = { - winhl = { - CursorLine = { bg = lighten(palette.peach, 0.3) }, - CursorLineNr = { bg = lighten(palette.peach, 0.3) }, - }, - }, - -- change operator - c = { - winhl = { - CursorLine = { bg = lighten(palette.blue, 0.3) }, - CursorLineNr = { bg = lighten(palette.blue, 0.3) }, - }, - }, - }, - }, - -- visual - [{ "v", "V", "\x16" }] = { - winhl = { - Visual = { bg = lighten(palette.mauve, 0.3) }, - }, - }, - -- select - [{ "s", "S", "\x13" }] = { - winhl = { - Visual = { bg = lighten(palette.pink, 0.3) }, - }, - }, - R = { - winhl = { - CursorLine = { bg = lighten(palette.flamingo, 0.2) }, - CursorLineNr = { bg = lighten(palette.flamingo, 0.2) }, - }, - }, - }, -} diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-macchiato-cursor.lua b/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-macchiato-cursor.lua deleted file mode 100644 index 73d3b3a1..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-macchiato-cursor.lua +++ /dev/null @@ -1,4 +0,0 @@ -local palette = require("catppuccin.palettes").get_palette "macchiato" -local presets = require "catppuccin.utils.reactive" - -return presets.cursor("catppuccin-macchiato-cursor", palette) diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-macchiato-cursorline.lua b/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-macchiato-cursorline.lua deleted file mode 100644 index a38c3fd1..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-macchiato-cursorline.lua +++ /dev/null @@ -1,10 +0,0 @@ -local palette = require("catppuccin.palettes").get_palette "macchiato" -local presets = require "catppuccin.utils.reactive" -local darken = require("catppuccin.utils.colors").darken - -local preset = presets.cursorline("catppuccin-macchiato-cursorline", palette) - -preset.static.winhl.inactive.CursorLine = { bg = darken(palette.surface0, 0.8) } -preset.static.winhl.inactive.CursorLineNr = { bg = darken(palette.surface0, 0.8) } - -return preset diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-mocha-cursor.lua b/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-mocha-cursor.lua deleted file mode 100644 index c4e47939..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-mocha-cursor.lua +++ /dev/null @@ -1,4 +0,0 @@ -local palette = require("catppuccin.palettes").get_palette "mocha" -local presets = require "catppuccin.utils.reactive" - -return presets.cursor("catppuccin-mocha-cursor", palette) diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-mocha-cursorline.lua b/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-mocha-cursorline.lua deleted file mode 100644 index d511dc9f..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/examples/reactive/presets/catppuccin-mocha-cursorline.lua +++ /dev/null @@ -1,4 +0,0 @@ -local palette = require("catppuccin.palettes").get_palette "mocha" -local presets = require "catppuccin.utils.reactive" - -return presets.cursorline("catppuccin-mocha-cursorline", palette) diff --git a/config/neovim/store/lazy-plugins/promise-async/themes/catppuccin.vim b/config/neovim/store/lazy-plugins/promise-async/themes/catppuccin.vim deleted file mode 100644 index 16efd509..00000000 --- a/config/neovim/store/lazy-plugins/promise-async/themes/catppuccin.vim +++ /dev/null @@ -1,20 +0,0 @@ -let s:c = has("nvim") == 1 ? luaeval('require("catppuccin.palettes").get_palette()') : luaeval('vim.dict(require("catppuccin.palettes").get_palette())') - -let s:p = {} - -let s:p.display = { 'guibg': s:c.mantle } - -let s:p.input = s:p.display -let s:p.indicator = { 'guifg': s:c.subtext1, 'guibg': s:c.mantle } -let s:p.spinner = { 'guifg': s:c.yellow, 'guibg': s:c.mantle, 'gui': "bold" } -let s:p.search_text = { 'guifg': s:c.text, 'guibg': s:c.mantle, 'gui': "bold" } - -let s:p.preview = { 'guibg': s:c.base } - -let s:p.selected = { 'guifg': s:c.sapphire, 'gui': "bold,underline" } -let s:p.current_selection = { 'guibg': s:c.surface0, 'gui': "bold" } - -let s:p.selected_sign = { 'guifg': s:c.red } -let s:p.current_selection_sign = copy(s:p.selected_sign) - -let g:clap#themes#catppuccin#palette = s:p diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/doc/tags b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/doc/tags new file mode 100644 index 00000000..f6b0e8a1 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/doc/tags @@ -0,0 +1,33 @@ +g:rainbow_delimiters rainbow-delimiters.txt /*g:rainbow_delimiters* +g:rainbow_delimiters#strategy rainbow-delimiters.txt /*g:rainbow_delimiters#strategy* +rainbow-delimiters rainbow-delimiters.txt /*rainbow-delimiters* +rainbow-delimiters#hlgroup_at rainbow-delimiters.txt /*rainbow-delimiters#hlgroup_at* +rainbow-delimiters.setup rainbow-delimiters.txt /*rainbow-delimiters.setup* +rainbow-delimiters.txt rainbow-delimiters.txt /*rainbow-delimiters.txt* +rb-delimiters rainbow-delimiters.txt /*rb-delimiters* +rb-delimiters-api rainbow-delimiters.txt /*rb-delimiters-api* +rb-delimiters-colors rainbow-delimiters.txt /*rb-delimiters-colors* +rb-delimiters-contents rainbow-delimiters.txt /*rb-delimiters-contents* +rb-delimiters-credit rainbow-delimiters.txt /*rb-delimiters-credit* +rb-delimiters-custom-lang rainbow-delimiters.txt /*rb-delimiters-custom-lang* +rb-delimiters-custom-query rainbow-delimiters.txt /*rb-delimiters-custom-query* +rb-delimiters-custom-strategy rainbow-delimiters.txt /*rb-delimiters-custom-strategy* +rb-delimiters-intro rainbow-delimiters.txt /*rb-delimiters-intro* +rb-delimiters-logging rainbow-delimiters.txt /*rb-delimiters-logging* +rb-delimiters-query rainbow-delimiters.txt /*rb-delimiters-query* +rb-delimiters-reading rainbow-delimiters.txt /*rb-delimiters-reading* +rb-delimiters-setup rainbow-delimiters.txt /*rb-delimiters-setup* +rb-delimiters-strategy rainbow-delimiters.txt /*rb-delimiters-strategy* +rb-delimiters.disable rainbow-delimiters.txt /*rb-delimiters.disable* +rb-delimiters.enable rainbow-delimiters.txt /*rb-delimiters.enable* +rb-delimiters.hlgroup_at rainbow-delimiters.txt /*rb-delimiters.hlgroup_at* +rb-delimiters.is_enabled rainbow-delimiters.txt /*rb-delimiters.is_enabled* +rb-delimiters.strategy rainbow-delimiters.txt /*rb-delimiters.strategy* +rb-delimiters.strategy.global rainbow-delimiters.txt /*rb-delimiters.strategy.global* +rb-delimiters.strategy.local rainbow-delimiters.txt /*rb-delimiters.strategy.local* +rb-delimiters.strategy.noop rainbow-delimiters.txt /*rb-delimiters.strategy.noop* +rb-delimiters.toggle rainbow-delimiters.txt /*rb-delimiters.toggle* +rb_delimiters#disable rainbow-delimiters.txt /*rb_delimiters#disable* +rb_delimiters#enable rainbow-delimiters.txt /*rb_delimiters#enable* +rb_delimiters#is_enabled rainbow-delimiters.txt /*rb_delimiters#is_enabled* +rb_delimiters#toggle rainbow-delimiters.txt /*rb_delimiters#toggle* diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/doc/luasnip.txt b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/doc/luasnip.txt deleted file mode 100644 index e0ce8a2a..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/doc/luasnip.txt +++ /dev/null @@ -1,3709 +0,0 @@ -*luasnip.txt* For NVIM v0.8.0 Last change: 2024 May 24 - -============================================================================== -Table of Contents *luasnip-table-of-contents* - -1. Basics |luasnip-basics| - - Jump-Index |luasnip-basics-jump-index| - - Adding Snippets |luasnip-basics-adding-snippets| - - Snippet Insertion |luasnip-basics-snippet-insertion| -2. Node |luasnip-node| - - Api |luasnip-node-api| -3. Snippets |luasnip-snippets| - - Data |luasnip-snippets-data| -4. TextNode |luasnip-textnode| -5. InsertNode |luasnip-insertnode| -6. FunctionNode |luasnip-functionnode| -7. Node Reference |luasnip-node-reference| -8. ChoiceNode |luasnip-choicenode| -9. SnippetNode |luasnip-snippetnode| -10. IndentSnippetNode |luasnip-indentsnippetnode| -11. DynamicNode |luasnip-dynamicnode| -12. RestoreNode |luasnip-restorenode| -13. Key Indexer |luasnip-key-indexer| -14. Absolute Indexer |luasnip-absolute-indexer| -15. MultiSnippet |luasnip-multisnippet| -16. Extras |luasnip-extras| - - Lambda |luasnip-extras-lambda| - - Match |luasnip-extras-match| - - Repeat |luasnip-extras-repeat| - - Partial |luasnip-extras-partial| - - Nonempty |luasnip-extras-nonempty| - - Dynamic Lambda |luasnip-extras-dynamic-lambda| - - FMT |luasnip-extras-fmt| - - Conditions |luasnip-extras-conditions| - - On The Fly-Snippets |luasnip-extras-on-the-fly-snippets| - - select_choice |luasnip-extras-select_choice| - - Filetype-Functions |luasnip-extras-filetype-functions| - - Postfix-Snippet |luasnip-extras-postfix-snippet| - - Treesitter-Postfix-Snippet |luasnip-extras-treesitter-postfix-snippet| - - Snippet List |luasnip-extras-snippet-list| - - Snippet Location |luasnip-extras-snippet-location| -17. Extend Decorator |luasnip-extend-decorator| -18. LSP-Snippets |luasnip-lsp-snippets| - - Snipmate Parser |luasnip-lsp-snippets-snipmate-parser| - - Transformations |luasnip-lsp-snippets-transformations| -19. Variables |luasnip-variables| - - Environment Namespaces |luasnip-variables-environment-namespaces| - - LSP-Variables |luasnip-variables-lsp-variables| -20. Loaders |luasnip-loaders| - - Snippet-specific filetypes |luasnip-loaders-snippet-specific-filetypes| - - VS-Code |luasnip-loaders-vs-code| - - SNIPMATE |luasnip-loaders-snipmate| - - Lua |luasnip-loaders-lua| - - edit_snippets |luasnip-loaders-edit_snippets| -21. SnippetProxy |luasnip-snippetproxy| -22. ext_opts |luasnip-ext_opts| -23. Docstrings |luasnip-docstrings| -24. Docstring-Cache |luasnip-docstring-cache| -25. Events |luasnip-events| -26. Cleanup |luasnip-cleanup| -27. Logging |luasnip-logging| -28. Source |luasnip-source| -29. Config-Options |luasnip-config-options| -30. Troubleshooting |luasnip-troubleshooting| - - Adding Snippets |luasnip-troubleshooting-adding-snippets| -31. API |luasnip-api| -> - __ ____ - /\ \ /\ _`\ __ - \ \ \ __ __ __ \ \,\L\_\ ___ /\_\ _____ - \ \ \ __/\ \/\ \ /'__`\\/_\__ \ /' _ `\/\ \/\ '__`\ - \ \ \L\ \ \ \_\ \/\ \L\.\_/\ \L\ \/\ \/\ \ \ \ \ \L\ \ - \ \____/\ \____/\ \__/.\_\ `\____\ \_\ \_\ \_\ \ ,__/ - \/___/ \/___/ \/__/\/_/\/_____/\/_/\/_/\/_/\ \ \/ - \ \_\ - \/_/ -< - -LuaSnip is a snippet engine written entirely in Lua. It has some great features -like inserting text (`luasnip-function-node`) or nodes (`luasnip-dynamic-node`) -based on user input, parsing LSP syntax and switching nodes -(`luasnip-choice-node`). For basic setup like mappings and installing, check -the README. - -All code snippets in this help assume the following: - ->lua - local ls = require("luasnip") - local s = ls.snippet - local sn = ls.snippet_node - local isn = ls.indent_snippet_node - local t = ls.text_node - local i = ls.insert_node - local f = ls.function_node - local c = ls.choice_node - local d = ls.dynamic_node - local r = ls.restore_node - local events = require("luasnip.util.events") - local ai = require("luasnip.nodes.absolute_indexer") - local extras = require("luasnip.extras") - local l = extras.lambda - local rep = extras.rep - local p = extras.partial - local m = extras.match - local n = extras.nonempty - local dl = extras.dynamic_lambda - local fmt = require("luasnip.extras.fmt").fmt - local fmta = require("luasnip.extras.fmt").fmta - local conds = require("luasnip.extras.expand_conditions") - local postfix = require("luasnip.extras.postfix").postfix - local types = require("luasnip.util.types") - local parse = require("luasnip.util.parser").parse_snippet - local ms = ls.multi_snippet - local k = require("luasnip.nodes.key_indexer").new_key -< - -As noted in the |luasnip-loaders-lua|-section: - - - By default, the names from `luasnip.config.snip_env` - - will be used, but it’s possible to customize them by setting `snip_env` in - `setup`. -Furthermore, note that while this document assumes you have defined `ls` to be -`require("luasnip")`, it is **not** provided in the default set of variables. - - -============================================================================== -1. Basics *luasnip-basics* - -In LuaSnip, snippets are made up of `nodes`. These can contain either - -- static text (`textNode`) -- text that can be edited (`insertNode`) -- text that can be generated from the contents of other nodes (`functionNode`) -- other nodes - - `choiceNode`: allows choosing between two nodes (which might contain more - nodes) - - `restoreNode`: store and restore input to nodes -- or nodes that can be generated based on input (`dynamicNode`). - -Snippets are always created using the `s(trigger:string, -nodes:table)`-function. It is explained in more detail in |luasnip-snippets|, -but the gist is that it creates a snippet that contains the nodes specified in -`nodes`, which will be inserted into a buffer if the text before the cursor -matches `trigger` when `ls.expand` is called. - - -JUMP-INDEX *luasnip-basics-jump-index* - -Nodes that can be jumped to (`insertNode`, `choiceNode`, `dynamicNode`, -`restoreNode`, `snippetNode`) all require a "jump-index" so luasnip knows the -order in which these nodes are supposed to be visited ("jumped to"). - ->lua - s("trig", { - i(1), t"text", i(2), t"text again", i(3) - }) -< - -These indices don’t "run" through the entire snippet, like they do in -textmate-snippets (`"$1 ${2: $3 $4}"`), they restart at 1 in each nested -snippetNode: - ->lua - s("trig", { - i(1), t" ", sn(2, { - t" ", i(1), t" ", i(2) - }) - }) -< - -(roughly equivalent to the given textmate-snippet). - - -ADDING SNIPPETS *luasnip-basics-adding-snippets* - -The snippets for a given filetype have to be added to luasnip via -`ls.add_snippets(filetype, snippets)`. Snippets that should be accessible -globally (in all filetypes) have to be added to the special filetype `all`. - ->lua - ls.add_snippets("all", { - s("ternary", { - -- equivalent to "${1:cond} ? ${2:then} : ${3:else}" - i(1, "cond"), t(" ? "), i(2, "then"), t(" : "), i(3, "else") - }) - }) -< - -It is possible to make snippets from one filetype available to another using -`ls.filetype_extend`, more info on that in the section |luasnip-api|. - - -SNIPPET INSERTION *luasnip-basics-snippet-insertion* - -When a new snippet is expanded, it can be connected with the snippets that have -already been expanded in the buffer in various ways. First of all, Luasnip -distinguishes between root-snippets and child-snippets. The latter are nested -inside other snippets, so when jumping through a snippet, one may also traverse -the child-snippets expanded inside it, more or less as if the child just -contains more nodes of the parent. Root-snippets are of course characterised by -not being child-snippets. When expanding a new snippet, it becomes a child of -the snippet whose region it is expanded inside, and a root if it is not inside -any snippet’s region. If it is inside another snippet, the specific node it -is inside is determined, and the snippet then nested inside that node. - -- If that node is interactive (for example, an `insertNode`), the new snippet - will be traversed when the node is visited, as long as the - configuration-option `link_children` is enabled. If it is not enabled, it is - possible to jump from the snippet to the node, but not the other way around. -- If that node is not interactive, the snippet will be linked to the currently - active node, also such that it will not be jumped to again once it is left. - This is to prevent jumping large distances across the buffer as much as - possible. There may still be one large jump from the snippet back to the - current node it is nested inside, but that seems hard to avoid. - Thus, one should design snippets such that the regions where other snippets - may be expanded are inside `insertNodes`. - -If the snippet is not a child, but a root, it can be linked up with the roots -immediately adjacent to it by enabling `link_roots` in `setup`. Since by -default only one root is remembered, one should also set `keep_roots` if -`link_roots` is enabled. The two are separate options, since roots that are not -linked can still be reached by `ls.activate_node()`. This setup (remember -roots, but don’t jump to them) is useful for a super-tab like mapping -(`` and jump on the same key), where one would like to still enter -previous roots. Since there would almost always be more jumps if the roots are -linked, regular `` would not work almost all the time, and thus -`link_roots` has to stay disabled. - - -============================================================================== -2. Node *luasnip-node* - -Every node accepts, as its last parameter, an optional table of arguments. -There are some common ones (which are listed here), and some that only apply to -some nodes (`user_args` for function/dynamicNode). These `opts` are only -mentioned if they accept options that are not common to all nodes. - -Common opts: - -- `node_ext_opts` and `merge_node_ext_opts`: Control `ext_opts` (most likely - highlighting) of the node. Described in detail in |luasnip-ext_opts| -- `key`: The node can be reffered to by this key. Useful for either |luasnip-key-indexer| or for finding the node at runtime (See - |luasnip-snippets-api|), for example inside a `dynamicNode`. The keys - do not have to be unique across the entire lifetime of the snippet, but at any - point in time, the snippet may contain each key only once. This means it is - fine to return a keyed node from a `dynamicNode`, because even if it will be - generated multiple times, those will not be valid at the same time. -- `node_callbacks`: Define event-callbacks for this node (see - |luasnip-events|). - Accepts a table that maps an event, e.g. `events.enter` to the callback - (essentially the same as `callbacks` passed to `s`, only that there is no - first mapping from jump-index to the table of callbacks). - - -API *luasnip-node-api* - -- `get_jump_index()`: this method returns the jump-index of a node. If a node - doesn’t have a jump-index, this method returns `nil` instead. -- `get_buf_position(opts) -> {from_position, to_position}`: - Determines the range of the buffer occupied by this node. `from`- and - `to_position` are `row,column`-tuples, `0,0`-indexed (first line is 0, first - column is 0) and end-inclusive (see |api-indexing|, this is extmarks - indexing). - - `opts`: `table|nil`, options, valid keys are: - - `raw`: `bool`, default `true`. This can be used to switch between - byte-columns (`raw=true`) and visual columns (`raw=false`). This makes a - difference if the line contains characters represented by multiple bytes - in UTF, for example `ÿ`. - - -============================================================================== -3. Snippets *luasnip-snippets* - -The most direct way to define snippets is `s`: - ->lua - s({trig="trigger"}, {}) -< - -(This snippet is useless beyond serving as a minimal example) - -`s(context, nodes, opts) -> snippet` - -- `context`: Either table or a string. Passing a string is equivalent to passing - >lua - { - trig = context - } - < - The following keys are valid: - - `trig`: string, the trigger of the snippet. If the text in front of (to the - left of) the cursor when `ls.expand()` is called matches it, the snippet will - be expanded. By default, "matches" means the text in front of the cursor - matches the trigger exactly, this behaviour can be modified through - `trigEngine` - - `name`: string, can be used by e.g. `nvim-compe` to identify the snippet. - - `desc` (or `dscr`): string, description of the snippet, -separated or table for - multiple lines. - - `wordTrig`: boolean, if true, the snippet is only expanded if the word - (`[%w_]+`) before the cursor matches the trigger entirely. True by default. - - `regTrig`: boolean, whether the trigger should be interpreted as a lua pattern. - False by default. Consider setting `trigEngine` to `"pattern"` instead, it is - more expressive, and in line with other settings. - - `trigEngine`: (function|string), determines how `trig` is interpreted, and what - it means for it to "match" the text in front of the cursor. This behaviour can - be completely customized by passing a function, but the predefined ones, which - are accessible by passing their identifier, should suffice in most cases: - - `"plain"`: the default-behaviour, the trigger has to match the text before - the cursor exactly. - - `"pattern"`: the trigger is interpreted as a lua-pattern, and is a match if - `trig .. "$"` matches the line up to the cursor. Capture-groups will be - accessible as `snippet.captures`. - - `"ecma"`: the trigger is interpreted as an ECMAscript-regex, and is a - match if `trig .. "$"` matches the line up to the cursor. Capture-groups - will be accessible as `snippet.captures`. - This `trigEngine` requires `jsregexp` (see - |luasnip-lsp-snippets-transformations|) to be installed, if it - is not, this engine will behave like `"plain"`. - - `"vim"`: the trigger is interpreted as a vim-regex, and is a match if - `trig .. "$"` matches the line up to the cursor. As with the other - regex/pattern-engines, captures will be available as `snippet.captures`, - but there is one caveat: the matching is done using `matchlist`, so for - now empty-string submatches will be interpreted as unmatched, and the - corresponding `snippet.capture[i]` will be `nil` (this will most likely - change, don’t rely on this behavior). - Besides these predefined engines, it is also possible to create new ones: - Instead of a string, pass a function which satisfies `trigEngine(trigger, opts) - -> (matcher(line_to_cursor, trigger) -> whole_match, captures)` (ie. the - function receives `trig` and `trigEngineOpts` can, for example, precompile a - regex, and then returns a function responsible for determining whether the - current cursor-position (represented by the line up to the cursor) matches the - trigger (it is passed again here so engines which don’t do any - trigger-specific work (like compilation) can just return a static `matcher`), - and what the capture-groups are). The `lua`-engine, for example, can be - implemented like this: - >lua - local function matcher(line_to_cursor, trigger) - -- look for match which ends at the cursor. - -- put all results into a list, there might be many capture-groups. - local find_res = { line_to_cursor:find(trigger .. "$") } - - if #find_res > 0 then - -- if there is a match, determine matching string, and the - -- capture-groups. - local captures = {} - -- find_res[1] is `from`, find_res[2] is `to` (which we already know - -- anyway). - local from = find_res[1] - local match = line_to_cursor:sub(from, #line_to_cursor) - -- collect capture-groups. - for i = 3, #find_res do - captures[i - 2] = find_res[i] - end - return match, captures - else - return nil - end - end - - local function engine(trigger) - -- don't do any special work here, can't precompile lua-pattern. - return matcher - end - < - The predefined engines are defined in `trig_engines.lua` - , - read it for more examples. - - `trigEngineOpts`: `table`, options for the used trigEngine. The - valid options are: - - `max_len`: number, upper bound on the length of the trigger. - If this is set, the `line_to_cursor` will be truncated (from the cursor of - course) to `max_len` characters before performing the match. - This is implemented because feeding long `line_to_cursor` into eg. the - pattern-trigEngine will hurt performance quite a bit (see issue - Luasnip#1103). - This option is implemented for all `trigEngines`. - - `docstring`: string, textual representation of the snippet, specified like - `desc`. Overrides docstrings loaded from json. - - `docTrig`: string, used as `line_to_cursor` during docstring-generation. This - might be relevant if the snippet relies on specific values in the - capture-groups (for example, numbers, which won’t work with the default - `$CAPTURESN` used during docstring-generation) - - `hidden`: boolean, hint for completion-engines. If set, the snippet should not - show up when querying snippets. - - `priority`: positive number, Priority of the snippet, 1000 by default. Snippets - with high priority will be matched to a trigger before those with a lower one. - The priority for multiple snippets can also be set in `add_snippets`. - - `snippetType`: string, should be either `snippet` or `autosnippet` (ATTENTION: - singular form is used), decides whether this snippet has to be triggered by - `ls.expand()` or whether is triggered automatically (don’t forget to set - `ls.config.setup({ enable_autosnippets = true })` if you want to use this - feature). If unset it depends on how the snippet is added of which type the - snippet will be. - - `resolveExpandParams`: `fn(snippet, line_to_cursor, matched_trigger, captures) - -> table|nil`, where - - `snippet`: `Snippet`, the expanding snippet object - - `line_to_cursor`: `string`, the line up to the cursor. - - `matched_trigger`: `string`, the fully matched trigger (can be retrieved - from `line_to_cursor`, but we already have that info here :D) - - `captures`: `captures` as returned by `trigEngine`. - This function will be evaluated in `Snippet:matches()` to decide whether the - snippet can be expanded or not. Returns a table if the snippet can be expanded, - `nil` if can not. The returned table can contain any of these fields: - - `trigger`: `string`, the fully matched trigger. - - `captures`: `table`, this list could update the capture-groups from - parameter in snippet expansion. - Both `trigger` and `captures` can override the values returned via - `trigEngine`. - - `clear_region`: `{ "from": {, }, "to": {, } }`, - both (0, 0)-indexed, the region where text has to be cleared before - inserting the snippet. - - `env_override`: `map string->(string[]|string)`, override or extend - the snippet’s environment (`snip.env`) - If any of these is `nil`, the default is used (`trigger` and `captures` as - returned by `trigEngine`, `clear_region` such that exactly the trigger is - deleted, no overridden environment-variables). - A good example for the usage of `resolveExpandParams` can be found in the - implementation of `postfix` - . - - `condition`: `fn(line_to_cursor, matched_trigger, captures) -> bool`, where - - `line_to_cursor`: `string`, the line up to the cursor. - - `matched_trigger`: `string`, the fully matched trigger (can be retrieved - from `line_to_cursor`, but we already have that info here :D) - - `captures`: if the trigger is pattern, this list contains the - capture-groups. Again, could be computed from `line_to_cursor`, but we - already did so. - - `show_condition`: `f(line_to_cursor) -> bool`. - - `line_to_cursor`: `string`, the line up to the cursor. - This function is (should be) evaluated by completion engines, indicating - whether the snippet should be included in current completion candidates. - Defaults to a function returning `true`. This is different from `condition` - because `condition` is evaluated by LuaSnip on snippet expansion (and thus has - access to the matched trigger and captures), while `show_condition` is (should - be) evaluated by the completion engines when scanning for available snippet - candidates. - - `filetype`: `string`, the filetype of the snippet. This overrides the filetype - the snippet is added (via `add_snippet`) as. -- `nodes`: A single node or a list of nodes. The nodes that make up the snippet. -- `opts`: A table with the following valid keys: - - `callbacks`: Contains functions that are called upon entering/leaving a node of - this snippet. For example: to print text upon entering the _second_ node of a - snippet, `callbacks` should be set as follows: - >lua - { - -- position of the node, not the jump-index!! - -- s("trig", {t"first node", t"second node", i(1, "third node")}). - [2] = { - [events.enter] = function(node, _event_args) print("2!") end - } - } - < - To register a callback for the snippets’ own events, the key `[-1]` may be - used. More info on events in |luasnip-events| - - `child_ext_opts`, `merge_child_ext_opts`: Control `ext_opts` applied to the - children of this snippet. More info on those in the |luasnip-ext_opts|-section. - -The `opts`-table, as described here, can also be passed to e.g. `snippetNode` -and `indentSnippetNode`. It is also possible to set `condition` and -`show_condition` (described in the documentation of the `context`-table) from -`opts`. They should, however, not be set from both. - - -DATA *luasnip-snippets-data* - -Snippets contain some interesting tables during runtime: - -- `snippet.env`: Contains variables used in the LSP-protocol, for example - `TM_CURRENT_LINE` or `TM_FILENAME`. It’s possible to add customized variables - here too, check |luasnip-variables-environment-namespaces| -- `snippet.captures`: If the snippet was triggered by a pattern (`regTrig`), and - the pattern contained capture-groups, they can be retrieved here. -- `snippet.trigger`: The string that triggered this snippet. Again, only - interesting if the snippet was triggered through `regTrig`, for getting the - full match. - -These variables/tables primarily come in handy in `dynamic/functionNodes`, -where the snippet can be accessed through the immediate parent -(`parent.snippet`), which is passed to the function. (in most cases `parent == -parent.snippet`, but the `parent` of the dynamicNode is not always the -surrounding snippet, it could be a `snippetNode`). - -## Api - -- `invalidate()`: call this method to effectively remove the snippet. The - snippet will no longer be able to expand via `expand` or `expand_auto`. It - will also be hidden from lists (at least if the plugin creating the list - respects the `hidden`-key), but it might be necessary to call - `ls.refresh_notify(ft)` after invalidating snippets. -- `get_keyed_node(key)`: Returns the currently visible node associated with - `key`. - - -============================================================================== -4. TextNode *luasnip-textnode* - -The most simple kind of node; just text. - ->lua - s("trigger", { t("Wow! Text!") }) -< - -This snippet expands to - -> - Wow! Text!⎵ -< - -where ⎵ is the cursor. - -Multiline strings can be defined by passing a table of lines rather than a -string: - ->lua - s("trigger", { - t({"Wow! Text!", "And another line."}) - }) -< - -`t(text, node_opts)`: - -- `text`: `string` or `string[]` -- `node_opts`: `table`, see |luasnip-node| - - -============================================================================== -5. InsertNode *luasnip-insertnode* - -These Nodes contain editable text and can be jumped to- and from (e.g. -traditional placeholders and tabstops, like `$1` in textmate-snippets). - -The functionality is best demonstrated with an example: - ->lua - s("trigger", { - t({"After expanding, the cursor is here ->"}), i(1), - t({"", "After jumping forward once, cursor is here ->"}), i(2), - t({"", "After jumping once more, the snippet is exited there ->"}), i(0), - }) -< - -The Insert Nodes are visited in order `1,2,3,..,n,0`. (The jump-index 0 also -_has_ to belong to an `insertNode`!) So the order of InsertNode-jumps is as -follows: - -1. After expansion, the cursor is at InsertNode 1, -2. after jumping forward once at InsertNode 2, -3. and after jumping forward again at InsertNode 0. - -If no 0-th InsertNode is found in a snippet, one is automatically inserted -after all other nodes. - -The jump-order doesn’t have to follow the "textual" order of the nodes: - ->lua - s("trigger", { - t({"After jumping forward once, cursor is here ->"}), i(2), - t({"", "After expanding, the cursor is here ->"}), i(1), - t({"", "After jumping once more, the snippet is exited there ->"}), i(0), - }) -< - -The above snippet will behave as follows: - -1. After expansion, we will be at InsertNode 1. -2. After jumping forward, we will be at InsertNode 2. -3. After jumping forward again, we will be at InsertNode 0. - -An **important** (because here Luasnip differs from other snippet engines) -detail is that the jump-indices restart at 1 in nested snippets: - ->lua - s("trigger", { - i(1, "First jump"), - t(" :: "), - sn(2, { - i(1, "Second jump"), - t" : ", - i(2, "Third jump") - }) - }) -< - -as opposed to e.g. the textmate syntax, where tabstops are snippet-global: - ->snippet - ${1:First jump} :: ${2: ${3:Third jump} : ${4:Fourth jump}} -< - -(this is not exactly the same snippet of course, but as close as possible) (the -restart-rule only applies when defining snippets in lua, the above -textmate-snippet will expand correctly when parsed). - -`i(jump_index, text, node_opts)` - -- `jump_index`: `number`, this determines when this node will be jumped to (see - |luasnip-basics-jump-index|). -- `text`: `string|string[]`, a single string for just one line, a list with >1 - entries for multiple lines. - This text will be SELECTed when the `insertNode` is jumped into. -- `node_opts`: `table`, described in |luasnip-node| - -If the `jump_index` is `0`, replacing its’ `text` will leave it outside the -`insertNode` (for reasons, check out Luasnip#110). - - -============================================================================== -6. FunctionNode *luasnip-functionnode* - -Function Nodes insert text based on the content of other nodes using a -user-defined function: - ->lua - local function fn( - args, -- text from i(2) in this example i.e. { { "456" } } - parent, -- parent snippet or parent node - user_args -- user_args from opts.user_args - ) - return '[' .. args[1][1] .. user_args .. ']' - end - - s("trig", { - i(1), t '<-i(1) ', - f(fn, -- callback (args, parent, user_args) -> string - {2}, -- node indice(s) whose text is passed to fn, i.e. i(2) - { user_args = { "user_args_value" }} -- opts - ), - t ' i(2)->', i(2), t '<-i(2) i(0)->', i(0) - }) -< - -`f(fn, argnode_references, node_opts)`: - `fn`: `function(argnode_text, parent, -user_args1,...,user_argsn) -> text` - `argnode_text`: `string[][]`, the text -currently contained in the argnodes (e.g. `{{line1}, {line1, line2}}`). The -snippet indent will be removed from all lines following the first. - -- `parent`: The immediate parent of the `functionNode`. It is included here as it - allows easy access to some information that could be useful in functionNodes - (see |luasnip-snippets-data| for some examples). Many snippets access the - surrounding snippet just as `parent`, but if the `functionNode` is nested - within a `snippetNode`, the immediate parent is a `snippetNode`, not the - surrounding snippet (only the surrounding snippet contains data like `env` or - `captures`). -- `user_args`: The `user_args` passed in `opts`. Note that there may be multiple - user_args (e.g. `user_args1, ..., user_argsn`). - -`fn` shall return a string, which will be inserted as is, or a table of strings -for multiline strings, where all lines following the first will be prefixed -with the snippets’ indentation. - -- `argnode_references`: `node_reference[]|node_refernce|nil`. Either no, a - single, or multiple |luasnip-node-reference|s. Changing any of these will - trigger a re-evaluation of `fn`, and insertion of the updated text. If no node - reference is passed, the `functionNode` is evaluated once upon expansion. -- `node_opts`: `table`, see |luasnip-node|. One additional key is supported: - - `user_args`: `any[]`, these will be passed to `fn` as `user_arg1`-`user_argn`. - These make it easier to reuse similar functions, for example a functionNode - that wraps some text in different delimiters (`()`, `[]`, …). - >lua - local function reused_func(_,_, user_arg1) - return user_arg1 - end - - s("trig", { - f(reused_func, {}, { - user_args = {"text"} - }), - f(reused_func, {}, { - user_args = {"different text"} - }), - }) - < - -**Examples**: - -- Use captures from the regex trigger using a functionNode: - >lua - s({trig = "b(%d)", regTrig = true}, - f(function(args, snip) return - "Captured Text: " .. snip.captures[1] .. "." end, {}) - ) - < -- `argnodes_text` during function evaluation: - >lua - s("trig", { - i(1, "text_of_first"), - i(2, {"first_line_of_second", "second_line_of_second"}), - f(function(args, snip) - --here - -- order is 2,1, not 1,2!! - end, {2, 1} )}) - < - At `--here`, `args` would look as follows (provided no text was changed after - expansion): - >lua - args = { - {"first_line_of_second", "second_line_of_second"}, - {"text_of_first"} - } - < -- |luasnip-absolute-indexer|: - >lua - s("trig", { - i(1, "text_of_first"), - i(2, {"first_line_of_second", "second_line_of_second"}), - f(function(args, snip) - -- just concat first lines of both. - return args[1][1] .. args[2][1] - end, {ai[2], ai[1]} )}) - < - -If the function only performs simple operations on text, consider using the -`lambda` from `luasnip.extras` (See |luasnip-extras-lambda|) - - -============================================================================== -7. Node Reference *luasnip-node-reference* - -Node references are used to refer to other nodes in various parts of -luasnip’s API. For example, argnodes in functionNode, dynamicNode or lambda -are node references. These references can be either of: - -- `number`: the jump-index of the node. - This will be resolved relative to the parent of the node this is passed to. - (So, only nodes with the same parent can be referenced. This is very easy to - grasp, but also limiting) -- `key_indexer`: the key of the node, if it is present. This will come in - handy if the node that is being referred to is not in the same - snippet/snippetNode as the one the node reference is passed to. - Also, it is the proper way to refer to a non-interactive node (a - functionNode, for example) -- `absolute_indexer`: the absolute position of the node. Just like - `key_indexer`, it allows addressing non-sibling nodes, but is a bit more - awkward to handle since a path from root to node has to be determined, - whereas `key_indexer` just needs the key to match. - Due to this, `key_indexer` should be generally preferred. - (More information in |luasnip-absolute-indexer|). -- `node`: just the node. Usage of this is discouraged since it can lead to - subtle errors (for example, if the node passed here is captured in a closure - and therefore not copied with the remaining tables in the snippet; there’s a - big comment about just this in commit 8bfbd61). - - -============================================================================== -8. ChoiceNode *luasnip-choicenode* - -ChoiceNodes allow choosing between multiple nodes. - ->lua - s("trig", c(1, { - t("Ugh boring, a text node"), - i(nil, "At least I can edit something now..."), - f(function(args) return "Still only counts as text!!" end, {}) - })) -< - -`c(jump_index, choices, node_opts)` - -- `jump_index`: `number`, since choiceNodes can be jumped to, they need a - jump-index (Info in |luasnip-basics-jump-index|). -- `choices`: `node[]|node`, the choices. The first will be initialliy active. - A list of nodes will be turned into a `snippetNode`. -- `node_opts`: `table`. `choiceNode` supports the keys common to all nodes - described in |luasnip-node|, and one additional key: - - `restore_cursor`: `false` by default. If it is set, and the node that was being - edited also appears in the switched to choice (can be the case if a - `restoreNode` is present in both choice) the cursor is restored relative to - that node. The default is `false` as enabling might lead to decreased - performance. It’s possible to override the default by wrapping the - `choiceNode` constructor in another function that sets `opts.restore_cursor` to - `true` and then using that to construct `choiceNode`s: - >lua - local function restore_cursor_choice(pos, choices, opts) - if opts then - opts.restore_cursor = true - else - opts = {restore_cursor = true} - end - return c(pos, choices, opts) - end - < - -Jumpable nodes that normally expect an index as their first parameter don’t -need one inside a choiceNode; their jump-index is the same as the -choiceNodes’. - -As it is only possible (for now) to change choices from within the choiceNode, -make sure that all of the choices have some place for the cursor to stop at! - -This means that in `sn(nil, {...nodes...})` `nodes` has to contain e.g. an -`i(1)`, otherwise luasnip will just "jump through" the nodes, making it -impossible to change the choice. - ->lua - c(1, { - t"some text", -- textNodes are just stopped at. - i(nil, "some text"), -- likewise. - sn(nil, {t"some text"}) -- this will not work! - sn(nil, {i(1), t"some text"}) -- this will. - }) -< - -The active choice for a choiceNode can be changed by either calling one of -`ls.change_choice(1)` (forwards) or `ls.change_choice(-1)` (backwards), or by -calling `ls.set_choice(choice_indx)`. - -One way to easily interact with choiceNodes is binding `change_choice(1/-1)` to -keys: - ->lua - -- set keybinds for both INSERT and VISUAL. - vim.api.nvim_set_keymap("i", "", "luasnip-next-choice", {}) - vim.api.nvim_set_keymap("s", "", "luasnip-next-choice", {}) - vim.api.nvim_set_keymap("i", "", "luasnip-prev-choice", {}) - vim.api.nvim_set_keymap("s", "", "luasnip-prev-choice", {}) -< - -Apart from this, there is also a picker (see |luasnip-select_choice| where no -cycling is necessary and any choice can be selected right away, via -`vim.ui.select`. - - -============================================================================== -9. SnippetNode *luasnip-snippetnode* - -SnippetNodes directly insert their contents into the surrounding snippet. This -is useful for `choiceNode`s, which only accept one child, or `dynamicNode`s, -where nodes are created at runtime and inserted as a `snippetNode`. - -Their syntax is similar to `s`, however, where snippets require a table -specifying when to expand, `snippetNode`s, similar to `insertNode`s, expect a -jump-index. - ->lua - s("trig", sn(1, { - t("basically just text "), - i(1, "And an insertNode.") - })) -< - -`sn(jump_index, nodes, node_opts)` - -- `jump_index`: `number`, the usual |luasnip-jump-index|. -- `nodes`: `node[]|node`, just like for `s`. - Note that `snippetNode`s don’t accept an `i(0)`, so the jump-indices of the nodes - inside them have to be in `1,2,...,n`. -- `node_opts`: `table`: again, the keys common to all nodes (documented in - |luasnip-node|) are supported, but also - - `callbacks`, - - `child_ext_opts` and - - `merge_child_ext_opts`, - which are further explained in |luasnip-snippets|. - - -============================================================================== -10. IndentSnippetNode *luasnip-indentsnippetnode* - -By default, all nodes are indented at least as deep as the trigger. With these -nodes it’s possible to override that behaviour: - ->lua - s("isn", { - isn(1, { - t({"This is indented as deep as the trigger", - "and this is at the beginning of the next line"}) - }, "") - }) -< - -(Note the empty string passed to isn). - -Indent is only applied after linebreaks, so it’s not possible to remove -indent on the line where the snippet was triggered using `ISN` (That is -possible via regex triggers where the entire line before the trigger is -matched). - -Another nice use case for `ISN` is inserting text, e.g. `//` or some other -comment string before the nodes of the snippet: - ->lua - s("isn2", { - isn(1, t({"//This is", "A multiline", "comment"}), "$PARENT_INDENT//") - }) -< - -Here the `//` before `This is` is important, once again, because indent is only -applied after linebreaks. - -To enable such usage, `$PARENT_INDENT` in the indentstring is replaced by the -parent’s indent. - -`isn(jump_index, nodes, indentstring, node_opts)` - -All of these parameters except `indentstring` are exactly the same as in -|luasnip-snippetnode|. - -- `indentstring`: `string`, will be used to indent the nodes inside this - `snippetNode`. - All occurences of `"$PARENT_INDENT"` are replaced with the actual indent of - the parent. - - -============================================================================== -11. DynamicNode *luasnip-dynamicnode* - -Very similar to functionNode, but returns a snippetNode instead of just text, -which makes them very powerful as parts of the snippet can be changed based on -user input. - -`d(jump_index, function, node-references, opts)`: - -- `jump_index`: `number`, just like all jumpable nodes, its’ position in the - jump-list (|luasnip-basics-jump-index|). -- `function`: `fn(args, parent, old_state, user_args) -> snippetNode` This - function is called when the argnodes’ text changes. It should generate and - return (wrapped inside a `snippetNode`) nodes, which will be inserted at the - dynamicNode’s place. `args`, `parent` and `user_args` are also explained in - |luasnip-functionnode| - - `args`: `table of text` (`{{"node1line1", "node1line2"}, {"node2line1"}}`) - from nodes the `dynamicNode` depends on. - - `parent`: the immediate parent of the `dynamicNode`. - - `old_state`: a user-defined table. This table may contain anything; its - intended usage is to preserve information from the previously generated - `snippetNode`. If the `dynamicNode` depends on other nodes, it may be - reconstructed, which means all user input (text inserted in `insertNodes`, - changed choices) to the previous `dynamicNode` is lost. - The `old_state` table must be stored in `snippetNode` returned by - the function (`snippetNode.old_state`). - The second example below illustrates the usage of `old_state`. - - `user_args`: passed through from `dynamicNode`-opts; may have more than one - argument. -- `node_references`: `node_reference[]|node_references|nil`, - |luasnip-node-references| to the nodes the dynamicNode depends on: if any of - these trigger an update (for example, if the text inside them changes), the - `dynamicNode`s’ function will be executed, and the result inserted at the - `dynamicNode`s place. (`dynamicNode` behaves exactly the same as `functionNode` - in this regard). -- `opts`: In addition to the common |luasnip-node|-keys, there is, again, - - `user_args`, which is described in |luasnip-functionnode|. - -**Examples**: - -This `dynamicNode` inserts an `insertNode` which copies the text inside the -first `insertNode`. - ->lua - s("trig", { - t"text: ", i(1), t{"", "copy: "}, - d(2, function(args) - -- the returned snippetNode doesn't need a position; it's inserted - -- "inside" the dynamicNode. - return sn(nil, { - -- jump-indices are local to each snippetNode, so restart at 1. - i(1, args[1]) - }) - end, - {1}) - }) -< - -This snippet makes use of `old_state` to count the number of updates. - -To store/restore values generated by the `dynamicNode` or entered into -`insert/choiceNode`, consider using the shortly-introduced `restoreNode` -instead of `old_state`. - ->lua - local function count(_, _, old_state) - old_state = old_state or { - updates = 0 - } - - old_state.updates = old_state.updates + 1 - - local snip = sn(nil, { - t(tostring(old_state.updates)) - }) - - snip.old_state = old_state - return snip - end - - ls.add_snippets("all", - s("trig", { - i(1, "change to update"), - d(2, count, {1}) - }) - ) -< - -As with `functionNode`, `user_args` can be used to reuse similar `dynamicNode`- -functions. - - -============================================================================== -12. RestoreNode *luasnip-restorenode* - -This node can store and restore a snippetNode as is. This includes changed -choices and changed text. Its’ usage is best demonstrated by an example: - ->lua - s("paren_change", { - c(1, { - sn(nil, { t("("), r(1, "user_text"), t(")") }), - sn(nil, { t("["), r(1, "user_text"), t("]") }), - sn(nil, { t("{"), r(1, "user_text"), t("}") }), - }), - }, { - stored = { - -- key passed to restoreNodes. - ["user_text"] = i(1, "default_text") - } - }) -< - -Here the text entered into `user_text` is preserved upon changing choice. - -`r(jump_index, key, nodes, node_opts)`: - -- `jump_index`, when to jump to this node. -- `key`, `string`: `restoreNode`s with the same key share their content. -- `nodes`, `node[]|node`: the content of the `restoreNode`. - Can either be a single node, or a table of nodes (both of which will be - wrapped inside a `snippetNode`, except if the single node already is a - `snippetNode`). - The content for a given key may be defined multiple times, but if the - contents differ, it’s undefined which will actually be used. - If a key’s content is defined in a `dynamicNode`, it will not be initially - used for `restoreNodes` outside that `dynamicNode`. A way around this - limitation is defining the content in the `restoreNode` outside the - `dynamicNode`. - -The content for a key may also be defined in the `opts`-parameter of the -snippet-constructor, as seen in the example above. The `stored`-table accepts -the same values as the `nodes`-parameter passed to `r`. If no content is -defined for a key, it defaults to the empty `insertNode`. - -An important-to-know limitation of `restoreNode` is that, for a given key, only -one may be visible at a time. See this issue - for details. - -The `restoreNode` is especially useful for storing input across updates of a -`dynamicNode`. Consider this: - ->lua - local function simple_restore(args, _) - return sn(nil, {i(1, args[1]), i(2, "user_text")}) - end - - s("rest", { - i(1, "preset"), t{"",""}, - d(2, simple_restore, 1) - }) -< - -Every time the `i(1)` in the outer snippet is changed, the text inside the -`dynamicNode` is reset to `"user_text"`. This can be prevented by using a -`restoreNode`: - ->lua - local function simple_restore(args, _) - return sn(nil, {i(1, args[1]), r(2, "dyn", i(nil, "user_text"))}) - end - - s("rest", { - i(1, "preset"), t{"",""}, - d(2, simple_restore, 1) - }) -< - -Now the entered text is stored. - -`restoreNode`s indent is not influenced by `indentSnippetNodes` right now. If -that really bothers you feel free to open an issue. - - -============================================================================== -13. Key Indexer *luasnip-key-indexer* - -A very flexible way of referencing nodes (|luasnip-node-reference|). While the -straightforward way of addressing nodes via their |luasnip-jump-index| suffices -in most cases, a `dynamic/functionNode` can only depend on nodes in the same -snippet(Node), its siblings (since the index is interpreted as relative to -their parent). Accessing a node with a different parent is thus not possible. -Secondly, and less relevant, only nodes that actually have a jump-index can be -referred to (a `functionNode`, for example, cannot be depended on). Both of -these restrictions are lifted with `key_indexer`: It allows addressing nodes by -their key, which can be set when the node is constructed, and is wholly -independent of the nodes’ position in the snippet, thus enabling descriptive -labeling. - -The following snippets demonstrate the issue and the solution by using -`key_indexer`: - -First, the addressed problem of referring to nodes outside the `functionNode`s -parent: - ->lua - s("trig", { - i(1), c(2, { - sn(nil, { - t"cannot access the argnode :(", - f(function(args) - return args[1] - end, {???}) -- can't refer to i(1), since it isn't a sibling of `f`. - }), - t"sample_text" - }) - }) -< - -And the solution: first give the node we want to refer to a key, and then pass -the same to the `functionNode`. - ->lua - s("trig", { - i(1, "", {key = "i1-key"}), c(2, { - sn(nil, { i(1), - t"can access the argnode :)", - f(function(args) - return args[1] - end, k("i1-key") ) - }), - t"sample_text" - }) - }) -< - - -============================================================================== -14. Absolute Indexer *luasnip-absolute-indexer* - -`absolute_indexer` allows accessing nodes by their unique jump-index path from -the snippet-root. This makes it almost as powerful as |luasnip-key-indexer|, -but again removes the possibility of referring to non-jumpable nodes and makes -it all a bit more error-prone since the jump-index paths are hard to follow, -and (unfortunately) have to be a bit verbose (see the long example of -`absolute_indexer`-positions below). Consider just using |luasnip-key-indexer| -instead. - -(The solution-snippet from |luasnip-key-indexer|, but using `ai` instead.) - ->lua - s("trig", { - i(1), c(2, { - sn(nil, { i(1), - t"can access the argnode :)", - f(function(args) - return args[1] - end, ai(1) ) - }), - t"sample_text" - }) - }) -< - -There are some quirks in addressing nodes: - ->lua - s("trig", { - i(2), -- ai[2]: indices based on jump-index, not position. - sn(1, { -- ai[1] - i(1), -- ai[1][1] - t"lel", -- not addressable. - i(2) -- ai[1][2] - }), - c(3, { -- ai[3] - i(nil), -- ai[3][1] - t"lel", -- ai[3][2]: choices are always addressable. - }), - d(4, function() -- ai[4] - return sn(nil, { -- ai[4][0] - i(1), -- ai[4][0][1] - }) - end, {}), - r(5, "restore_key", -- ai[5] - i(1) -- ai[5][0][1]: restoreNodes always store snippetNodes. - ), - r(6, "restore_key_2", -- ai[6] - sn(nil, { -- ai[6][0] - i(1) -- ai[6][0][1] - }) - ) - }) -< - -Note specifically that the index of a dynamicNode differs from that of the -generated snippetNode, and that restoreNodes (internally) always store a -snippetNode, so even if the restoreNode only contains one node, that node has -to be accessed as `ai[restoreNodeIndx][0][1]`. - -`absolute_indexer`s’ can be constructed in different ways: - -- `ai[1][2][3]` -- `ai(1, 2, 3)` -- `ai{1, 2, 3}` - -are all the same node. - - -============================================================================== -15. MultiSnippet *luasnip-multisnippet* - -There are situations where it might be comfortable to access a snippet in -different ways. For example, one might want to enable auto-triggering in -regions where the snippets usage is common, while leaving it manual-only in -others. This is where `ms` should be used: A single snippet can be associated -with multiple `context`s (the `context`-table determines the conditions under -which a snippet may be triggered). This has the advantage (compared with just -registering copies) that all `context`s are backed by a single snippet, and not -multiple, and it’s (at least should be :D) more comfortable to use. - -`ms(contexts, nodes, opts) -> addable`: - -- `contexts`: table containing list of `contexts`, and some keywords. - `context` are described in |luasnip-snippets|, here they may also be tables - or strings. - So far, there is only one valid keyword: - - `common`: Accepts yet another context. - The options in `common` are applied to (but don’t override) the other - contexts specified in `contexts`. -- `nodes`: List of nodes, exactly like in |luasnip-snippets|. -- `opts`: Table, options for this function: - - `common_opts`: The snippet-options (see also |luasnip-snippets|) applied - to the snippet generated from `nodes`. - -The returned object is an `addable`, something which can be passed to -`add_snippets`, or returned from the lua-loader. - -**Examples**: - ->lua - ls.add_snippets("all", { - ms({"a", "b"}, {t"a or b"}) - }) -< - ->lua - ls.add_snippets("all", { - ms({ - common = {snippetType = "autosnippet"}, - "a", - "b" - }, { - t"a or b (but autotriggered!!)" - }) - }) -< - ->lua - ls.add_snippets("all", { - ms({ - common = {snippetType = "autosnippet"}, - {trig = "a", snippetType = "snippet"}, - "b", - {trig = "c", condition = function(line_to_cursor) - return line_to_cursor == "" - end} - }, { - t"a or b (but autotriggered!!)" - }) - }) -< - - -============================================================================== -16. Extras *luasnip-extras* - - -LAMBDA *luasnip-extras-lambda* - -A shortcut for `functionNode`s that only do very basic string manipulation. - -`l(lambda, argnodes)`: - -- `lambda`: An object created by applying string-operations to `l._n`, objects - representing the `n`th argnode. - For example: - - `l._1:gsub("a", "e")` replaces all occurences of "a" in the text of the - first argnode with "e", or - - `l._1 .. l._2` concatenates text of the first and second argnode. - If an argnode contains multiple lines of text, they are concatenated with - `"\n"` prior to any operation. -- `argnodes`, a |luasnip-node-reference|, just like in function- and - dynamicNode. - -There are many examples for `lambda` in `Examples/snippets.lua` - - -MATCH *luasnip-extras-match* - -`match` can insert text based on a predicate (again, a shorthand for -`functionNode`). - -`match(argnodes, condition, then, else)`: - -- `argnode`: A single |luasnip-node-reference|. May not be nil, or - a table. -- `condition` may be either of - - `string`: interpreted as a lua pattern. Matched on the `\n`-joined (in case - it’s multiline) text of the first argnode (`args[1]:match(condition)`). - - `function`: `fn(args, snip) -> bool`: takes the same parameters as the - `functionNode`-function, any value other than nil or false is interpreted - as a match. - - `lambda`: `l._n` is the `\n`-joined text of the nth argnode. - Useful if string manipulations have to be performed before the string is matched. - Should end with `match`, but any other truthy result will be interpreted - as matching. -- `then` is inserted if the condition matches, -- `else` if it does not. - -Both `then` and `else` can be either text, lambda or function (with the same -parameters as specified above). `then`’s default-value depends on the -`condition`: - -- `pattern`: Simply the return value from the `match`, e.g. the entire match, - or, if there were capture groups, the first capture group. -- `function`: the return value of the function if it is either a string, or a - table (if there is no `then`, the function cannot return a table containing - something other than strings). -- `lambda`: Simply the first value returned by the lambda. - -Examples: - -- `match(n, "^ABC$", "A")`. -- `match(n, lambda._1:match(lambda._1:reverse()), "PALINDROME")` - >lua - s("trig", { - i(1), t":", - i(2), t"::", - m({1, 2}, l._1:match("^"..l._2.."$"), l._1:gsub("a", "e")) - }) - < -- >lua - s("extras1", { - i(1), t { "", "" }, m(1, "^ABC$", "A") - }) - < - Inserts "A" if the node with jump-index `n` matches "ABC" exactly, nothing - otherwise. -- >lua - s("extras2", { - i(1, "INPUT"), t { "", "" }, m(1, l._1:match(l._1:reverse()), "PALINDROME") - }) - < - Inserts `"PALINDROME"` if i(1) contains a palindrome. -- >lua - s("extras3", { - i(1), t { "", "" }, i(2), t { "", "" }, - m({ 1, 2 }, l._1:match("^" .. l._2 .. "$"), l._1:gsub("a", "e")) - }) - < - This inserts the text of the node with jump-index 1, with all occurences of `a` - replaced with `e`, if the second insertNode matches the first exactly. - - -REPEAT *luasnip-extras-repeat* - -Inserts the text of the passed node. - -`rep(node_reference)` - `node_reference`, a single |luasnip-node-reference|. - ->lua - s("extras4", { i(1), t { "", "" }, extras.rep(1) }) -< - - -PARTIAL *luasnip-extras-partial* - -Evaluates a function on expand and inserts its value. - -`partial(fn, params...)` - `fn`: any function - `params`: varargs, any, will be -passed to `fn`. - -For example `partial(os.date, "%Y")` inserts the current year on expansion. - ->lua - s("extras5", { extras.partial(os.date, "%Y") }) -< - - -NONEMPTY *luasnip-extras-nonempty* - -Inserts text if the referenced node doesn’t contain any text. - -`nonempty(node_reference, not_empty, empty)`: - -- `node_reference`, a single |luasnip-node-reference|. -- `not_empty`, `string`: inserted if the node is not empty. -- `empty`, `string`: inserted if the node is empty. - ->lua - s("extras6", { i(1, ""), t { "", "" }, extras.nonempty(1, "not empty!", "empty!") }) -< - - -DYNAMIC LAMBDA *luasnip-extras-dynamic-lambda* - -Pretty much the same as lambda, but it inserts the resulting text as an -insertNode, and, as such, it can be quickly overridden. - -`dynamic_lambda(jump_indx, lambda, node_references)` - `jump_indx`, as usual, -the jump-indx. - -The remaining arguments carry over from lambda. - ->lua - s("extras7", { i(1), t { "", "" }, extras.dynamic_lambda(2, l._1 .. l._1, 1) }) -< - - -FMT *luasnip-extras-fmt* - -Authoring snippets can be quite clunky, especially since every second node is -probably a `textNode`, inserting a small number of characters between two more -complicated nodes. - -`fmt` can be used to define snippets in a much more readable way. This is -achieved by borrowing (as the name implies) from `format`-functionality (our -syntax is very similar to python’s -). - -`fmt` accepts a string and a table of nodes. Each occurrence of a delimiter -pair in the string is replaced by one node from the table, while text outside -the delimiters is turned into textNodes. - -Simple example: - ->lua - ls.add_snippets("all", { - -- important! fmt does not return a snippet, it returns a table of nodes. - s("example1", fmt("just an {iNode1}", { - iNode1 = i(1, "example") - })), - s("example2", fmt([[ - if {} then - {} - end - ]], { - -- i(1) is at nodes[1], i(2) at nodes[2]. - i(1, "not now"), i(2, "when") - })), - s("example3", fmt([[ - if <> then - <> - end - ]], { - -- i(1) is at nodes[1], i(2) at nodes[2]. - i(1, "not now"), i(2, "when") - }, { - delimiters = "<>" - })), - s("example4", fmt([[ - repeat {a} with the same key {a} - ]], { - a = i(1, "this will be repeat") - }, { - repeat_duplicates = true - })) - }) -< - -One important detail here is that the position of the delimiters does not, in -any way, correspond to the jump-index of the nodes! - -`fmt(format:string, nodes:table of nodes, opts:table|nil) -> table of nodes` - -- `format`: a string. Occurences of `{}` ( `{}` are customizable; more - on that later) are replaced with `content[]` (which should be a - node), while surrounding text becomes `textNode`s. - To escape a delimiter, repeat it (`"{{"`). - If no key is given (`{}`) are numbered automatically: - `"{} ? {} : {}"` becomes `"{1} ? {2} : {3}"`, while - `"{} ? {3} : {}"` becomes `"{1} ? {3} : {4}"` (the count restarts at each - numbered placeholder). - If a key appears more than once in `format`, the node in - `content[]` is inserted for the first, and copies of it for - subsequent occurences. -- `nodes`: just a table of nodes. -- `opts`: optional arguments: - - `delimiters`: string, two characters. Change `{}` to some other pair, e.g. - `"<>"`. - - `strict`: Warn about unused nodes (default true). - - `trim_empty`: remove empty (`"%s*"`) first and last line in `format`. Useful - when passing multiline strings via `[[]]` (default true). - - `dedent`: remove indent common to all lines in `format`. Again, makes - passing multiline-strings a bit nicer (default true). - - `repeat_duplicates`: repeat nodes when a key is reused instead of copying - the node if it has a jump-index, refer to |luasnip-basics-jump-index| to - know which nodes have a jump-index (default false). - -There is also `require("luasnip.extras.fmt").fmta`. This only differs from -`fmt` by using angle brackets (`<>`) as the default delimiter. - - -CONDITIONS *luasnip-extras-conditions* - -This module (`luasnip.extras.condition`) contains functions that can be passed -to a snippet’s `condition` or `show_condition`. These are grouped accordingly -into `luasnip.extras.conditions.expand` and `luasnip.extras.conditions.show`: - -**expand**: - -- `line_begin`: only expand if the cursor is at the beginning of the line. - -**show**: - -- `line_end`: only expand at the end of the line. -- `has_selected_text`: only expand if there’s selected text stored after pressing - `store_selection_keys`. - -Additionally, `expand` contains all conditions provided by `show`. - - -CONDITION OBJECTS ~ - -`luasnip.extras.conditions` also contains condition objects. These can, just -like functions, be passed to `condition` or `show_condition`, but can also be -combined with each other into logical expressions: - -- `-c1 -> not c1` -- `c1 * c2 -> c1 and c2` -- `c1 + c2 -> c1 or c2` -- `c1 - c2 -> c1 and not c2`: This is similar to set differences: - `A \ B = {a in A | a not in B}`. This makes `-(a + b) = -a - b` an identity - representing de Morgan’s law: `not (a or b) = not a and not b`. However, - since boolean algebra lacks an additive inverse, `a + (-b) = a - b` does not - hold. Thus, this is NOT the same as `c1 + (-c2)`. -- `c1 ^ c2 -> c1 xor(!=) c2` -- `c1 % c2 -> c1 xnor(==) c2`: This decision may seem weird, considering how - there is an overload for the `==`-operator. Unfortunately, it’s not possible - to use this for our purposes (some info - here ), - so we decided to make use of a more obscure symbol (which will hopefully avoid - false assumptions about its meaning). - -This makes logical combinations of conditions very readable. Compare - ->lua - condition = conditions.expand.line_end + conditions.expand.line_begin -< - -with the more verbose - ->lua - condition = function(...) return conditions.expand.line_end(...) or conditions.expand.line_begin(...) end -< - -The conditions provided in `show` and `expand` are already condition objects. -To create new ones, use -`require("luasnip.extras.conditions").make_condition(condition_fn)` - - -ON THE FLY-SNIPPETS *luasnip-extras-on-the-fly-snippets* - -Sometimes it’s desirable to create snippets tailored for exactly the current -situation. For example inserting repetitive, but just slightly different -invocations of some function, or supplying data in some schema. - -On-the-fly snippets enable exactly this use case: they can be quickly created -and expanded with as little disruption as possible. - -Since they should mainly fast to write and don’t necessarily need all bells -and whistles, they don’t make use of lsp/textmate-syntax, but a more -simplistic one: - -- `$anytext` denotes a placeholder (`insertNode`) with text "anytext". The text - also serves as a unique key: if there are multiple placeholders with the same - key, only the first will be editable, the others will just mirror it. -- … That’s it. `$` can be escaped by preceding it with a second `$`, all other - symbols will be interpreted literally. - -There is currently only one way to expand on-the-fly snippets: -`require('luasnip.extras.otf').on_the_fly("")` will interpret -whatever text is in the register `` as a snippet, and expand it -immediately. The idea behind this mechanism is that it enables a very immediate -way of supplying and retrieving (expanding) the snippet: write the snippet-body -into the buffer, cut/yank it into some register, and call -`on_the_fly("")` to expand the snippet. - -Here’s one set of example keybindings: - ->vim - " in the first call: passing the register is optional since `on_the_fly` - " defaults to the unnamed register, which will always contain the previously cut - " text. - vnoremap "eclua require('luasnip.extras.otf').on_the_fly("e") - inoremap lua require('luasnip.extras.otf').on_the_fly("e") -< - -Obviously, `` is arbritary and can be changed to any other key combo. -Another interesting application is allowing multiple on-the-fly snippets at the -same time by retrieving snippets from multiple registers: - ->vim - " For register a - vnoremap a "aclua require('luasnip.extras.otf').on_the_fly() - inoremap a lua require('luasnip.extras.otf').on_the_fly("a") - - - " For register b - vnoremap a "bc:lua require('luasnip.extras.otf').on_the_fly() - inoremap b lua require('luasnip.extras.otf').on_the_fly("b") -< - - -SELECT_CHOICE *luasnip-extras-select_choice* - -It’s possible to leverage `vim.ui.select` for selecting a choice directly, -without cycling through the available choices. All that is needed for this is -calling `require("luasnip.extras.select_choice")`, most likely via some -keybind, e.g. - ->vim - inoremap lua require("luasnip.extras.select_choice")() -< - -while inside a choiceNode. The `opts.kind` hint for `vim.ui.select` will be set -to `luasnip`. - - -FILETYPE-FUNCTIONS *luasnip-extras-filetype-functions* - -Contains some utility functions that can be passed to the `ft_func` or -`load_ft_func`-settings. - -- `from_filetype`: the default for `ft_func`. Simply returns the filetype(s) of - the buffer. -- `from_cursor_pos`: uses treesitter to determine the filetype at the cursor. - With that, it’s possible to expand snippets in injected regions, as long as - the treesitter parser supports them. If this is used in conjuction with - `lazy_load`, extra care must be taken that all the filetypes that can be - expanded in a given buffer are also returned by `load_ft_func` (otherwise their - snippets may not be loaded). This can easily be achieved with `extend_load_ft`. -- `extend_load_ft`: `fn(extend_ft:map) -> fn` A simple solution to the problem - described above is loading more filetypes than just that of the target buffer - when `lazy_load`ing. This can be done ergonomically via `extend_load_ft`: - calling it with a table where the keys are filetypes, and the values are the - filetypes that should be loaded additionaly returns a function that can be - passed to `load_ft_func` and takes care of extending the filetypes properly. - >lua - ls.setup({ - load_ft_func = - -- Also load both lua and json when a markdown-file is opened, - -- javascript for html. - -- Other filetypes just load themselves. - require("luasnip.extras.filetype_functions").extend_load_ft({ - markdown = {"lua", "json"}, - html = {"javascript"} - }) - }) - < - - -POSTFIX-SNIPPET *luasnip-extras-postfix-snippet* - -Postfix snippets, famously used in rust analyzer - and various IDEs, are a type of snippet -which alters text before the snippet’s trigger. While these can be -implemented using regTrig snippets, this helper makes the process easier in -most cases. - -The simplest example, which surrounds the text preceeding the `.br` with -brackets `[]`, looks like: - ->lua - postfix(".br", { - f(function(_, parent) - return "[" .. parent.snippet.env.POSTFIX_MATCH .. "]" - end, {}), - }) -< - -and is triggered with `xxx.br` and expands to `[xxx]`. - -Note the `parent.snippet.env.POSTFIX_MATCH` in the function node. This is -additional field generated by the postfix snippet. This field is generated by -extracting the text matched (using a configurable matching string, see below) -from before the trigger. In the case above, the field would equal `"xxx"`. This -is also usable within dynamic nodes. - -This field can also be used within lambdas and dynamic nodes. - ->lua - postfix(".br", { - l("[" .. l.POSTFIX_MATCH .. "]"), - }) -< - ->lua - postfix(".brd", { - d(1, function (_, parent) - return sn(nil, {t("[" .. parent.env.POSTFIX_MATCH .. "]")}) - end) - }) -< - -The arguments to `postfix` are identical to the arguments to `s` but with a few -extra options. - -The first argument can be either a string or a table. If it is a string, that -string will act as the trigger, and if it is a table it has the same valid keys -as the table in the same position for `s` except: - -- `wordTrig`: This key will be ignored if passed in, as it must always be - false for postfix snippets. -- `match_pattern`: The pattern that the line before the trigger is matched - against. The default match pattern is `"[%w%.%_%-]+$"`. Note the `$`. This - matches since only the line _up until_ the beginning of the trigger is - matched against the pattern, which makes the character immediately - preceeding the trigger match as the end of the string. - -Some other match strings, including the default, are available from the postfix -module. `require("luasnip.extras.postfix).matches`: - -- `default`: `[%w%.%_%-%"%']+$` -- `line`: `^.+$` - -The second argument is identical to the second argument for `s`, that is, a -table of nodes. - -The optional third argument is the same as the third (`opts`) argument to the -`s` function, but with one difference: - -The postfix snippet works using a callback on the pre_expand event of the -snippet. If you pass a callback on the pre_expand event (structure example -below) it will get run after the builtin callback. - ->lua - { - callbacks = { - [-1] = { - [events.pre_expand] = function(snippet, event_args) - -- function body to match before the dot - -- goes here - end - } - } - } -< - - -TREESITTER-POSTFIX-SNIPPET *luasnip-extras-treesitter-postfix-snippet* - -Instead of triggering a postfix-snippet when some pattern matches in front of -the trigger, it might be useful to match if some specific treesitter-nodes -surround/are in front of the trigger. While this functionality can also be -implemented by a cusutom `resolveExpandParams`, this helper simplifies the -common cases. - -This matching of treesitter-nodes can be done either - -- by providing a query and the name of the capture that should be in front of - the trigger (in most cases, the complete match, but requiring specific nodes - before/after the matched node may be useful as well), or -- by providing a function that manually walks the node-tree, and returns the - node in front of the trigger on success (for increased flexibility). - -A simple example, which surrounds the previous node’s text preceeding the -`.mv` with `std::move()` in cpp files, looks like: - ->lua - local treesitter_postfix = require("luasnip.extras.treesitter_postfix").treesitter_postfix - - treesitter_postfix({ - trig = ".mv", - matchTSNode = { - query = [[ - [ - (call_expression) - (identifier) - (template_function) - (subscript_expression) - (field_expression) - (user_defined_literal) - ] @prefix - ]] - query_lang = "cpp" - }, - },{ - f(function(_, parent) - local node_content = table.concat(parent.snippet.env.LS_TSMATCH, '\n') - local replaced_content = ("std::move(%s)"):format(node_content) - return vim.split(ret_str, "\n", { trimempty = false }) - end) - }) -< - -`LS_TSMATCH` is the treesitter-postfix equivalent to `POSTFIX_MATCH`, and is -populated with the match (in this case the text of a treesitter-node) in front -of the trigger. - -The arguments to `treesitter_postfix` are identical to the arguments to `s` but -with a few extra options. - -The first argument has to be a table, which defines at least `trig` and -`matchTSNode`. All keys from the regular `s` may be set here (except for -`wordTrig`, which will be ignored), and additionally the following: - -- `reparseBuffer`, `string?`: Sometimes the trigger may interfere with - treesitter recognizing queries correctly. With this option, the trigger may - either be removed from the live-buffer (`"live"`), from a copy of the buffer - (`"copy"`), or not at all (`nil`). -- `matchTSNode`: How to determine whether there is a matching node in front of - the cursor. There are two options: - - `fun(parser: LuaSnip.extra.TSParser, pos: { [1]: number, [2]: number }): LuaSnip.extra.NamedTSMatch?, TSNode? Manually determine whether there is a matching node that ends just before`pos`(the beginning of the trigger). Return`nil,nil`if there is no match, otherwise first return a table mapping names to nodes (the text, position and type of these will be provided via`snip.env`), and second the node that is the matched node. - - `LuaSnip.extra.MatchTSNodeOpts`, which represents a query and provides all - captures of the matched pattern in `NamedTSMatch`. It contains the following - options: - - `query`, `string`: The query, in textual form. - - `query_name`, `string`: The name of the runtime-query to be used (passed - to `query.get()`), defaults to `"luasnip"` (so one could create a - file which only contains queries used by luasnip, like - `$CONFDIR/queries//luasnip.scm`, which might make sense to define - general concepts independent of a single snippet). - `query` and `query_name` are mutually exclusive, only one of both shall be - defined. - - `query_lang`, `string`: The language of the query. This is the only - required parameter to this function, since there’s no sufficiently - straightforward way to determine the language of the query for us. - Consider using `extend_override` to define a `ts_postfix`-function that - automatically fills in the language for the filetype of the snippet-file. - - `match_captures`, `string|string[]`: The capture(s) to use for determining - the actual prefix (so the node that should be immediately in front of the - trigger). This defaults to just `"prefix"`. - - `select`, `string?|fun(): LuaSnip.extra.MatchSelector`: Since there may be - multiple matching captures in front of the cursor, there has to be some - way to select the node that will actually be used. - If this is a string, it has to be one of "any", "shortest", or "longest", - which mean that any, the shortest, or the longest match is used. - If it is a function, it must return a table with two fields, `record` and - `retrieve`. `record` is called with a TSMatch and a potential node for the - ts-match, and may return `true` to abort the selection-procedure. - `retrieve` must return either a TSMatch-TSNode-tuple (which is used as the - match) or `nil`, to signify that there is no match. - `lua/luasnip/extras/_treesitter.lua` contains the table - `builtin_tsnode_selectors`, which contains the implementations for - any/shortest/longest, which can be used as examples for more complicated - custom-selectors. - -The text of the matched node can be accessed as `snip.env.LS_TSMATCH`. The text -of the nodes returned as `NamedTSMatch` can be accessed as -`snip.env.LS_TSCAPTURE_`, and their range and type as -`snip.env.LS_TSDATA..range/type` (where range is a tuple -of row-col-tuples, both 0-indexed). - -For a query like - ->scm - (function_declaration - name: (identifier) @fname - parameters: (parameters) @params - body: (block) @body - ) @prefix -< - -matched against - ->lua - function add(a, b) - return a + b - end -< - -`snip.env` would contain: - -- `LS_TSMATCH`: `{ "function add(a, b)", "\treturn a + b", "end" }` -- `LS_TSDATA`: - >lua - { - body = { - range = { { 1, 1 }, { 1, 13 } }, - type = "block" - }, - fname = { - range = { { 0, 9 }, { 0, 12 } }, - type = "identifier" - }, - params = { - range = { { 0, 12 }, { 0, 18 } }, - type = "parameters" - }, - prefix = { - range = { { 0, 0 }, { 2, 3 } }, - type = "function_declaration" - } - } - < -- `LS_TSCAPTURE_FNAME`: `{ "add" }` -- `LS_TSCAPTURE_PARAMS`: `{ "(a, b)" }` -- `LS_TSCAPTURE_BODY`: `{ "return a + b" }` -- `LS_TSCAPTURE_PREFIX`: `{ "function add(a, b)", "\treturn a + b", "end" }` - -(note that all variables containing text of nodes are string-arrays, one entry -for each line) - -There is one important caveat when accessing `LS_TSDATA` in -function/dynamicNodes: It won’t contain the values as specified here while -generating docstrings (in fact, it won’t even be a table). Since docstrings -have to be generated without any runtime-information, we just have to provide -dummy-data in `env`, which will be some kind of string related to the name of -the env-variable. Since the structure of `LS_TSDATA` obviously does not fit -that model, we can’t really handle it in a nice way (at least yet). So, for -now, best include a check like `local static_evaluation = type(env.LS_TSDATA) -== "string"`, and behave accordingly if `static_evaluation` is true (for -example, return some value tailored for displaying it in a docstring). - -One more example, which actually uses a few captures: - ->lua - ts_post({ - matchTSNode = { - query = [[ - (function_declaration - name: (identifier) @fname - parameters: (parameters) @params - body: (block) @body - ) @prefix - ]], - query_lang = "lua", - }, - trig = ".var" - }, fmt([[ - local {} = function{} - {} - end - ]], { - l(l.LS_TSCAPTURE_FNAME), - l(l.LS_TSCAPTURE_PARAMS), - l(l.LS_TSCAPTURE_BODY), - })) -< - -The module `luasnip.extras.treesitter_postfix` contains a few functions that -may be useful for creating more efficient ts-postfix-snippets. Nested in -`builtin.tsnode_matcher` are: - -- `fun find_topmost_types(types: string[]): MatchTSNodeFunc`: Generates - a `LuaSnip.extra.MatchTSNodeFunc` which returns the last parent whose type - is in `types`. -- `fun find_first_types(types: string[]): MatchTSNodeFunc`: Similar to - `find_topmost_types`, only this one matches the first parent whose type is in - types. -- `find_nth_parent(n: number): MatchTSNodeFunc`: Simply matches the `n`-th - parent of the innermost node infront of the trigger. - -With `find_topmost_types`, the first example can be implemented more -efficiently (without needing a whole query): - ->lua - local postfix_builtin = require("luasnip.extras.treesitter_postfix").builtin - - ls.add_snippets("all", { - ts_post({ - matchTSNode = postfix_builtin.tsnode_matcher.find_topmost_types({ - "call_expression", - "identifier", - "template_function", - "subscript_expression", - "field_expression", - "user_defined_literal" - }), - trig = ".mv" - }, { - l(l_str.format("std::move(%s)", l.LS_TSMATCH)) - }) - }, {key = "asdf"}) -< - - -SNIPPET LIST *luasnip-extras-snippet-list* - ->lua - local sl = require("luasnip.extras.snippet_list") -< - -Makes an `open` function available to use to open currently available snippets -in a different buffer/window/tab. - -`sl.open(opts:table|nil)` - -- `opts`: optional arguments: - - `snip_info`: `snip_info(snippet) -> table representation of snippet` - - `printer`: `printer(snippets:table) -> any` - - `display`: `display(snippets:any)` - -Benefits include: syntax highlighting, searching, and customizability. - -Simple Example: - ->lua - sl.open() -< - -Customization Examples: - ->lua - -- making our own snip_info - local function snip_info(snippet) - return { name = snippet.name } - end - - -- using it - sl.open({snip_info = snip_info}) -< - ->lua - -- making our own printer - local function printer(snippets) - local res = "" - - for ft, snips in pairs(snippets) do - res = res .. ft .. "\n" - for _, snip in pairs(snips) do - res = res .. " " .. "Name: " .. snip.name .. "\n" - res = res .. " " .. "Desc: " .. snip.description[1] .. "\n" - res = res .. " " .. "Trigger: " .. snip.trigger .. "\n" - res = res .. " ----" .. "\n" - end - end - - return res - end - - - -- using it - sl.open({printer = printer}) -< - ->lua - -- making our own display - local function display(printer_result) - -- right vertical split - vim.cmd("botright vnew") - - -- get buf and win handle - local buf = vim.api.nvim_get_current_buf() - local win = vim.api.nvim_get_current_win() - - -- setting window and buffer options - vim.api.nvim_win_set_option(win, "foldmethod", "manual") - vim.api.nvim_buf_set_option(buf, "filetype", "javascript") - - vim.api.nvim_buf_set_option(buf, "buftype", "nofile") - vim.api.nvim_buf_set_option(buf, "bufhidden", "wipe") - vim.api.nvim_buf_set_option(buf, "buflisted", false) - - vim.api.nvim_buf_set_name(buf, "Custom Display buf " .. buf) - - -- dump snippets - local replacement = vim.split(printer_result) - vim.api.nvim_buf_set_lines(buf, 0, 0, false, replacement) - end - - -- using it - sl.open({display = display}) -< - -There is a **caveat** with implementing your own printer and/or display -function. The **default** behavior for the printer function is to return a -string representation of the snippets. The display function uses the results -from the printer function, therefore by **default** the display function is -expecting that result to be a string. - -However, this doesn’t have to be the case. For example, you can implement -your own printer function that returns a table representation of the snippets -**but** you would have to then implement your own display function or some -other function in order to return the result as a string. - -An `options` table, which has some core functionality that can be used to -customize 'common' settings, is provided. - -- `sl.options`: options table: - - `display`: `display(opts:table|nil) -> function(printer_result:string)` - -You can see from the example above that making a custom display is a fairly -involved process. What if you just wanted to change a buffer option like the -name or just the filetype? This is where `sl.options.display` comes in. It -allows you to customize buffer and window options while keeping the default -behavior. - -`sl.options.display(opts:table|nil) -> function(printer_result:string)` - -- `opts`: optional arguments: - - `win_opts`: `table which has a {window_option = value} form` - - `buf_opts`: `table which has a {buffer_option = value} form` - - `get_name`: `get_name(buf) -> string` - -Let’s recreate the custom display example above: - ->lua - -- keeping the default display behavior but modifying window/buffer - local modified_default_display = sl.options.display({ - buf_opts = {filetype = "javascript"}, - win_opts = {foldmethod = "manual"}, - get_name = function(buf) return "Custom Display buf " .. buf end - }) - - -- using it - sl.open({display = modified_default_display}) -< - - -SNIPPET LOCATION *luasnip-extras-snippet-location* - -This module can consume a snippets |luasnip-source|, more specifically, jump to -the location referred by it. This is primarily implemented for snippet which -got their source from one of the loaders, but might also work for snippets -where the source was set manually. - -`require("luasnip.extras.snip_location")`: - -- `snip_location.jump_to_snippet(snip, opts)` - Jump to the definition of `snip`. - - `snip`: a snippet with attached source-data. - - `opts`: `nil|table`, optional arguments, valid keys are: - - `hl_duration_ms`: `number`, duration for which the definition should be highlighted, - in milliseconds. 0 disables the highlight. - - `edit_fn`: `function(file)`, this function will be called with the file - the snippet is located in, and is responsible for jumping to it. - We assume that after it has returned, the current buffer contains `file`. -- `snip_location.jump_to_active_snippet(opts)` - Jump to definition of active snippet. - - `opts`: `nil|table`, accepts the same keys as the `opts`-parameter of - `jump_to_snippet`. - - -============================================================================== -17. Extend Decorator *luasnip-extend-decorator* - -Most of luasnip’s functions have some arguments to control their behaviour. -Examples include `s`, where `wordTrig`, `regTrig`, … can be set in the first -argument to the function, or `fmt`, where the delimiter can be set in the third -argument. This is all good and well, but if these functions are often used with -non-default settings, it can become cumbersome to always explicitly set them. - -This is where the `extend_decorator` comes in: it can be used to create -decorated functions which always extend the arguments passed directly with -other previously defined ones. - -An example: - ->lua - local fmt = require("luasnip.extras.fmt").fmt - - fmt("{}", {i(1)}) -- -> list of nodes, containing just the i(1). - - -- when authoring snippets for some filetype where `{` and `}` are common, they - -- would always have to be escaped in the format-string. It might be preferable - -- to use other delimiters, like `<` and `>`. - - fmt("<>", {i(1)}, {delimiters = "<>"}) -- -> same as above. - - -- but it's quite annoying to always pass the `{delimiters = "<>"}`. - - -- with extend_decorator: - local fmt_angle = ls.extend_decorator.apply(fmt, {delimiters = "<>"}) - fmt_angle("<>", {i(1)}) -- -> same as above. - - -- the same also works with other functions provided by luasnip, for example all - -- node/snippet-constructors and `parse_snippet`. -< - -`extend_decorator.apply(fn, ...)` requires that `fn` is previously registered -via `extend_decorator.register`. (This is not limited to LuaSnip’s functions; -although, for usage outside of LuaSnip, best copy the source file: -`/lua/luasnip/util/extend_decorator.lua`). - -`register(fn, ...)`: - -- `fn`: the function. -- `...`: any number of tables. Each specifies how to extend an argument of `fn`. - The tables accept: - - arg_indx, `number` (required): the position of the parameter to override. - - extend, `fn(arg, extend_value) -> effective_arg` (optional): this function - is used to extend the args passed to the decorated function. - It defaults to a function which just extends the the arg-table with the - extend table (accepts `nil`). - This extend behaviour is adaptable to accomodate `s`, where the first - argument may be string or table. - -`apply(fn, ...) -> decorated_fn`: - -- `fn`: the function to decorate. -- `...`: The values to extend with. These should match the descriptions passed - in `register` (the argument first passed to `register` will be extended with - the first value passed here). - -One more example for registering a new function: - ->lua - local function somefn(arg1, arg2, opts1, opts2) - -- not important - end - - -- note the reversed arg_indx!! - extend_decorator.register(somefn, {arg_indx=4}, {arg_indx=3}) - local extended = extend_decorator.apply(somefn, - {key = "opts2 is extended with this"}, - {key = "and opts1 with this"}) - extended(...) -< - - -============================================================================== -18. LSP-Snippets *luasnip-lsp-snippets* - -LuaSnip is capable of parsing LSP-style snippets using -`ls.parser.parse_snippet(context, snippet_string, opts)`: - ->lua - ls.parser.parse_snippet({trig = "lsp"}, "$1 is ${2|hard,easy,challenging|}") -< - -`context` can be: - `string|table`: treated like the first argument to `ls.s`, -`parse_snippet` returns a snippet. - `number`: `parse_snippet` returns a -snippetNode, with the position `context`. - `nil`: `parse_snippet` returns a -flat table of nodes. This can be used like `fmt`. - -Nested placeholders(`"${1:this is ${2:nested}}"`) will be turned into -choiceNodes with: - the given snippet(`"this is ${1:nested}"`) and - an empty -insertNode - -This behaviour can be modified by changing `parser_nested_assembler` in -`ls.setup()`. - -LuaSnip will also modify some snippets that it is incapable of representing -accurately: - -- if the `$0` is a placeholder with something other than just text inside -- if the `$0` is a choice -- if the `$0` is not an immediate child of the snippet (it could be inside a - placeholder: `"${1: $0 }"`) - -To remedy those incompatibilities, the invalid `$0` will be replaced with a -tabstop/placeholder/choice which will be visited just before the new `$0`. This -new `$0` will be inserted at the (textually) earliest valid position behind the -invalid `$0`. - -`opts` can contain the following keys: - `trim_empty`: boolean, remove empty -lines from the snippet. Default true. - `dedent`: boolean, remove common indent -from the snippet’s lines. Default true. - -Both `trim_empty` and `dedent` will be disabled for snippets parsed via -`ls.lsp_expand`: it might prevent correct expansion of snippets sent by lsp. - - -SNIPMATE PARSER *luasnip-lsp-snippets-snipmate-parser* - -It is furthermore possible to parse SnipMate snippets (this includes support -for vimscript-evaluation!!) - -SnipMate snippets need to be parsed with a different function, -`ls.parser.parse_snipmate`: - ->lua - ls.parser.parse_snipmate("year", "The year is `strftime('%Y')`") -< - -`parse_snipmate` accepts the same arguments as `parse_snippet`, only the -snippet body is parsed differently. - - -TRANSFORMATIONS *luasnip-lsp-snippets-transformations* - -To apply Variable/Placeholder-transformations -, -luasnip needs to apply ECMAScript regexes. This is implemented by relying on -`jsregexp` . - -The easiest (but potentially error-prone) way to install it is by calling `make -install_jsregexp` in the repo root. - -This process can be automated by `packer.nvim`: - ->lua - use { "L3MON4D3/LuaSnip", run = "make install_jsregexp" } -< - -If this fails, first open an issue :P, and then try installing the -`jsregexp`-luarock. This is also possible via `packer.nvim`, although actual -usage may require a small workaround, see here - or here -. - -Alternatively, `jsregexp` can be cloned locally, `make`d, and the resulting -`jsregexp.so` placed in some place where nvim can find it (probably -`~/.config/nvim/lua/`). - -If `jsregexp` is not available, transformations are replaced by a simple copy. - - -============================================================================== -19. Variables *luasnip-variables* - -All `TM_something`-variables are supported with two additions: `LS_SELECT_RAW` -and `LS_SELECT_DEDENT`. These were introduced because `TM_SELECTED_TEXT` is -designed to be compatible with VSCode’s behavior, which can be -counterintuitive when the snippet can be expanded at places other than the -point where selection started (or when doing transformations on selected text). -Besides those we also provide `LS_TRIGGER` which contains the trigger of the -snippet, and `LS_CAPTURE_n` (where n is a positive integer) that contains the -n-th capture when using a regex with capture groups as `trig` in the snippet -definition. - -All variables can be used outside of lsp-parsed snippets as their values are -stored in a snippets’ `snip.env`-table: - ->lua - s("selected_text", f(function(args, snip) - local res, env = {}, snip.env - table.insert(res, "Selected Text (current line is " .. env.TM_LINE_NUMBER .. "):") - for _, ele in ipairs(env.LS_SELECT_RAW) do table.insert(res, ele) end - return res - end, {})) -< - -To use any `*SELECT*` variable, the `store_selection_keys` must be set via -`require("luasnip").config.setup({store_selection_keys=""})`. In this -case, hitting `` while in visual mode will populate the `*SELECT*`-vars -for the next snippet and then clear them. - - -ENVIRONMENT NAMESPACES *luasnip-variables-environment-namespaces* - -You can also add your own variables by using the `ls.env_namespace(name, opts)` -where: - -- `name`: `string` the names the namespace, can’t contain the character “_” -- `opts` is a table containing (in every case `EnvVal` is the same as `string|list[string]`: - - `vars`: `(fn(name:string)->EnvVal) | map[string, EnvVal]` - Is a function that receives a string and returns a value for the var with that name - or a table from var name to a value - (in this case, if the value is a function it will be executed lazily once per snippet expansion). - - `init`: `fn(info: table)->map[string, EnvVal]` Returns - a table of variables that will set to the environment of the snippet on expansion, - use this for vars that have to be calculated in that moment or that depend on each other. - The `info` table argument contains `pos` (0-based position of the cursor on expansion), - the `trigger` of the snippet and the `captures` list. - - `eager`: `list[string]` names of variables that will be taken from `vars` and appended eagerly (like those in init) - - `multiline_vars`: `(fn(name:string)->bool)|map[sting, bool]|bool|string[]` Says if certain vars are a table or just a string, - can be a function that get’s the name of the var and returns true if the var is a key, - a list of vars that are tables or a boolean for the full namespace, it’s false by default. Refer to - issue#510 for more information. - -The four fields of `opts` are optional but you need to provide either `init` or -`vars`, and `eager` can’t be without `vars`. Also, you can’t use namespaces -that override default vars. - -A simple example to make it more clear: - ->lua - local function random_lang() - return ({"LUA", "VIML", "VIML9"})[math.floor(math.random()/2 + 1.5)] - end - - ls.env_namespace("MY", {vars={ NAME="LuaSnip", LANG=random_lang }}) - - -- then you can use $MY_NAME and $MY_LANG in your snippets - - ls.env_namespace("SYS", {vars=os.getenv, eager={"HOME"}}) - - -- then you can use $SYS_HOME which was eagerly initialized but also $SYS_USER (or any other system environment var) in your snippets - - lsp.env_namespace("POS", {init=function(info) return {VAL=vim.inspect(info.pos)} end}) - - -- then you can use $POS_VAL in your snippets - - s("custom_env", d(1, function(args, parent) - local env = parent.snippet.env - return sn(nil, t { - "NAME: " .. env.MY_NAME, - "LANG: " .. env.MY_LANG, - "HOME: " .. env.SYS_HOME, - "USER: " .. env.SYS_USER, - "VAL: " .. env.POS_VAL - }) - end, {})) -< - - -LSP-VARIABLES *luasnip-variables-lsp-variables* - -All variables, even ones added via `env_namespace`, can be accessed in LSP -snippets as `$VAR_NAME`. - -The lsp-spec states: - ------------------------------------------------------------------------------- -With `$name` or `${name:default}` you can insert the value of a variable. When -a variable isn’t set, its default or the empty string is inserted. When a -variable is unknown (that is, its name isn’t defined) the name of the -variable is inserted and it is transformed into a placeholder. - ------------------------------------------------------------------------------- -The above necessiates a differentiation between `unknown` and `unset` -variables: - -For LuaSnip, a variable `VARNAME` is `unknown` when `env.VARNAME` returns `nil` -and `unset` if it returns an empty string. - -Consider this when adding env-variables which might be used in LSP snippets. - - -============================================================================== -20. Loaders *luasnip-loaders* - -Luasnip is capable of loading snippets from different formats, including both -the well-established VSCode and SnipMate format, as well as plain Lua files for -snippets written in Lua. - -All loaders (except the vscode-standalone-loader) share a similar interface: -`require("luasnip.loaders.from_{vscode,snipmate,lua}").{lazy_,}load(opts:table|nil)` - -where `opts` can contain the following keys: - -- `paths`: List of paths to load. Can be a table, or a single - comma-separated string. - The paths may begin with `~/` or `./` to indicate that the path is - relative to your `$HOME` or to the directory where your `$MYVIMRC` resides - (useful to add your snippets). - If not set, `runtimepath` is searched for - directories that contain snippets. This procedure differs slightly for - each loader: - - `lua`: the snippet-library has to be in a directory named - `"luasnippets"`. - - `snipmate`: similar to lua, but the directory has to be `"snippets"`. - - `vscode`: any directory in `runtimepath` that contains a - `package.json` contributing snippets. -- `lazy_paths`: behaves essentially like `paths`, with two exceptions: if it is - `nil`, it does not default to `runtimepath`, and the paths listed here do not - need to exist, and will be loaded on creation. - LuaSnip will do its best to determine the path that this should resolve to, - but since the resolving we do is not very sophisticated it may produce - incorrect paths. Definitely check the log if snippets are not loaded as - expected. -- `exclude`: List of languages to exclude, empty by default. -- `include`: List of languages to include, includes everything by default. -- `{override,default}_priority`: These keys are passed straight to the - `add_snippets`-calls (documented in |luasnip-api|) and can therefore change the - priority of snippets loaded from some colletion (or, in combination with - `{in,ex}clude`, only some of its snippets). -- `fs_event_providers`: `table?`, specifies which mechanisms - should be used to watch files for updates/creation. - If `autocmd` is set to `true`, a `BufWritePost`-hook watches files of this - collection, if `libuv` is set, the file-watcher-api exposed by libuv is used - to watch for updates. - Use `libuv` if you want snippets to update from other neovim-instances, and - `autocmd` if the collection resides on a filesystem where the libuv-watchers - may not work correctly. Or, of course, just enable both :D - By default, only `autocmd` is enabled. - -While `load` will immediately load the snippets, `lazy_load` will defer loading -until the snippets are actually needed (whenever a new buffer is created, or -the filetype is changed luasnip actually loads `lazy_load`ed snippets for the -filetypes associated with this buffer. This association can be changed by -customizing `load_ft_func` in `setup`: the option takes a function that, passed -a `bufnr`, returns the filetypes that should be loaded (`fn(bufnr) -> filetypes -(string[])`)). - -All of the loaders support reloading, so simply editing any file contributing -snippets will reload its snippets (according to `fs_event_providers` in the -instance where the file was edited, or in other instances as well). - -As an alternative (or addition) to automatic reloading, luasnip can also -process manual updates to files: Call -`require("luasnip.loaders").reload_file(path)` to reload the file at `path`. -This may be useful when the collection is controlled by some other plugin, or -when enabling the other reload-mechanisms is for some reason undesirable -(performance? minimalism?). - -For easy editing of these files, LuaSnip provides a `vim.ui.select`-based -dialog (|luasnip-loaders-edit_snippets|) where first the filetype, and then the -file can be selected. - - -SNIPPET-SPECIFIC FILETYPES *luasnip-loaders-snippet-specific-filetypes* - -Some loaders (vscode,lua) support giving snippets generated in some file their -own filetype (vscode via `scope`, lua via the underlying `filetype`-option for -snippets). These snippet-specific filetypes are not considered when determining -which files to `lazy_load` for some filetype, this is exclusively determined by -the `language` associated with a file in vscodes’ `package.json`, and the -file/directory-name in lua. - -- This can be resolved relatively easily in vscode, where the `language` - advertised in `package.json` can just be a superset of the `scope`s in the file. -- Another simplistic solution is to set the language to `all` (in lua, it might - make sense to create a directory `luasnippets/all/*.lua` to group these files - together). -- Another approach is to modify `load_ft_func` to load a custom filetype if the - snippets should be activated, and store the snippets in a file for that - filetype. This can be used to group snippets by e.g. framework, and load them - once a file belonging to such a framework is edited. - -**Example**: `react.lua` - ->lua - return { - s({filetype = "css", trig = ...}, ...), - s({filetype = "html", trig = ...}, ...), - s({filetype = "js", trig = ...}, ...), - } -< - -`luasnip_config.lua` - ->lua - load_ft_func = function(bufnr) - if "" then - -- will load `react.lua` for this buffer - return {"react"} - else - return require("luasnip.extras.filetype_functions").from_filetype_load - end - end -< - -See the |luasnip-troubleshooting-adding-snippets-loaders| section if one is -having issues adding snippets via loaders. - - -VS-CODE *luasnip-loaders-vs-code* - -As a reference on the structure of these snippet libraries, see -`friendly-snippets` . - -We support a small extension: snippets can contain LuaSnip-specific options in -the `luasnip`-table: - ->json - "example1": { - "prefix": "options", - "body": [ - "whoa! :O" - ], - "luasnip": { - "priority": 2000, - "autotrigger": true, - "wordTrig": false - } - } -< - -Files with the extension `jsonc` will be parsed as `jsonc`, json with comments -, while -`*.json` are parsed with a regular `json` parser, where comments are -disallowed. (the json-parser is a bit faster, so don’t default to `jsonc` if -it’s not necessary). - -**Example**: - -`~/.config/nvim/my_snippets/package.json`: - ->json - { - "name": "example-snippets", - "contributes": { - "snippets": [ - { - "language": [ - "all" - ], - "path": "./snippets/all.json" - }, - { - "language": [ - "lua" - ], - "path": "./lua.json" - } - ] - } - } -< - -`~/.config/nvim/my_snippets/snippets/all.json`: - ->json - { - "snip1": { - "prefix": "all1", - "body": [ - "expands? jumps? $1 $2 !" - ] - }, - "snip2": { - "prefix": "all2", - "body": [ - "multi $1", - "line $2", - "snippet$0" - ] - } - } -< - -`~/.config/nvim/my_snippets/lua.json`: - ->json - { - "snip1": { - "prefix": "lua", - "body": [ - "lualualua" - ] - } - } -< - -This collection can be loaded with any of - ->lua - -- don't pass any arguments, luasnip will find the collection because it is - -- (probably) in rtp. - require("luasnip.loaders.from_vscode").lazy_load() - -- specify the full path... - require("luasnip.loaders.from_vscode").lazy_load({paths = "~/.config/nvim/my_snippets"}) - -- or relative to the directory of $MYVIMRC - require("luasnip.loaders.from_vscode").load({paths = "./my_snippets"}) -< - - -STANDALONE ~ - -Beside snippet-libraries provided by packages, vscode also supports another -format which can be used for project-local snippets, or user-defined snippets, -`.code-snippets`. - -The layout of these files is almost identical to that of the package-provided -snippets, but there is one additional field supported in the -snippet-definitions, `scope`, with which the filetype of the snippet can be -set. If `scope` is not set, the snippet will be added to the global filetype -(`all`). - -`require("luasnip.loaders.from_vscode").load_standalone(opts)` - -- `opts`: `table`, can contain the following keys: - - `path`: `string`, Path to the `*.code-snippets`-file that should be loaded. - Just like the paths in `load`, this one can begin with a `"~/"` to be - relative to `$HOME`, and a `"./"` to be relative to the - neovim-config-directory. - - `{override,default}_priority`: These keys are passed straight to the - `add_snippets`-calls (documented in |luasnip-api|) and can be used to change - the priority of the loaded snippets. - - `lazy`: `boolean`, if it is set, the file does not have to exist when - `load_standalone` is called, and it will be loaded on creation. - `false` by default. - -**Example**: `a.code-snippets`: - ->jsonc - { - // a comment, since `.code-snippets` may contain jsonc. - "c/cpp-snippet": { - "prefix": [ - "trigger1", - "trigger2" - ], - "body": [ - "this is $1", - "my snippet $2" - ], - "description": "A description of the snippet.", - "scope": "c,cpp" - }, - "python-snippet": { - "prefix": "trig", - "body": [ - "this is $1", - "a different snippet $2" - ], - "description": "Another snippet-description.", - "scope": "python" - }, - "global snippet": { - "prefix": "trigg", - "body": [ - "this is $1", - "the last snippet $2" - ], - "description": "One last snippet-description.", - } - } -< - -This file can be loaded by calling - ->lua - require("luasnip.loaders.from_vscode").load_standalone({path = "a.code-snippets"}) -< - - -SNIPMATE *luasnip-loaders-snipmate* - -Luasnip does not support the full snipmate format: Only `./{ft}.snippets` and -`./{ft}/*.snippets` will be loaded. See honza/vim-snippets - for lots of examples. - -Like VSCode, the SnipMate format is also extended to make use of some of -LuaSnip’s more advanced capabilities: - ->snippets - priority 2000 - autosnippet options - whoa :O -< - -**Example**: - -`~/.config/nvim/snippets/c.snippets`: - ->snippets - # this is a comment - snippet c c-snippet - c! -< - -`~/.config/nvim/snippets/cpp.snippets`: - ->snippets - extends c - - snippet cpp cpp-snippet - cpp! -< - -This can, again, be loaded with any of - ->lua - require("luasnip.loaders.from_snipmate").load() - -- specify the full path... - require("luasnip.loaders.from_snipmate").lazy_load({paths = "~/.config/nvim/snippets"}) - -- or relative to the directory of $MYVIMRC - require("luasnip.loaders.from_snipmate").lazy_load({paths = "./snippets"}) -< - -Stuff to watch out for: - -- Using both `extends ` in `.snippets` and - `ls.filetype_extend("", {""})` leads to duplicate snippets. -- `${VISUAL}` will be replaced by `$TM_SELECTED_TEXT` to make the snippets - compatible with LuaSnip -- We do not implement eval using ` (backtick). This may be implemented in the - future. - - -LUA *luasnip-loaders-lua* - -Instead of adding all snippets via `add_snippets`, it’s possible to store -them in separate files and load all of those. The file-structure here is -exactly the supported snipmate-structure, e.g. `.lua` or `/*.lua` to -add snippets for the filetype ``. - -There are two ways to add snippets: - -- the files may return two lists of snippets, the snippets in the first are all - added as regular snippets, while the snippets in the second will be added as - autosnippets (both are the defaults, if a snippet defines a different - `snippetType`, that will have preference) -- snippets can also be appended to the global (only for these files - they are - not visible anywhere else) tables `ls_file_snippets` and - `ls_file_autosnippets`. This can be combined with a custom `snip_env` to define - and add snippets with one function call: - >lua - ls.setup({ - snip_env = { - s = function(...) - local snip = ls.s(...) - -- we can't just access the global `ls_file_snippets`, since it will be - -- resolved in the environment of the scope in which it was defined. - table.insert(getfenv(2).ls_file_snippets, snip) - end, - parse = function(...) - local snip = ls.parser.parse_snippet(...) - table.insert(getfenv(2).ls_file_snippets, snip) - end, - -- remaining definitions. - ... - }, - ... - }) - < - This is more flexible than the previous approach since the snippets don’t - have to be collected; they just have to be defined using the above `s` and - `parse`. - -As defining all of the snippet constructors (`s`, `c`, `t`, …) in every file -is rather cumbersome, LuaSnip will bring some globals into scope for executing -these files. By default, the names from `luasnip.config.snip_env` - -will be used, but it’s possible to customize them by setting `snip_env` in -`setup`. - -**Example**: - -`~/snippets/all.lua`: - ->lua - return { - s("trig", t("loaded!!")) - } -< - -`~/snippets/c.lua`: - ->lua - return { - s("ctrig", t("also loaded!!")) - }, { - s("autotrig", t("autotriggered, if enabled")) - } -< - -Load via - ->lua - require("luasnip.loaders.from_lua").load({paths = "~/snippets"}) -< - - -RELOADING WHEN EDITING REQUIRE’D FILES ~ - -While the lua-snippet-files will be reloaded on edit, this does not -automatically happen if a file the snippet-file depends on (eg. via `require`) -is changed. Since this still may still be desirable, there are two functions -exposed when a file is loaded by the lua-loader: `ls_tracked_dofile` and -`ls_tracked_dopackage`. They perform like `dofile` and (almost like) `require`, -but both register the loaded file internally as a dependency of the -snippet-file, so it can be reloaded when the loaded file is edited. As stated, -`ls_tracked_dofile` behaves exactly like `dofile`, but does the dependency-work -as well. `ls_tracked_dopackage` mimics `require` in that it does not take a -path, but a module-name like `"luasnip.loaders.from_lua"`, and then searches -the `runtimepath/lua`-directories, and path and cpath for the module. Unlike -`require`, the file will not be cached, since that would complicate the -reload-on-edit-behaviour. - - -EDIT_SNIPPETS *luasnip-loaders-edit_snippets* - -To easily edit snippets for the current session, the files loaded by any loader -can be quickly edited via -`require("luasnip.loaders").edit_snippet_files(opts:table|nil)` - -When called, it will open a `vim.ui.select`-dialog to select first a filetype, -and then (if there are multiple) the associated file to edit. - -`opts` contains four settings: - -- `ft_filter`: `fn(filetype:string) -> bool` Optionally filter initially listed - filetypes. `true` -> filetype will be listed, `false` -> not listed. Accepts - all filetypes by default. -- `format`: `fn(file:string, source_name:string) -> string|nil` `file` is simply - the path to the file, `source_name` is one of `"lua"`, `"snipmate"` or - `"vscode"`. If a string is returned, it is used as the title of the item, `nil` - on the other hand will filter out this item. The default simply replaces some - long strings (packer-path and config-path) in `file` with shorter, symbolic - names (`"$PLUGINS"`, `"$CONFIG"`), but this can be extended to - - filter files from some specific source/path - - more aggressively shorten paths using symbolic names, e.g. - `"$FRIENDLY_SNIPPETS"`. Example: hide the `*.lua` snippet files, and shorten - the path with `$LuaSnip`: - >lua - require "luasnip.loaders" .edit_snippet_files { - format = function(file, source_name) - if source_name == "lua" then return nil - else return file:gsub("/root/.config/nvim/luasnippets", "$LuaSnip") - end - end - } - < -- `edit`: `fn(file:string)` This function is supposed to open the file for - editing. The default is a simple `vim.cmd("edit " .. file)` (replace the - current buffer), but one could open the file in a split, a tab, or a floating - window, for example. -- `extend`: `fn(ft:string, ft_paths:string[]) -> (string,string)[]` This function - can be used to create additional choices for the file-selection. - - `ft`: The filetype snippet-files are queried for. - - `ft_paths`: list of paths to the known snippet files. - The function should return a list of `(string,string)`-tuples. The first of - each pair is the label that will appear in the selection-prompt, and the second - is the path that will be passed to the `edit()` function if that item was - selected. - This can be used to create a new snippet file for the current filetype: - >lua - require("luasnip.loaders").edit_snippet_files { - extend = function(ft, paths) - if #paths == 0 then - return { - { "$CONFIG/" .. ft .. ".snippets", - string.format("%s/%s.snippets", , ft) } - } - end - - return {} - end - } - < - -One comfortable way to call this function is registering it as a command: - ->vim - command! LuaSnipEdit :lua require("luasnip.loaders").edit_snippet_files() -< - - -============================================================================== -21. SnippetProxy *luasnip-snippetproxy* - -`SnippetProxy` is used internally to alleviate the upfront cost of loading -snippets from e.g. a SnipMate library or a VSCode package. This is achieved by -only parsing the snippet on expansion, not immediately after reading it from -some file. `SnippetProxy` may also be used from Lua directly to get the same -benefits: - -This will parse the snippet on startup: - ->lua - ls.parser.parse_snippet("trig", "a snippet $1!") -< - -while this will parse the snippet upon expansion: - ->lua - local sp = require("luasnip.nodes.snippetProxy") - sp("trig", "a snippet $1") -< - -`sp(context, body, opts) -> snippetProxy` - -- `context`: exactly the same as the first argument passed to `ls.s`. -- `body`: the snippet body. -- `opts`: accepts the same `opts` as `ls.s`, with some additions: - - `parse_fn`: the function for parsing the snippet. Defaults to - `ls.parser.parse_snippet` (the parser for LSP snippets), an alternative is - the parser for SnipMate snippets (`ls.parser.parse_snipmate`). - - -============================================================================== -22. ext_opts *luasnip-ext_opts* - -`ext_opts` can be used to set the `opts` (see `nvim_buf_set_extmark`) of the -extmarks used for marking node positions, either globally, per snippet or per -node. This means that they allow highlighting the text inside of nodes, or -adding virtual text to the line the node begins on. - -This is an example for the `node_ext_opts` used to set `ext_opts` of single -nodes: - ->lua - local ext_opts = { - -- these ext_opts are applied when the node is active (e.g. it has been - -- jumped into, and not out yet). - active = - -- this is the table actually passed to `nvim_buf_set_extmark`. - { - -- highlight the text inside the node red. - hl_group = "GruvboxRed" - }, - -- these ext_opts are applied when the node is not active, but - -- the snippet still is. - passive = { - -- add virtual text on the line of the node, behind all text. - virt_text = {{"virtual text!!", "GruvboxBlue"}} - }, - -- visited or unvisited are applied when a node was/was not jumped into. - visited = { - hl_group = "GruvboxBlue" - }, - unvisited = { - hl_group = "GruvboxGreen" - }, - -- and these are applied when both the node and the snippet are inactive. - snippet_passive = {} - } - - s("trig", { - i(1, "text1", { - node_ext_opts = ext_opts - }), - i(2, "text2", { - node_ext_opts = ext_opts - }) - }) -< - -In the above example, the text inside the insertNodes is higlighted in green if -they were not yet visited, in blue once they were, and red while they are. The -virtual text "virtual text!!" is visible as long as the snippet is active. - -To make defining `ext_opts` less verbose, more specific states inherit from -less specific ones: - -- `passive` inherits from `snippet_passive` -- `visited` and `unvisited` from `passive` -- `active` from `visited` - -To disable a key from a less specific state, it has to be explicitly set to its -default, e.g. to disable highlighting inherited from `passive` when the node -is `active`, `hl_group` should be set to `None`. - ------------------------------------------------------------------------------- -As stated earlier, these `ext_opts` can also be applied globally or for an -entire snippet. For this, it’s necessary to specify which kind of node a -given set of `ext_opts` should be applied to: - ->lua - local types = require("luasnip.util.types") - - ls.setup({ - ext_opts = { - [types.insertNode] = { - active = {...}, - visited = {...}, - passive = {...}, - snippet_passive = {...} - }, - [types.choiceNode] = { - active = {...}, - unvisited = {...} - }, - [types.snippet] = { - passive = {...} - } - } - }) -< - -The above applies the given `ext_opts` to all nodes of these types, in all -snippets. - ->lua - local types = require("luasnip.util.types") - - s("trig", { i(1, "text1"), i(2, "text2") }, { - child_ext_opts = { - [types.insertNode] = { - passive = { - hl_group = "GruvboxAqua" - } - } - } - }) -< - -However, the `ext_opts` here are only applied to the `insertNodes` inside this -snippet. - ------------------------------------------------------------------------------- -By default, the `ext_opts` actually used for a node are created by extending -the `node_ext_opts` with the `effective_child_ext_opts[node.type]` of the -parent, which are in turn the parent’s `child_ext_opts` extended with the -global `ext_opts` (those set `ls.setup`). - -It’s possible to prevent both of these merges by passing -`merge_node/child_ext_opts=false` to the snippet/node-opts: - ->lua - ls.setup({ - ext_opts = { - [types.insertNode] = { - active = {...} - } - } - }) - - s("trig", { - i(1, "text1", { - node_ext_opts = { - active = {...} - }, - merge_node_ext_opts = false - }), - i(2, "text2") - }, { - child_ext_opts = { - [types.insertNode] = { - passive = {...} - } - }, - merge_child_ext_opts = false - }) -< - ------------------------------------------------------------------------------- -The `hl_group` of the global `ext_opts` can also be set via standard highlight -groups: - ->lua - vim.cmd("hi link LuasnipInsertNodePassive GruvboxRed") - vim.cmd("hi link LuasnipSnippetPassive GruvboxBlue") - - -- needs to be called for resolving the effective ext_opts. - ls.setup({}) -< - -The names for the used highlight groups are -`"Luasnip{Passive,Active,SnippetPassive}"`, where `` can be any -kind of node in PascalCase (or "Snippet"). - ------------------------------------------------------------------------------- -One problem that might arise when nested nodes are highlighted is that the -highlight of inner nodes should be visible, e.g. above that of nodes they are -nested inside. - -This can be controlled using the `priority`-key in `ext_opts`. In -`nvim_buf_set_extmark`, that value is an absolute value, but here it is -relative to some base-priority, which is increased for each nesting level of -snippet(Nodes)s. - -Both the initial base-priority and its’ increase and can be controlled using -`ext_base_prio` and `ext_prio_increase`: - ->lua - ls.setup({ - ext_opts = { - [types.insertNode] = { - active = { - hl_group = "GruvboxBlue", - -- the priorities should be \in [0, ext_prio_increase). - priority = 1 - } - }, - [types.choiceNode] = { - active = { - hl_group = "GruvboxRed" - -- priority defaults to 0 - } - } - } - ext_base_prio = 200, - ext_prio_increase = 2 - }) -< - -Here the highlight of an insertNode nested directly inside a choiceNode is -always visible on top of it. - - -============================================================================== -23. Docstrings *luasnip-docstrings* - -Snippet docstrings can be queried using `snippet:get_docstring()`. The function -evaluates the snippet as if it was expanded regularly, which can be problematic -if e.g. a dynamicNode in the snippet relies on inputs other than the argument -nodes. `snip.env` and `snip.captures` are populated with the names of the -queried variable and the index of the capture respectively -(`snip.env.TM_SELECTED_TEXT` -> `'$TM_SELECTED_TEXT'`, `snip.captures[1]` -> -`'$CAPTURES1'`). Although this leads to more expressive docstrings, it can -cause errors in functions that e.g. rely on a capture being a number: - ->lua - s({trig = "(%d)", regTrig = true}, { - f(function(args, snip) - return string.rep("repeatme ", tonumber(snip.captures[1])) - end, {}) - }) -< - -This snippet works fine because `snippet.captures[1]` is always a number. -During docstring generation, however, `snippet.captures[1]` is `'$CAPTURES1'`, -which will cause an error in the functionNode. Issues with `snippet.captures` -can be prevented by specifying `docTrig` during snippet-definition: - ->lua - s({trig = "(%d)", regTrig = true, docTrig = "3"}, { - f(function(args, snip) - return string.rep("repeatme ", tonumber(snip.captures[1])) - end, {}) - }) -< - -`snippet.captures` and `snippet.trigger` will be populated as if actually -triggered with `3`. - -Other issues will have to be handled manually by checking the contents of e.g. -`snip.env` or predefining the docstring for the snippet: - ->lua - s({trig = "(%d)", regTrig = true, docstring = "repeatmerepeatmerepeatme"}, { - f(function(args, snip) - return string.rep("repeatme ", tonumber(snip.captures[1])) - end, {}) - }) -< - -Refer to #515 for a better -example to understand `docTrig` and `docstring`. - - -============================================================================== -24. Docstring-Cache *luasnip-docstring-cache* - -Although generation of docstrings is pretty fast, it’s preferable to not redo -it as long as the snippets haven’t changed. Using -`ls.store_snippet_docstrings(snippets)` and its counterpart -`ls.load_snippet_docstrings(snippets)`, they may be serialized from or -deserialized into the snippets. Both functions accept a table structsured like -this: `{ft1={snippets}, ft2={snippets}}`. Such a table containing all snippets -can be obtained via `ls.get_snippets()`. `load` should be called before any of -the `loader`-functions as snippets loaded from VSCode style packages already -have their `docstring` set (`docstrings` wouldn’t be overwritten, but -there’d be unnecessary calls). - -The cache is located at `stdpath("cache")/luasnip/docstrings.json` (probably -`~/.cache/nvim/luasnip/docstrings.json`). - - -============================================================================== -25. Events *luasnip-events* - -Events can be used to react to some action inside snippets. These callbacks can -be defined per snippet (`callbacks`-key in snippet constructor), per-node by -passing them as `node_callbacks` in `node_opts`, or globally (autocommand). - -`callbacks`: `fn(node[, event_args]) -> event_res` All callbacks receive the -`node` associated with the event and event-specific optional arguments, -`event_args`. `event_res` is only used in one event, `pre_expand`, where some -properties of the snippet can be changed. If multiple callbacks return -`event_res`, we only guarantee that one of them will be effective, not all of -them. - -`autocommand`: Luasnip uses `User`-events. Autocommands for these can be -registered using - ->vim - au User SomeUserEvent echom "SomeUserEvent was triggered" -< - -or - ->lua - vim.api.nvim_create_autocommand("User", { - patter = "SomeUserEvent", - command = "echom SomeUserEvent was triggered" - }) -< - -The node and `event_args` can be accessed through `require("luasnip").session`: - -- `node`: `session.event_node` -- `event_args`: `session.event_args` - -**Events**: - -- `enter/leave`: Called when a node is entered/left (for example when jumping - around in a snippet). - `User-event`: `"Luasnip{Enter,Leave}"`, with `` in - PascalCase, e.g. `InsertNode` or `DynamicNode`. - `event_args`: none -- `change_choice`: When the active choice in a choiceNode is changed. - `User-event`: `"LuasnipChangeChoice"` - `event_args`: none -- `pre_expand`: Called before a snippet is expanded. Modifying text is allowed, - the expand-position will be adjusted so the snippet expands at the same - position relative to existing text. - `User-event`: `"LuasnipPreExpand"` - `event_args`: - - `expand_pos`: `{, }`, position at which the snippet will be - expanded. `` and `` are both 0-indexed. - `event_res`: - - `env_override`: `map string->(string[]|string)`, override or extend the - snippet’s environment (`snip.env`). - -A pretty useless, beyond serving as an example here, application of these would -be printing e.g. the node’s text after entering: - ->lua - vim.api.nvim_create_autocmd("User", { - pattern = "LuasnipInsertNodeEnter", - callback = function() - local node = require("luasnip").session.event_node - print(table.concat(node:get_text(), "\n")) - end - }) -< - -or some information about expansions: - ->lua - vim.api.nvim_create_autocmd("User", { - pattern = "LuasnipPreExpand", - callback = function() - -- get event-parameters from `session`. - local snippet = require("luasnip").session.event_node - local expand_position = - require("luasnip").session.event_args.expand_pos - - print(string.format("expanding snippet %s at %s:%s", - table.concat(snippet:get_docstring(), "\n"), - expand_position[1], - expand_position[2] - )) - end - }) -< - - -============================================================================== -26. Cleanup *luasnip-cleanup* - -The function ls.cleanup() triggers the `LuasnipCleanup` user event, that you -can listen to do some kind of cleaning in your own snippets; by default it will -empty the snippets table and the caches of the lazy_load. - - -============================================================================== -27. Logging *luasnip-logging* - -Luasnip uses logging to report unexpected program states, and information on -what’s going on in general. If something does not work as expected, taking a -look at the log (and potentially increasing the loglevel) might give some good -hints towards what is going wrong. - -The log is stored in `/luasnip.log` -(`/luasnip.log` for Neovim versions where -`stdpath("log")` does not exist), and can be opened by calling `ls.log.open()`. -The loglevel (granularity of reported events) can be adjusted by calling -`ls.log.set_loglevel("error"|"warn"|"info"|"debug")`. `"debug"` has the highest -granularity, `"error"` the lowest, the default is `"warn"`. - -Once this log grows too large (10MiB, currently not adjustable), it will be -renamed to `luasnip.log.old`, and a new, empty log created in its place. If -there already exists a `luasnip.log.old`, it will be deleted. - -`ls.log.ping()` can be used to verify the log is working correctly: it will -print a short message to the log. - - -============================================================================== -28. Source *luasnip-source* - -It is possible to attach, to a snippet, information about its source. This can -be done either by the various loaders (if it is enabled in `ls.setup` -(|luasnip-config-options|, `loaders_store_source`)), or manually. The attached -data can be used by |luasnip-extras-snippet-location| to jump to the definition -of a snippet. - -It is also possible to get/set the source of a snippet via API: - -`ls.snippet_source`: - -- `get(snippet) -> source_data`: - Retrieve the source-data of `snippet`. `source_data` always contains the key - `file`, the file in which the snippet was defined, and may additionally - contain `line` or `line_end`, the first and last line of the definition. -- `set(snippet, source)`: - Set the source of a snippet. - - `snippet`: a snippet which was added via `ls.add_snippets`. - - `source`: a `source`-object, obtained from either `from_debuginfo` or - `from_location`. -- `from_location(file, opts) -> source`: - - `file`: `string`, The path to the file in which the snippet is defined. - - `opts`: `table|nil`, optional parameters for the source. - - `line`: `number`, the first line of the definition. 1-indexed. - - `line_end`: `number`, the final line of the definition. 1-indexed. -- `from_debuginfo(debuginfo) -> source`: - Generates source from the table returned by `debug.getinfo` (from now on - referred to as `debuginfo`). `debuginfo` has to be of a frame of a function - which is backed by a file, and has to contain this information, ie. has to be - generated by `debug.get_info(*, "Sl")` (at least `"Sl"`, it may also contain - more info). - - -============================================================================== -29. Config-Options *luasnip-config-options* - -These are the settings you can provide to `luasnip.setup()`: - -- `keep_roots`: Whether snippet-roots should be linked. See - |luasnip-basics-snippet-insertion| for more context. -- `link_roots`: Whether snippet-roots should be linked. See - |luasnip-basics-snippet-insertion| for more context. -- `exit_roots`: Whether snippet-roots should exit at reaching at their last node, - `$0`. This setting is only valid for root snippets, not child snippets. This - setting may avoid unexpected behavior by disallowing to jump earlier (finished) - snippets. Check |luasnip-basics-snippet-insertion| for more information on - snippet-roots. -- `link_children`: Whether children should be linked. See - |luasnip-basics-snippet-insertion| for more context. -- `history` (deprecated): if not nil, `keep_roots`, `link_roots`, and - `link_children` will be set to the value of `history`, and `exit_roots` will - set to inverse value of `history`. This is just to ensure - backwards-compatibility. -- `update_events`: Choose which events trigger an update of the active nodes’ - dependents. Default is just `'InsertLeave'`, `'TextChanged,TextChangedI'` would - update on every change. These, like all other `*_events` are passed to - `nvim_create_autocmd` as `events`, so they can be wrapped in a table, like - >lua - ls.setup({ - update_events = {"TextChanged", "TextChangedI"} - }) - < -- `region_check_events`: Events on which to leave the current snippet-root if the - cursor is outside its’ 'region'. Disabled by default, `'CursorMoved'`, - `'CursorHold'` or `'InsertEnter'` seem reasonable. -- `delete_check_events`: When to check if the current snippet was deleted, and if - so, remove it from the history. Off by default, `'TextChanged'` (perhaps - `'InsertLeave'`, to react to changes done in Insert mode) should work just fine - (alternatively, this can also be mapped using `luasnip-delete-check`). -- `store_selection_keys`: Mapping for populating `TM_SELECTED_TEXT` and related - variables (not set by default). If you want to set this mapping yourself, map - `ls.select_keys` (not a function, actually a string/key-combination) as a rhs. -- `enable_autosnippets`: Autosnippets are disabled by default to minimize - performance penalty if unused. Set to `true` to enable. -- `ext_opts`: Additional options passed to extmarks. Can be used to add - passive/active highlight on a per-node-basis (more info in DOC.md) -- `parser_nested_assembler`: Override the default behaviour of inserting a - `choiceNode` containing the nested snippet and an empty `insertNode` for nested - placeholders (`"${1: ${2: this is nested}}"`). For an example (behaviour more - similar to vscode), check here - -- `ft_func`: Source of possible filetypes for snippets. Defaults to a function, - which returns `vim.split(vim.bo.filetype, ".", true)`, but check - filetype_functions or the - |luasnip-extras-filetype-functions|-section for more options. -- `load_ft_func`: Function to determine which filetypes belong to a given buffer - (used for `lazy_loading`). `fn(bufnr) -> filetypes (string[])`. Again, there - are some examples in filetype_functions - . -- `snip_env`: The best way to author snippets in lua involves the lua-loader (see - |luasnip-loaders-lua|). Unfortunately, this requires that snippets are defined - in separate files, which means that common definitions like `s`, `i`, `sn`, - `t`, `fmt`, … have to be repeated in each of them, and that adding more - customized functions to ease writing snippets also requires some setup. - `snip_env` can be used to insert variables into exactly the places where - lua-snippets are defined (for now only the file loaded by the lua-loader). - Setting `snip_env` to `{ some_global = "a value" }` will add (amongst the - defaults stated at the beginning of this documentation) the global variable - `some_global` while evaluating these files. There are special keys which, when - set in `snip_env` change the behaviour of this option, and are not passed - through to the lua-files: - - `__snip_env_behaviour`, string: either `"set"` or `"extend"` (default - `"extend"`) - If this is `"extend"`, the variables defined in `snip_env` will complement (and - override) the defaults. If this is not desired, `"set"` will not include the - defaults, but only the variables set here. - One side-effect of this is that analysis-tools (most likely - `lua-language-server`) for lua will generate diagnostics for the usage of - undefined symbols. If you mind the (probably) large number of generated - warnings, consider adding the undefined globals to the globals recognized by - `lua-language-server` or add `---@diagnostic disable: undefined-global` - somewhere in the affected files. -- `loaders_store_source`, boolean, whether loaders should store the source of the - loaded snippets. Enabling this means that the definition of any snippet can be - jumped to via |luasnip-extras-snippet-location|, but also entails slightly - increased memory consumption (and load-time, but it’s not really noticeable). - - -============================================================================== -30. Troubleshooting *luasnip-troubleshooting* - - -ADDING SNIPPETS *luasnip-troubleshooting-adding-snippets* - -### Loaders - -- **Filetypes**. LuaSnip uses `all` as the global filetype. As most snippet - collections don’t explicitly target LuaSnip, they may not provide global - snippets for this filetype, but another, like `_` (`honza/vim-snippets`). In - these cases, it’s necessary to extend LuaSnip’s global filetype with the - collection’s global filetype: - >lua - ls.filetype_extend("all", { "_" }) - < - In general, if some snippets don’t show up when loading a collection, a good - first step is checking the filetype LuaSnip is actually looking into (print - them for the current buffer via `:lua - print(vim.inspect(require("luasnip").get_snippet_filetypes()))`), against the - one the missing snippet is provided for (in the collection). If there is indeed - a mismatch, `filetype_extend` can be used to also search the collection’s - filetype: - >lua - ls.filetype_extend("", { "" }) - < -- **Non-default ft_func loading**. As we only load `lazy_load`ed snippets on some - events, `lazy_load` will probably not play nice when a non-default `ft_func` is - used: if it depends on e.g. the cursor position, only the filetypes for the - cursor position when the `lazy_load` events are triggered will be loaded. Check - |luasnip-extras-filetype-function|’s `extend_load_ft` for a solution. - - -GENERAL ~ - -- **Snippets sharing triggers**. If multiple snippets could be triggered at the - current buffer-position, the snippet that was defined first in one’s - configuration will be expanded first. As a small, real-world LaTeX math - example, given the following two snippets with triggers `.ov` and `ov`: - >lua - postfix( -- Insert over-line command to text via post-fix - { trig = ".ov", snippetType = "autosnippet" }, - { - f(function(_, parent) - return "\\overline{" .. parent.snippet.env.POSTFIX_MATCH .. "}" - end, {}), - } - ), - s( -- Insert over-line command - { trig = "ov", snippetType="autosnippet" }, - fmt( - [[\overline{<>}]], - { i(1) }, - { delimiters = "<>" } - ) - ), - < - If one types `x` followed by `.ov`, the postfix snippet expands producing - `\overline{x}`. However, if the `postfix` snippet above is defined _after_ the - normal snippet `s`, then the same key press sequence produces `x.\overline{}`. - This behaviour can be overridden by explicitly providing a priority to such - snippets. For example, in the above code, if the `postfix` snippet was defined - after the normal snippet `s`, then adding `priority=1001` to the `postfix` - snippet will cause it to expand as if it were defined before the normal snippet - `s`. Snippet `priority` is discussed in the Snippets section - of the - documentation. - - -============================================================================== -31. API *luasnip-api* - -`require("luasnip")`: - -- `add_snippets(ft:string or nil, snippets:list or table, opts:table or nil)`: - Makes `snippets` (list of snippets) available in `ft`. If `ft` is `nil`, - `snippets` should be a table containing lists of snippets, the keys are - corresponding filetypes. `opts` may contain the following keys: - - `type`: type of `snippets`, `"snippets"` or `"autosnippets"` (ATTENTION: - plural form used here). This serves as default value for the `snippetType` - key of each snippet added by this call see |luasnip-snippets|. - - `key`: Key that identifies snippets added via this call. - If `add_snippets` is called with a key that was already used, the snippets - from that previous call will be removed. - This can be used to reload snippets: pass an unique key to each - `add_snippets` and just redo the `add_snippets`-call when the snippets have - changed. - - `override_priority`: set priority for all snippets. - - `default_priority`: set priority only for snippets without snippet priority. -- `clean_invalidated(opts: table or nil) -> bool`: clean invalidated snippets - from internal snippet storage. Invalidated snippets are still stored; it might - be useful to actually remove them as they still have to be iterated during - expansion. - `opts` may contain: - - `inv_limit`: how many invalidated snippets are allowed. If the number of - invalid snippets doesn’t exceed this threshold, they are not yet cleaned up. - A small number of invalidated snippets (<100) probably doesn’t affect runtime - at all, whereas recreating the internal snippet storage might. -- `get_id_snippet(id)`: returns snippet corresponding to id. -- `in_snippet()`: returns true if the cursor is inside the current snippet. -- `jumpable(direction)`: returns true if the current node has a next(`direction` - = 1) or previous(`direction` = -1), e.g. whether it’s possible to jump - forward or backward to another node. -- `jump(direction)`: returns true if the jump was successful. -- `expandable()`: true if a snippet can be expanded at the current cursor - position. -- `expand(opts)`: expands the snippet at(before) the cursor. `opts` may contain: - - `jump_into_func` passed through to `ls.snip_expand`, check its’ doc for a - description. -- `expand_or_jumpable()`: returns `expandable() or jumpable(1)` (exists only - because commonly, one key is used to both jump forward and expand). -- `expand_or_locally_jumpable()`: same as `expand_or_jumpable()` except jumpable - is ignored if the cursor is not inside the current snippet. -- `locally_jumpable(direction)`: same as `jumpable()` except it is ignored if the - cursor is not inside the current snippet. -- `expand_or_jump()`: returns true if jump/expand was succesful. -- `expand_auto()`: expands the autosnippets before the cursor (not necessary to - call manually, will be called via autocmd if `enable_autosnippets` is set in - the config). -- `snip_expand(snip, opts)`: expand `snip` at the current cursor position. `opts` - may contain the following keys: - - `clear_region`: A region of text to clear after expanding (but before jumping - into) snip. It has to be at this point (and therefore passed to this function) - as clearing before expansion will populate `TM_CURRENT_LINE` and - `TM_CURRENT_WORD` with wrong values (they would miss the snippet trigger) and - clearing after expansion may move the text currently under the cursor and have - it end up not at the `i(1)`, but a `#trigger` chars to its right. The actual - values used for clearing are `from` and `to`, both (0,0)-indexed - byte-positions. If the variables don’t have to be populated with the correct - values, it’s safe to remove the text manually. - - `expand_params`: table, override `trigger`, `captures` or environment of the - snippet. This is useful for manually expanding snippets where the trigger - passed via `trig` is not the text triggering the snippet, or those which expect - `captures` (basically, snippets with a non-plaintext `trigEngine`). - One example: ```lua snip_expand(snip, { trigger = "override_trigger", captures - = {"first capture", "second capture"}, env_override = { this_key = "some - value", other_key = {"multiple", "lines"}, TM_FILENAME = - "some_other_filename.lua" } }) - - `pos`: position (`{line, col}`), (0,0)-indexed (in bytes, as returned by - `nvim_win_get_cursor()`), where the snippet should be expanded. The snippet - will be put between `(line,col-1)` and `(line,col)`. The snippet will be - expanded at the current cursor if pos is nil. - - `jump_into_func`: fn(snippet) -> node: Callback responsible for jumping into - the snippet. The returned node is set as the new active node, ie. it is the - origin of the next jump. The default is basically this: `lua function(snip) -- - jump_into set the placeholder of the snippet, 1 -- to jump forwards. return - snip:jump_into(1)` while this can be used to only insert the snippet: `lua - function(snip) return snip.insert_nodes[0] end` - - `indent`: bool?, defaults to `true`. Whether LuaSnip will try to add additional - indents to fit current indent level in snippet expanding. This option is useful - when some LSP server already take indents into consideration. In such cases, - LuaSnip should not try to add additional indents. If you are using `nvim-cmp`, - sample config: - >lua - require("cmp").setup { - snippet = { - expand = function(args) - local indent_nodes = true - if vim.api.nvim_get_option_value("filetype", { buf = 0 }) == "dart" then - indent_nodes = false - end - require("luasnip").lsp_expand(args.body, { - indent = indent_nodes, - }) - end, - }, - } - < - `opts` and any of its parameters may be nil. -- `get_active_snip()`: returns the currently active snippet (not node!). -- `choice_active()`: true if inside a choiceNode. -- `change_choice(direction)`: changes the choice in the innermost currently - active choiceNode forward (`direction` = 1) or backward (`direction` = -1). -- `unlink_current()`: removes the current snippet from the jumplist (useful if - luasnip fails to automatically detect e.g. deletion of a snippet) and sets the - current node behind the snippet, or, if not possible, before it. -- `lsp_expand(snip_string, opts)`: expands the LSP snippet defined via - `snip_string` at the cursor. `opts` can have the same options as `opts` in - `snip_expand`. -- `active_update_dependents()`: update all function/dynamicNodes that have the - current node as an argnode (will actually only update them if the text in any - of the argnodes changed). -- `available(snip_info)`: returns a table of all snippets defined for the current - filetypes(s) (`{ft1={snip1, snip2}, ft2={snip3, snip4}}`). The structure of the - snippet is defined by `snip_info` which is a function (`snip_info(snip)`) that - takes in a snippet (`snip`), finds the desired information on it, and returns - it. `snip_info` is an optional argument as a default has already been defined. - You can use it for more granular control over the table of snippets that is - returned. -- `exit_out_of_region(node)`: checks whether the cursor is still within the range - of the root-snippet `node` belongs to. If yes, no change occurs; if no, the - root-snippet is exited and its `$0` will be the new active node. If a jump - causes an error (happens mostly because the text of a snippet was deleted), the - snippet is removed from the jumplist and the current node set to the - end/beginning of the next/previous snippet. -- `store_snippet_docstrings(snippet_table)`: Stores the docstrings of all - snippets in `snippet_table` to a file - (`stdpath("cache")/luasnip/docstrings.json`). Calling - `store_snippet_docstrings(snippet_table)` after adding/modifying snippets and - `load_snippet_docstrings(snippet_table)` on startup after all snippets have - been added to `snippet_table` is a way to avoide regenerating the (unchanged) - docstrings on each startup. (Depending on when the docstrings are required and - how luasnip is loaded, it may be more sensible to let them load lazily, - e.g. just before they are required). `snippet_table` should be laid out just - like `luasnip.snippets` (it will most likely always _be_ `luasnip.snippets`). -- `load_snippet_docstrings(snippet_table)`: Load docstrings for all snippets in - `snippet_table` from `stdpath("cache")/luasnip/docstrings.json`. The docstrings - are stored and restored via trigger, meaning if two snippets for one filetype - have the same (very unlikely to happen in actual usage), bugs could occur. - `snippet_table` should be laid out as described in `store_snippet_docstrings`. -- `unlink_current_if_deleted()`: Checks if the current snippet was deleted; if - so, it is removed from the jumplist. This is not 100% reliable as LuaSnip only - sees the extmarks and their beginning/end may not be on the same position, even - if all the text between them was deleted. -- `filetype_extend(filetype:string, extend_filetypes:table of string)`: Tells - luasnip that for a buffer with `ft=filetype`, snippets from `extend_filetypes` - should be searched as well. `extend_filetypes` is a lua-array (`{ft1, ft2, - ft3}`). `luasnip.filetype_extend("lua", {"c", "cpp"})` would search and expand - c and cpp snippets for lua files. -- `filetype_set(filetype:string, replace_filetypes:table of string)`: Similar to - `filetype_extend`, but where _append_ appended filetypes, _set_ sets them: - `filetype_set("lua", {"c"})` causes only c snippets to be expanded in lua - files; lua snippets aren’t even searched. -- `cleanup()`: clears all snippets. Not useful for regular usage, only when - authoring and testing snippets. -- `refresh_notify(ft:string)`: Triggers an autocmd that other plugins can hook - into to perform various cleanup for the refreshed filetype. Useful for - signaling that new snippets were added for the filetype `ft`. -- `set_choice(indx:number)`: Changes to the `indx`th choice. If no `choiceNode` - is active, an error is thrown. If the active `choiceNode` doesn’t have an - `indx`th choice, an error is thrown. -- `get_current_choices() -> string[]`: Returns a list of multiline-strings - (themselves lists, even if they have only one line), the `i`th string - corresponding to the `i`th choice of the currently active `choiceNode`. If no - `choiceNode` is active, an error is thrown. -- `setup_snip_env()`: Adds the variables defined (during `setup`) in `snip_env` - to the callers environment. -- `get_snip_env()`: Returns `snip_env`. -- `jump_destination(direction)`: Returns the node the next jump in `direction` - (either -1 or 1, for backwards, forwards respectively) leads to, or `nil` if - the destination could not be determined (most likely because there is no node - that can be jumped to in the given direction, or there is no active node). -- `activate_node(opts)`: Activate a node in any snippet. `opts` contains the - following options: - - `pos`, `{[1]: row, [2]: byte-column}?`: The position at which a node should - be activated. Defaults to the position of the cursor. - - `strict`, `bool?`: If set, throw an error if the node under the cursor can’t - be jumped into. If not set, fall back to any node of the snippet and enter - that instead. - - `select`, `bool?`: Whether the text inside the node should be selected. - Defaults to true. - -Not covered in this section are the various node-constructors exposed by the -module, their usage is shown either previously in this file or in -`Examples/snippets.lua` (in the repo). - -Generated by panvimdoc - -vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/doc/tags b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/doc/tags deleted file mode 100644 index 3c6f662a..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/doc/tags +++ /dev/null @@ -1,63 +0,0 @@ -luasnip-absolute-indexer luasnip.txt /*luasnip-absolute-indexer* -luasnip-api luasnip.txt /*luasnip-api* -luasnip-basics luasnip.txt /*luasnip-basics* -luasnip-basics-adding-snippets luasnip.txt /*luasnip-basics-adding-snippets* -luasnip-basics-jump-index luasnip.txt /*luasnip-basics-jump-index* -luasnip-basics-snippet-insertion luasnip.txt /*luasnip-basics-snippet-insertion* -luasnip-choicenode luasnip.txt /*luasnip-choicenode* -luasnip-cleanup luasnip.txt /*luasnip-cleanup* -luasnip-config-options luasnip.txt /*luasnip-config-options* -luasnip-docstring-cache luasnip.txt /*luasnip-docstring-cache* -luasnip-docstrings luasnip.txt /*luasnip-docstrings* -luasnip-dynamicnode luasnip.txt /*luasnip-dynamicnode* -luasnip-events luasnip.txt /*luasnip-events* -luasnip-ext_opts luasnip.txt /*luasnip-ext_opts* -luasnip-extend-decorator luasnip.txt /*luasnip-extend-decorator* -luasnip-extras luasnip.txt /*luasnip-extras* -luasnip-extras-conditions luasnip.txt /*luasnip-extras-conditions* -luasnip-extras-dynamic-lambda luasnip.txt /*luasnip-extras-dynamic-lambda* -luasnip-extras-filetype-functions luasnip.txt /*luasnip-extras-filetype-functions* -luasnip-extras-fmt luasnip.txt /*luasnip-extras-fmt* -luasnip-extras-lambda luasnip.txt /*luasnip-extras-lambda* -luasnip-extras-match luasnip.txt /*luasnip-extras-match* -luasnip-extras-nonempty luasnip.txt /*luasnip-extras-nonempty* -luasnip-extras-on-the-fly-snippets luasnip.txt /*luasnip-extras-on-the-fly-snippets* -luasnip-extras-partial luasnip.txt /*luasnip-extras-partial* -luasnip-extras-postfix-snippet luasnip.txt /*luasnip-extras-postfix-snippet* -luasnip-extras-repeat luasnip.txt /*luasnip-extras-repeat* -luasnip-extras-select_choice luasnip.txt /*luasnip-extras-select_choice* -luasnip-extras-snippet-list luasnip.txt /*luasnip-extras-snippet-list* -luasnip-extras-snippet-location luasnip.txt /*luasnip-extras-snippet-location* -luasnip-extras-treesitter-postfix-snippet luasnip.txt /*luasnip-extras-treesitter-postfix-snippet* -luasnip-functionnode luasnip.txt /*luasnip-functionnode* -luasnip-indentsnippetnode luasnip.txt /*luasnip-indentsnippetnode* -luasnip-insertnode luasnip.txt /*luasnip-insertnode* -luasnip-key-indexer luasnip.txt /*luasnip-key-indexer* -luasnip-loaders luasnip.txt /*luasnip-loaders* -luasnip-loaders-edit_snippets luasnip.txt /*luasnip-loaders-edit_snippets* -luasnip-loaders-lua luasnip.txt /*luasnip-loaders-lua* -luasnip-loaders-snipmate luasnip.txt /*luasnip-loaders-snipmate* -luasnip-loaders-snippet-specific-filetypes luasnip.txt /*luasnip-loaders-snippet-specific-filetypes* -luasnip-loaders-vs-code luasnip.txt /*luasnip-loaders-vs-code* -luasnip-logging luasnip.txt /*luasnip-logging* -luasnip-lsp-snippets luasnip.txt /*luasnip-lsp-snippets* -luasnip-lsp-snippets-snipmate-parser luasnip.txt /*luasnip-lsp-snippets-snipmate-parser* -luasnip-lsp-snippets-transformations luasnip.txt /*luasnip-lsp-snippets-transformations* -luasnip-multisnippet luasnip.txt /*luasnip-multisnippet* -luasnip-node luasnip.txt /*luasnip-node* -luasnip-node-api luasnip.txt /*luasnip-node-api* -luasnip-node-reference luasnip.txt /*luasnip-node-reference* -luasnip-restorenode luasnip.txt /*luasnip-restorenode* -luasnip-snippetnode luasnip.txt /*luasnip-snippetnode* -luasnip-snippetproxy luasnip.txt /*luasnip-snippetproxy* -luasnip-snippets luasnip.txt /*luasnip-snippets* -luasnip-snippets-data luasnip.txt /*luasnip-snippets-data* -luasnip-source luasnip.txt /*luasnip-source* -luasnip-table-of-contents luasnip.txt /*luasnip-table-of-contents* -luasnip-textnode luasnip.txt /*luasnip-textnode* -luasnip-troubleshooting luasnip.txt /*luasnip-troubleshooting* -luasnip-troubleshooting-adding-snippets luasnip.txt /*luasnip-troubleshooting-adding-snippets* -luasnip-variables luasnip.txt /*luasnip-variables* -luasnip-variables-environment-namespaces luasnip.txt /*luasnip-variables-environment-namespaces* -luasnip-variables-lsp-variables luasnip.txt /*luasnip-variables-lsp-variables* -luasnip.txt luasnip.txt /*luasnip.txt* diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/ftplugin/snippets.vim b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/ftplugin/snippets.vim deleted file mode 100644 index b13cc8af..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/ftplugin/snippets.vim +++ /dev/null @@ -1,14 +0,0 @@ -" Vim filetype plugin for SnipMate snippets (.snippets files) - -if exists("b:did_ftplugin") - finish -endif -let b:did_ftplugin = 1 - -let b:undo_ftplugin = "setl et< sts< cms< fdm< fde<" - -" Use hard tabs -setlocal noexpandtab softtabstop=0 - -setlocal commentstring=#\ %s -setlocal nospell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/nix-support/propagated-build-inputs b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/nix-support/propagated-build-inputs deleted file mode 100644 index d8abd799..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/nix-support/propagated-build-inputs +++ /dev/null @@ -1 +0,0 @@ -/nix/store/qhhsw7qjik5gh1wkai703p6dq0ydp15r-lua5.1-jsregexp-0.0.7-1 /nix/store/mqbhz05llkddfb5wni0m48kw22ixxps4-lua-5.1.5 \ No newline at end of file diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/plugin/luasnip.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/plugin/luasnip.lua deleted file mode 100644 index 420e4c0a..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/plugin/luasnip.lua +++ /dev/null @@ -1,90 +0,0 @@ -vim.filetype.add({ - extension = { snippets = "snippets" }, -}) - -local function silent_map(mode, lhs, rhs, desc) - vim.keymap.set(mode, lhs, rhs, { silent = true, desc = desc or "" }) -end - -silent_map("i", "luasnip-expand-or-jump", function() - require("luasnip").expand_or_jump() -end, "LuaSnip: Expand or jump in the current snippet") -silent_map("i", "luasnip-expand-snippet", function() - require("luasnip").expand() -end, "LuaSnip: Expand the current snippet") -silent_map("i", "luasnip-next-choice", function() - require("luasnip").change_choice(1) -end, "LuaSnip: Change to the next choice from the choiceNode") -silent_map("i", "luasnip-prev-choice", function() - require("luasnip").change_choice(-1) -end, "LuaSnip: Change to the previous choice from the choiceNode") -silent_map("i", "luasnip-jump-next", function() - require("luasnip").jump(1) -end, "LuaSnip: Jump to the next node") -silent_map("i", "luasnip-jump-prev", function() - require("luasnip").jump(-1) -end, "LuaSnip: Jump to the previous node") - -silent_map("n", "luasnip-delete-check", function() - require("luasnip").unlink_current_if_deleted() -end, "LuaSnip: Removes current snippet from jumplist") -silent_map("!", "luasnip-delete-check", function() - require("luasnip").unlink_current_if_deleted() -end, "LuaSnip: Removes current snippet from jumplist") - -silent_map("", "luasnip-expand-repeat", function() - require("luasnip").expand_repeat() -end, "LuaSnip: Repeat last node expansion") -silent_map("!", "luasnip-expand-repeat", function() - require("luasnip").expand_repeat() -end, "LuaSnip: Repeat last node expansion") - -silent_map("s", "luasnip-expand-or-jump", function() - require("luasnip").expand_or_jump() -end, "LuaSnip: Expand or jump in the current snippet") -silent_map("s", "luasnip-expand-snippet", function() - require("luasnip").expand() -end, "LuaSnip: Expand the current snippet") -silent_map("s", "luasnip-next-choice", function() - require("luasnip").change_choice(1) -end, "LuaSnip: Change to the next choice from the choiceNode") -silent_map("s", "luasnip-prev-choice", function() - require("luasnip").change_choice(-1) -end, "LuaSnip: Change to the previous choice from the choiceNode") -silent_map("s", "luasnip-jump-next", function() - require("luasnip").jump(1) -end, "LuaSnip: Jump to the next node") -silent_map("s", "luasnip-jump-prev", function() - require("luasnip").jump(-1) -end, "LuaSnip: Jump to the previous node") - -vim.api.nvim_create_user_command("LuaSnipUnlinkCurrent", function() - require("luasnip").unlink_current() -end, { force = true }) - ---stylua: ignore -vim.api.nvim_create_user_command("LuaSnipListAvailable", function() - ( - ( - vim.version - and type(vim.version) == "table" - and ( - ((vim.version().major == 0) and (vim.version().minor >= 9)) - or (vim.version().major > 0) ) - ) and vim.print - or vim.pretty_print - )(require("luasnip").available()) -end, { force = true }) - -require("luasnip.config")._setup() - --- register these during startup so lazy_load will also load filetypes whose --- events fired only before lazy_load is actually called. --- (BufWinEnter -> lazy_load() wouldn't load any files without these). -vim.api.nvim_create_augroup("_luasnip_lazy_load", {}) -vim.api.nvim_create_autocmd({ "BufWinEnter", "FileType" }, { - callback = function(event) - require("luasnip.loaders").load_lazy_loaded(tonumber(event.buf)) - end, - group = "_luasnip_lazy_load", -}) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/plugin/luasnip.vim b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/plugin/luasnip.vim deleted file mode 100644 index d8628ea7..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/plugin/luasnip.vim +++ /dev/null @@ -1,23 +0,0 @@ -function! luasnip#expandable() - return luaeval('require("luasnip").expandable()') -endfunction - -function! luasnip#expand_or_jumpable() - return luaeval('require("luasnip").expand_or_jumpable()') -endfunction - -function! luasnip#expand_or_locally_jumpable() - return luaeval('require("luasnip").expand_or_locally_jumpable()') -endfunction - -function! luasnip#locally_jumpable(direction) - return luaeval('require("luasnip").locally_jumpable(_A)', a:direction) -endfunction - -function! luasnip#jumpable(direction) - return luaeval('require("luasnip").jumpable(_A)', a:direction) -endfunction - -function! luasnip#choice_active() - return luaeval('require("luasnip").choice_active()') -endfunction diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/syntax/snippets.vim b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/syntax/snippets.vim deleted file mode 100644 index dcb39dd9..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/dart/syntax/snippets.vim +++ /dev/null @@ -1,29 +0,0 @@ -" Syntax highlighting for .snippets files -" Hopefully this should make snippets a bit nicer to write! -syn match snipComment '^#.*' -syn match placeHolder '\${\d\+\(:.\{-}\)\=}' contains=snipCommand -syn match tabStop '\$\d\+' -syn match snipEscape '\\\\\|\\`' -syn match snipCommand '\%(\\\@ cover common -" cases with \t and " ". -syn match snipError "^[^#vsaep\t ].*$" - -hi link snippet Identifier -hi link snipComment Comment -hi link multiSnipText String -hi link snipKeyword Keyword -hi link snipEscape SpecialChar -hi link placeHolder Special -hi link tabStop Special -hi link snipCommand String -hi link snipError Error -hi link priority Number diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/_types.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/_types.lua deleted file mode 100644 index ec839c87..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/_types.lua +++ /dev/null @@ -1,8 +0,0 @@ ----@alias LuaSnip.Cursor {[1]: number, [2]: number} - ----@class LuaSnip.MatchRegion 0-based region ----@field row integer 0-based row ----@field col_range { [1]: integer, [2]: integer } 0-based column range, from-in, to-exclusive - ----@alias LuaSnip.Addable table ----Anything that can be passed to ls.add_snippets(). diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/config.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/config.lua deleted file mode 100644 index aaaaa9c7..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/config.lua +++ /dev/null @@ -1,143 +0,0 @@ -local ext_util = require("luasnip.util.ext_opts") -local session = require("luasnip.session") -local conf_defaults = require("luasnip.default_config") - -local function set_snip_env(target_conf_defaults, user_config) - if not user_config.snip_env then - -- target_conf already contains defaults - return - end - - -- either "set" or "extend", make sure it does not appear in the final snip_env. - local snip_env_behaviour = user_config.snip_env.__snip_env_behaviour ~= nil - and user_config.snip_env.__snip_env_behaviour - or "extend" - assert( - snip_env_behaviour == "set" or snip_env_behaviour == "extend", - "Unknown __snip_env_behaviour, `" .. snip_env_behaviour .. "`" - ) - user_config.snip_env.__snip_env_behaviour = nil - - if snip_env_behaviour == "set" then - target_conf_defaults.snip_env = user_config.snip_env - else - -- cannot use vim.tbl_extend, since we'd need to transfer the metatable. - for k, v in pairs(user_config.snip_env) do - target_conf_defaults.snip_env[k] = v - end - end - - -- set to nil, to mark that it's handled. - user_config.snip_env = nil -end - --- declare here to use in set_config. -local c - -c = { - set_config = function(user_config) - user_config = user_config or {} - local conf = vim.deepcopy(conf_defaults) - - -- remove unused highlights from default-ext_opts. - ext_util.clear_invalid(conf.ext_opts) - conf.ext_opts = ext_util.child_complete(conf.ext_opts) - user_config.ext_opts = - ext_util.child_complete(user_config.ext_opts or {}) - ext_util.child_extend(user_config.ext_opts, conf.ext_opts) - - -- use value from update_events, then updateevents. - -- also nil updateevents, don't spill it into the main config. - user_config.update_events = user_config.update_events - or user_config.updateevents - user_config.updateevents = nil - - set_snip_env(conf, user_config) - - -- handle legacy-key history. - if user_config.history ~= nil then - conf.keep_roots = user_config.history - conf.link_roots = user_config.history - conf.exit_roots = not user_config.history - conf.link_children = user_config.history - - -- unset key to prevent handling twice. - conf.history = nil - end - - for k, v in pairs(user_config) do - conf[k] = v - end - - session.config = conf - c._setup() - end, - - _setup = function() - local augroup = vim.api.nvim_create_augroup("luasnip", {}) - - -- events: string[], or string. if string[], each string is one - -- event-name, if string, either one event-name, or multiple delimited by `,`. - local function ls_autocmd(events, callback) - if type(events) == "string" then - -- split on ',' for backwards compatibility. - -- remove spaces from string. - events = vim.split(events:gsub(" ", ""), ",") - end - vim.api.nvim_create_autocmd(events, { - callback = callback, - group = augroup, - }) - end - if session.config.delete_check_events ~= nil then - ls_autocmd( - session.config.delete_check_events, - require("luasnip").unlink_current_if_deleted - ) - end - ls_autocmd( - session.config.update_events, - require("luasnip").active_update_dependents - ) - if session.config.region_check_events ~= nil then - ls_autocmd(session.config.region_check_events, function() - require("luasnip").exit_out_of_region( - require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()] - ) - end) - end - -- Remove buffers' nodes on deletion+wipeout. - ls_autocmd({ "BufDelete", "BufWipeout" }, function(event) - local current_nodes = require("luasnip").session.current_nodes - if current_nodes then - current_nodes[event.buf] = nil - end - end) - if session.config.enable_autosnippets then - ls_autocmd("InsertCharPre", function() - Luasnip_just_inserted = true - end) - ls_autocmd({ "TextChangedI", "TextChangedP" }, function() - if Luasnip_just_inserted then - require("luasnip").expand_auto() - Luasnip_just_inserted = nil - end - end) - end - - if session.config.store_selection_keys then - vim.cmd( - string.format( - [[xnoremap %s %s]], - session.config.store_selection_keys, - require("luasnip.util.select").select_keys - ) - ) - end - end, -} - --- Keep these two for backward compativility -c.setup = c.set_config - -return c diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/default_config.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/default_config.lua deleted file mode 100644 index 68ed80c4..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/default_config.lua +++ /dev/null @@ -1,213 +0,0 @@ -local types = require("luasnip.util.types") -local lazy_table = require("luasnip.util.lazy_table") - -local ft_functions = require("luasnip.extras.filetype_functions") - --- Inserts a insert(1) before all other nodes, decreases node.pos's as indexing is "wrong". -local function modify_nodes(snip) - for i = #snip.nodes, 1, -1 do - snip.nodes[i + 1] = snip.nodes[i] - local node = snip.nodes[i + 1] - if node.pos then - node.pos = node.pos + 1 - end - end - - local iNode = require("luasnip.nodes.insertNode") - snip.nodes[1] = iNode.I(1) -end - -local lazy_snip_env = { - s = function() - return require("luasnip.nodes.snippet").S - end, - sn = function() - return require("luasnip.nodes.snippet").SN - end, - isn = function() - return require("luasnip.nodes.snippet").ISN - end, - t = function() - return require("luasnip.nodes.textNode").T - end, - i = function() - return require("luasnip.nodes.insertNode").I - end, - f = function() - return require("luasnip.nodes.functionNode").F - end, - c = function() - return require("luasnip.nodes.choiceNode").C - end, - d = function() - return require("luasnip.nodes.dynamicNode").D - end, - r = function() - return require("luasnip.nodes.restoreNode").R - end, - events = function() - return require("luasnip.util.events") - end, - k = function() - return require("luasnip.nodes.key_indexer").new_key - end, - ai = function() - return require("luasnip.nodes.absolute_indexer") - end, - extras = function() - return require("luasnip.extras") - end, - l = function() - return require("luasnip.extras").lambda - end, - rep = function() - return require("luasnip.extras").rep - end, - p = function() - return require("luasnip.extras").partial - end, - m = function() - return require("luasnip.extras").match - end, - n = function() - return require("luasnip.extras").nonempty - end, - dl = function() - return require("luasnip.extras").dynamic_lambda - end, - fmt = function() - return require("luasnip.extras.fmt").fmt - end, - fmta = function() - return require("luasnip.extras.fmt").fmta - end, - conds = function() - return require("luasnip.extras.expand_conditions") - end, - postfix = function() - return require("luasnip.extras.postfix").postfix - end, - types = function() - return require("luasnip.util.types") - end, - parse = function() - return require("luasnip.util.parser").parse_snippet - end, - ms = function() - return require("luasnip.nodes.multiSnippet").new_multisnippet - end, -} - --- stylua: ignore -return { - -- corresponds to legacy "history=false". - keep_roots = false, - link_roots = false, - exit_roots = true, - link_children = false, - - update_events = "InsertLeave", - -- see :h User, event should never be triggered(except if it is `doautocmd`'d) - region_check_events = nil, - delete_check_events = nil, - store_selection_keys = nil, -- Supossed to be the same as the expand shortcut - ext_opts = { - [types.textNode] = { - active = { hl_group = "LuasnipTextNodeActive" }, - passive = { hl_group = "LuasnipTextNodePassive" }, - visited = { hl_group = "LuasnipTextNodeVisited" }, - unvisited = { hl_group = "LuasnipTextNodeUnvisited" }, - snippet_passive = { hl_group = "LuasnipTextNodeSnippetPassive" }, - }, - [types.insertNode] = { - active = { hl_group = "LuasnipInsertNodeActive" }, - passive = { hl_group = "LuasnipInsertNodePassive" }, - visited = { hl_group = "LuasnipInsertNodeVisited" }, - unvisited = { hl_group = "LuasnipInsertNodeUnvisited" }, - snippet_passive = { - hl_group = "LuasnipInsertNodeSnippetPassive", - }, - }, - [types.exitNode] = { - active = { hl_group = "LuasnipExitNodeActive" }, - passive = { hl_group = "LuasnipExitNodePassive" }, - visited = { hl_group = "LuasnipExitNodeVisited" }, - unvisited = { hl_group = "LuasnipExitNodeUnvisited" }, - snippet_passive = { hl_group = "LuasnipExitNodeSnippetPassive" }, - }, - [types.functionNode] = { - active = { hl_group = "LuasnipFunctionNodeActive" }, - passive = { hl_group = "LuasnipFunctionNodePassive" }, - visited = { hl_group = "LuasnipFunctionNodeVisited" }, - unvisited = { hl_group = "LuasnipFunctionNodeUnvisited" }, - snippet_passive = { - hl_group = "LuasnipFunctionNodeSnippetPassive", - }, - }, - [types.snippetNode] = { - active = { hl_group = "LuasnipSnippetNodeActive" }, - passive = { hl_group = "LuasnipSnippetNodePassive" }, - visited = { hl_group = "LuasnipSnippetNodeVisited" }, - unvisited = { hl_group = "LuasnipSnippetNodeUnvisited" }, - snippet_passive = { - hl_group = "LuasnipSnippetNodeSnippetPassive", - }, - }, - [types.choiceNode] = { - active = { hl_group = "LuasnipChoiceNodeActive" }, - passive = { hl_group = "LuasnipChoiceNodePassive" }, - visited = { hl_group = "LuasnipChoiceNodeVisited" }, - unvisited = { hl_group = "LuasnipChoiceNodeUnvisited" }, - snippet_passive = { - hl_group = "LuasnipChoiceNodeSnippetPassive", - }, - }, - [types.dynamicNode] = { - active = { hl_group = "LuasnipDynamicNodeActive" }, - passive = { hl_group = "LuasnipDynamicNodePassive" }, - visited = { hl_group = "LuasnipDynamicNodeVisited" }, - unvisited = { hl_group = "LuasnipDynamicNodeUnvisited" }, - snippet_passive = { - hl_group = "LuasnipDynamicNodeSnippetPassive", - }, - }, - [types.snippet] = { - active = { hl_group = "LuasnipSnippetActive" }, - passive = { hl_group = "LuasnipSnippetPassive" }, - -- not used! - visited = { hl_group = "LuasnipSnippetVisited" }, - unvisited = { hl_group = "LuasnipSnippetUnvisited" }, - snippet_passive = { hl_group = "LuasnipSnippetSnippetPassive" }, - }, - [types.restoreNode] = { - active = { hl_group = "LuasnipRestoreNodeActive" }, - passive = { hl_group = "LuasnipRestoreNodePassive" }, - visited = { hl_group = "LuasnipRestoreNodeVisited" }, - unvisited = { hl_group = "LuasnipRestoreNodeUnvisited" }, - snippet_passive = { - hl_group = "LuasnipRestoreNodeSnippetPassive", - }, - }, - }, - ext_base_prio = 200, - ext_prio_increase = 9, - enable_autosnippets = false, - parser_nested_assembler = function(pos, snip) - -- only require here, to prevent some upfront load-cost. - local iNode = require("luasnip.nodes.insertNode") - local cNode = require("luasnip.nodes.choiceNode") - - modify_nodes(snip) - snip:init_nodes() - snip.pos = nil - - return cNode.C(pos, { snip, iNode.I(nil, { "" }) }) - end, - -- Function expected to return a list of filetypes (or empty list) - ft_func = ft_functions.from_filetype, - -- fn(bufnr) -> string[] (filetypes). - load_ft_func = ft_functions.from_filetype_load, - -- globals injected into luasnippet-files. - snip_env = lazy_table({}, lazy_snip_env), - loaders_store_source = false, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/_extra_types.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/_extra_types.lua deleted file mode 100644 index d8d7305c..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/_extra_types.lua +++ /dev/null @@ -1,26 +0,0 @@ ----@class LuaSnip.extra.MatchTSNodeOpts Passed in by the user, describes how to ----select a node from the tree via a query and captures. ----@field query? string A query, as text ----@field query_name? string The name of a query (passed to `vim.treesitter.query.get`). ----@field query_lang string The language of the query. ----@field select? LuaSnip.extra.BuiltinMatchSelector|LuaSnip.extra.MatchSelector ----@field match_captures? string|string[] - ----@class LuaSnip.extra.MatchedTSNodeInfo ----@field capture_name string ----@field node TSNode - ----@alias LuaSnip.extra.BuiltinMatchSelector ----| '"any"' # The default selector, selects the first match but not return all captures ----| '"shortest"' # Selects the shortest match, return all captures too ----| '"longest"' # Selects the longest match, return all captures too - ----Call record repeatedly to record all matches/nodes, retrieve once there are no more matches ----@class LuaSnip.extra.MatchSelector ----@field record fun(ts_match: TSMatch?, node: TSNode): boolean return true if recording can be aborted ---- (because the best match has been found) ----@field retrieve fun(): TSMatch?,TSNode? return the best match, as determined by this selector. - ----@alias LuaSnip.extra.MatchTSNodeFunc fun(parser: LuaSnip.extra.TSParser, cursor: LuaSnip.Cursor): LuaSnip.extra.NamedTSMatch?,TSNode? - ----@alias LuaSnip.extra.NamedTSMatch table diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/_lambda.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/_lambda.lua deleted file mode 100644 index cea4490d..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/_lambda.lua +++ /dev/null @@ -1,377 +0,0 @@ --- Mostly borrowed from https://github.com/lunarmodules/Penlight/ with just some changes to use --- neovim internal functions and reformat --- Copyright (C) 2009-2016 Steve Donovan, David Manura. - -local concat, append = table.concat, table.insert -local map = vim.tbl_map - -local _DEBUG = rawget(_G, "_DEBUG") - -local function assert_arg(n, val, tp, verify, msg, lev) - if type(val) ~= tp then - error( - ("argument %d expected a '%s', got a '%s'"):format(n, tp, type(val)), - lev or 2 - ) - end - if verify and not verify(val) then - error(("argument %d: '%s' %s"):format(n, val, msg), lev or 2) - end -end - -local lambda = {} - --- metatable for Placeholder Expressions (PE) -local _PEMT = {} - -local function P(t) - setmetatable(t, _PEMT) - return t -end - -lambda.PE = P - -local function isPE(obj) - return getmetatable(obj) == _PEMT -end - -lambda.isPE = isPE - --- construct a placeholder variable (e.g _1 and _2) -local function PH(idx) - return P({ op = "X", repr = "args[" .. idx .. "]", index = idx }) -end - --- construct a constant placeholder variable (e.g _C1 and _C2) -local function CPH(idx) - return P({ op = "X", repr = "_C" .. idx, index = idx }) -end - -lambda._1, lambda._2, lambda._3, lambda._4, lambda._5 = - PH(1), PH(2), PH(3), PH(4), PH(5) -lambda._0 = P({ op = "X", repr = "...", index = 0 }) - -function lambda.Var(name) - local ls = vim.split(name, "[%s,]+") - local res = {} - for i = 1, #ls do - append(res, P({ op = "X", repr = ls[i], index = 0 })) - end - return unpack(res) -end - -function lambda._(value) - return P({ op = "X", repr = value, index = "wrap" }) -end - --- unknown keys are some named variable. -setmetatable(lambda, { - __index = function(_, key) - -- \\n to be correctly interpreted in `load()`. - return P({ - op = "X", - repr = "args." .. key, - index = 0, - }) - end, -}) - -local repr - -lambda.Nil = lambda.Var("nil") - -function _PEMT.__index(obj, key) - return P({ op = "[]", obj, key }) -end - -function _PEMT.__call(fun, ...) - return P({ op = "()", fun, ... }) -end - -function _PEMT.__tostring(e) - return repr(e) -end - -function _PEMT.__unm(arg) - return P({ op = "unm", arg }) -end - -function lambda.Not(arg) - return P({ op = "not", arg }) -end - -function lambda.Len(arg) - return P({ op = "#", arg }) -end - -local function binreg(context, t) - for name, op in pairs(t) do - rawset(context, name, function(x, y) - return P({ op = op, x, y }) - end) - end -end - -local function import_name(name, fun, context) - rawset(context, name, function(...) - return P({ op = "()", fun, ... }) - end) -end - -local imported_functions = {} - -local function is_global_table(n) - return type(_G[n]) == "table" -end - ---- wrap a table of functions. This makes them available for use in --- placeholder expressions. --- @string tname a table name --- @tab context context to put results, defaults to environment of caller -function lambda.import(tname, context) - assert_arg( - 1, - tname, - "string", - is_global_table, - "arg# 1: not a name of a global table" - ) - local t = _G[tname] - context = context or _G - for name, fun in pairs(t) do - import_name(name, fun, context) - imported_functions[fun] = name - end -end - ---- register a function for use in placeholder expressions. --- @lambda fun a function --- @string[opt] name an optional name --- @return a placeholder functiond -function lambda.register(fun, name) - assert_arg(1, fun, "function") - if name then - assert_arg(2, name, "string") - imported_functions[fun] = name - end - return function(...) - return P({ op = "()", fun, ... }) - end -end - -function lambda.lookup_imported_name(fun) - return imported_functions[fun] -end - -local function _arg(...) - return ... -end - -function lambda.Args(...) - return P({ op = "()", _arg, ... }) -end - --- binary operators with their precedences (see Lua manual) --- precedences might be incremented by one before use depending on --- left- or right-associativity, space them out -local binary_operators = { - ["or"] = 0, - ["and"] = 2, - ["=="] = 4, - ["~="] = 4, - ["<"] = 4, - [">"] = 4, - ["<="] = 4, - [">="] = 4, - [".."] = 6, - ["+"] = 8, - ["-"] = 8, - ["*"] = 10, - ["/"] = 10, - ["%"] = 10, - ["^"] = 14, -} - --- unary operators with their precedences -local unary_operators = { - ["not"] = 12, - ["#"] = 12, - ["unm"] = 12, -} - --- comparisons (as prefix functions) -binreg(lambda, { - And = "and", - Or = "or", - Eq = "==", - Lt = "<", - Gt = ">", - Le = "<=", - Ge = ">=", -}) - --- standard binary operators (as metamethods) -binreg(_PEMT, { - __add = "+", - __sub = "-", - __mul = "*", - __div = "/", - __mod = "%", - __pow = "^", - __concat = "..", -}) - -binreg(_PEMT, { __eq = "==" }) - ---- all elements of a table except the first. --- @tab ls a list-like table. -function lambda.tail(ls) - assert_arg(1, ls, "table") - local res = {} - for i = 2, #ls do - append(res, ls[i]) - end - return res -end - ---- create a string representation of a placeholder expression. --- @param e a placeholder expression --- @param lastpred not used -function repr(e, lastpred) - local tail = lambda.tail - if isPE(e) then - local pred = binary_operators[e.op] or unary_operators[e.op] - if pred then - -- binary or unary operator - local s - if binary_operators[e.op] then - local left_pred = pred - local right_pred = pred - if e.op == ".." or e.op == "^" then - left_pred = left_pred + 1 - else - right_pred = right_pred + 1 - end - local left_arg = repr(e[1], left_pred) - local right_arg = repr(e[2], right_pred) - s = left_arg .. " " .. e.op .. " " .. right_arg - else - local op = e.op == "unm" and "-" or e.op - s = op .. " " .. repr(e[1], pred) - end - if lastpred and lastpred > pred then - s = "(" .. s .. ")" - end - return s - else -- either postfix, or a placeholder - local ls = map(repr, e) - if e.op == "[]" then - return ls[1] .. "[" .. ls[2] .. "]" - elseif e.op == "()" then - local fn - if ls[1] ~= nil then -- was _args, undeclared! - fn = ls[1] - else - fn = "" - end - return fn .. "(" .. concat(tail(ls), ",") .. ")" - else - return e.repr - end - end - elseif type(e) == "string" then - return '"' .. e .. '"' - elseif type(e) == "function" then - local name = lambda.lookup_imported_name(e) - if name then - return name - else - return tostring(e) - end - else - return tostring(e) --should not really get here! - end -end -lambda.repr = repr - --- collect all the non-PE values in this PE into vlist, and replace each occurence --- with a constant PH (_C1, etc). Return the maximum placeholder index found. -local collect_values -function collect_values(e, vlist) - if isPE(e) then - if e.op ~= "X" then - local m = 0 - for i = 1, #e do - local subx = e[i] - local pe = isPE(subx) - if pe then - if subx.op == "X" and subx.index == "wrap" then - subx = subx.repr - pe = false - else - m = math.max(m, collect_values(subx, vlist)) - end - end - if not pe then - append(vlist, subx) - e[i] = CPH(#vlist) - end - end - return m - else -- was a placeholder, it has an index... - return e.index - end - else -- plain value has no placeholder dependence - return 0 - end -end -lambda.collect_values = collect_values - ---- instantiate a PE into an actual function. First we find the largest placeholder used, --- e.g. _2; from this a list of the formal parameters can be build. Then we collect and replace --- any non-PE values from the PE, and build up a constant binding list. --- Finally, the expression can be compiled, and e.__PE_function is set. --- @param e a placeholder expression --- @return a function -function lambda.instantiate(e) - local consts, values = {}, {} - local rep, err, fun - local n = lambda.collect_values(e, values) - for i = 1, #values do - append(consts, "_C" .. i) - if _DEBUG then - print(i, values[i]) - end - end - - consts = concat(consts, ",") - rep = repr(e) - local fstr = ("return function(%s) return function(args) return %s end end"):format( - consts, - rep - ) - if _DEBUG then - print(fstr) - end - fun, err = load(fstr, "fun") - if not fun then - return nil, err - end - fun = fun() -- get wrapper - fun = fun(unpack(values)) -- call wrapper (values could be empty) - e.__PE_function = fun - return fun -end - ---- instantiate a PE unless it has already been done. --- @param e a placeholder expression --- @return the function -function lambda.I(e) - if rawget(e, "__PE_function") then - return e.__PE_function - else - return lambda.instantiate(e) - end -end - -return lambda diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/_parser_combinator.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/_parser_combinator.lua deleted file mode 100644 index b761b3c7..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/_parser_combinator.lua +++ /dev/null @@ -1,94 +0,0 @@ --- Minimal parser combinator, --- only for internal use so not exposed elsewhere nor documented in the oficial doc --- -local M = {} - --- Consumes strings matching a pattern, generates the matched string -function M.pattern(pat) - return function(text, pos) - local s, e = text:find(pat, pos) - - if s then - local v = text:sub(s, e) - return true, v, pos + #v - else - return false, nil, pos - end - end -end - --- Matches whatever `p matches and generates whatever p generates after --- transforming it with `f -function M.map(p, f) - return function(text, pos) - local succ, val, new_pos = p(text, pos) - if succ then - return true, f(val), new_pos - end - return false, nil, pos - end -end - --- Matches and generates the same as the first of it's children that matches something -function M.any(...) - local parsers = { ... } - return function(text, pos) - for _, p in ipairs(parsers) do - local succ, val, new_pos = p(text, pos) - if succ then - return true, val, new_pos - end - end - return false, nil, pos - end -end - --- Matches all what its children do in sequence, generates a table of its children generations -function M.seq(...) - local parsers = { ... } - return function(text, pos) - local original_pos = pos - local values = {} - for _, p in ipairs(parsers) do - local succ, val, new_pos = p(text, pos) - pos = new_pos - if not succ then - return false, nil, original_pos - end - table.insert(values, val) - end - return true, values, pos - end -end - --- Matches cero or more times what it child do in sequence, generates a table with those generations -function M.star(p) - return function(text, pos) - local len = #text - local values = {} - - while pos <= len do - local succ, val, new_pos = p(text, pos) - if succ then - pos = new_pos - table.insert(values, val) - else - break - end - end - return #values > 0, values, pos - end -end - --- Consumes a literal string, does not generates -function M.literal(t) - return function(text, pos) - if text:sub(pos, pos + #t - 1) == t then - return true, nil, pos + #t - else - return false, text:sub(pos, pos + #t), pos + #t - end - end -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/_treesitter.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/_treesitter.lua deleted file mode 100644 index 69aef027..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/_treesitter.lua +++ /dev/null @@ -1,433 +0,0 @@ -local util = require("luasnip.util.util") -local tbl = require("luasnip.util.table") - -local function get_lang(bufnr) - local ft = vim.api.nvim_buf_get_option(bufnr, "ft") - local lang = vim.treesitter.language.get_lang(ft) or ft - return lang -end - --- Inspect node ----@param node TSNode? ----@return string -local function inspect_node(node) - if node == nil then - return "nil" - end - - local start_row, start_col, end_row, end_col = - vim.treesitter.get_node_range(node) - - return ("%s [%d, %d] [%d, %d]"):format( - node:type(), - start_row, - start_col, - end_row, - end_col - ) -end - ----@param bufnr number ----@param region LuaSnip.MatchRegion ----@return LanguageTree, string -local function reparse_buffer_after_removing_match(bufnr, region) - local lang = get_lang(bufnr) - - -- have to get entire buffer, a pattern-match may include lines behind the trigger. - local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) - -- region is 0-indexed, lines and strings 1-indexed. - local region_line = lines[region.row + 1] - -- sub includes end, want to exclude it. - local left_part = region_line:sub(1, region.col_range[1] + 1 - 1) - local right_part = region_line:sub(region.col_range[2] + 1) - - lines[region.row + 1] = left_part .. right_part - - local source = table.concat(lines, "\n") - - ---@type LanguageTree - local parser = vim.treesitter.get_string_parser(source, lang, nil) - parser:parse() - return parser, source -end - ----@class LuaSnip.extra.FixBufferContext ----@field ori_bufnr number ----@field ori_text string ----@field region LuaSnip.MatchRegion -local FixBufferContext = {} - ----@param ori_bufnr number ----@param region LuaSnip.MatchRegion ----@return LuaSnip.extra.FixBufferContext -function FixBufferContext.new(ori_bufnr, region, region_content) - local o = { - ori_bufnr = ori_bufnr, - ori_text = region_content, - region = region, - } - setmetatable(o, { - __index = FixBufferContext, - }) - - return o -end - -function FixBufferContext:enter() - vim.api.nvim_buf_set_text( - self.ori_bufnr, - self.region.row, - self.region.col_range[1], - self.region.row, - self.region.col_range[2], - { "" } - ) - - local parser, source = - vim.treesitter.get_parser(self.ori_bufnr), self.ori_bufnr - parser:parse() - - return parser, source -end - -function FixBufferContext:leave() - vim.api.nvim_buf_set_text( - self.ori_bufnr, - self.region.row, - self.region.col_range[1], - self.region.row, - self.region.col_range[1], - { self.ori_text } - ) - - -- The cursor does not necessarily move with the insertion, and has to be - -- restored manually. - -- when making this work for expansion away from cursor, store cursor-pos - -- in self. - vim.api.nvim_win_set_cursor( - 0, - { self.region.row + 1, self.region.col_range[2] } - ) - - local parser, source = - vim.treesitter.get_parser(self.ori_bufnr), self.ori_bufnr - parser:parse() - return parser, source -end - --- iterate over all -local function captures_iter(captures) - -- turn string/string[] into map: string -> bool, for querying whether some - -- string is present in captures. - local capture_map = tbl.list_to_set(captures) - - -- receives the query and the iterator over all its matches. - return function(query, match_iter) - local current_match - local current_capture_id - local iter - local pattern - - iter = function() - -- if there is no current match to continue, - if not current_match then - pattern, current_match, _ = match_iter() - - -- occurs once there are no more matches. - if not pattern then - return nil - end - end - while true do - local node - current_capture_id, node = - next(current_match, current_capture_id) - if not current_capture_id then - break - end - - local capture_name = query.captures[current_capture_id] - - if capture_map[capture_name] then - return current_match, node - end - end - - -- iterated over all captures of the current match, reset it to - -- retrieve the next match in the recursion. - current_match = nil - - -- tail-call-optimization! :fingers_crossed: - return iter() - end - - return iter - end -end - -local builtin_tsnode_selectors = { - any = function() - local best_node - local best_node_match - return { - record = function(match, node) - best_node = node - best_node_match = match - -- abort immediately, we just want any match. - return true - end, - retrieve = function() - return best_node_match, best_node - end, - } - end, - shortest = function() - local best_node - local best_node_match - - -- end is already equal, only have to compare start. - local best_node_start - return { - record = function(match, node) - local start_row, start_col, _, _ = - vim.treesitter.get_node_range(node) - if - (best_node == nil) - or (start_row > best_node_start[1]) - or ( - start_row == best_node_start[1] - and start_col > best_node_start[2] - ) - then - best_node = node - best_node_match = match - best_node_start = { start_row, start_col } - end - -- don't abort, have to see all potential nodes to find shortest match. - return false - end, - retrieve = function() - return best_node_match, best_node - end, - } - end, - longest = function() - local best_node - local best_node_match - - -- end is already equal, only have to compare start. - local best_node_start - return { - record = function(match, node) - local start_row, start_col, _, _ = - vim.treesitter.get_node_range(node) - if - (best_node == nil) - or (start_row < best_node_start[1]) - or ( - start_row == best_node_start[1] - and start_col < best_node_start[2] - ) - then - best_node = node - best_node_match = match - best_node_start = { start_row, start_col } - end - -- don't abort, have to see all potential nodes to find longest match. - return false - end, - retrieve = function() - return best_node_match, best_node - end, - } - end, -} - ----@class LuaSnip.extra.TSParser ----@field parser LanguageTree ----@field source string|number -local TSParser = {} - ----@param bufnr number? ----@param parser LanguageTree ----@param source string|number ----@return LuaSnip.extra.TSParser? -function TSParser.new(bufnr, parser, source) - bufnr = bufnr or vim.api.nvim_get_current_buf() - - local o = { - parser = parser, - source = source, - } - - setmetatable(o, { - __index = TSParser, - ---@param self LuaSnip.extra.TSParser - ---@return string - __tostring = function(self) - return ("trees: %d, source: %s"):format( - #self.parser:trees(), - type(self.source) == "number" and tostring(self.source) - or "[COPIED]" - ) - end, - }) - return o -end - ----@param pos { [1]: number, [2]: number }? ----@return TSNode? -function TSParser:get_node_at_pos(pos) - pos = vim.F.if_nil(pos, util.get_cursor_0ind()) - local row, col = pos[1], pos[2] - assert( - row >= 0 and col >= 0, - "Invalid position: row and col must be non-negative" - ) - local range = { row, col, row, col } - return self.parser:named_node_for_range( - range, - { ignore_injections = false } - ) -end - ----Get the root for the smallest tree containing `pos`. ----@param pos { [1]: number, [2]: number } ----@return TSNode? -function TSParser:root_at(pos) - local tree = self.parser:tree_for_range( - { pos[1], pos[2], pos[1], pos[2] }, - { ignore_injections = false } - ) - if not tree then - return nil - end - - return tree:root() -end - ----@param match_opts LuaSnip.extra.EffectiveMatchTSNodeOpts ----@param pos { [1]: number, [2]: number } ----@return LuaSnip.extra.NamedTSMatch?, TSNode? -function TSParser:match_at(match_opts, pos) - -- Since we want to find a match to the left of pos, and if we accept there - -- has to be at least one character (I assume), we should probably not look - -- for the tree containing `pos`, since that might be the wrong one (if - -- injected languages are in play). - local root = self:root_at({ pos[1], pos[2] - 1 }) - if root == nil then - return nil, nil - end - local root_from_line, _, root_to_line, _ = root:range() - - local query = match_opts.query - local selector = match_opts.selector() - local next_ts_match = - -- end-line is excluded by iter_matches, if the column of root_to - -- greater than 0, we would erroneously ignore a line that could - -- contain our match. - query:iter_matches(root, self.source, root_from_line, root_to_line + 1) - - for match, node in match_opts.generator(query, next_ts_match) do - -- false: don't include bytes. - local _, _, end_row, end_col = node:range(false) - if end_row == pos[1] and end_col == pos[2] then - if selector.record(match, node) then - -- should abort iteration - break - end - end - end - - local best_match, node = selector.retrieve() - if not best_match then - return nil, nil - end - - -- map captures via capture-name, not id. - local named_captures_match = {} - for id, capture_node in pairs(best_match) do - named_captures_match[query.captures[id]] = capture_node - end - return named_captures_match, node -end - ----@param node TSNode ----@return string -function TSParser:get_node_text(node) - -- not sure what happens if this is multiline. - return vim.treesitter.get_node_text(node, self.source) -end - ----@param root TSNode ----@param n number ----@param matcher fun(node:TSNode):boolean|nil ----@return TSNode? -local function find_nth_parent(root, n, matcher) - local parent = root - matcher = matcher or function() - return true - end - local i = 0 - while i < n do - if not parent or not matcher(parent) then - return nil - end - parent = parent:parent() - i = i + 1 - end - if not parent or not matcher(parent) then - return nil - end - return parent -end - ----@param root TSNode ----@param matcher fun(node:TSNode):boolean|nil -local function find_topmost_parent(root, matcher) - ---@param node TSNode? - ---@return TSNode? - local function _impl(node) - if node == nil then - return nil - end - local current = nil - if matcher == nil or matcher(node) then - current = node - end - return vim.F.if_nil(_impl(node:parent()), current) - end - - return _impl(root) -end - ----@param root TSNode ----@param matcher fun(node:TSNode):boolean|nil -local function find_first_parent(root, matcher) - ---@param node TSNode? - ---@return TSNode? - local function _impl(node) - if node == nil then - return nil - end - if matcher == nil or matcher(node) then - return node - end - return _impl(node:parent()) - end - - return _impl(root) -end - -return { - get_lang = get_lang, - reparse_buffer_after_removing_match = reparse_buffer_after_removing_match, - TSParser = TSParser, - FixBufferContext = FixBufferContext, - find_topmost_parent = find_topmost_parent, - find_first_parent = find_first_parent, - find_nth_parent = find_nth_parent, - inspect_node = inspect_node, - captures_iter = captures_iter, - builtin_tsnode_selectors = builtin_tsnode_selectors, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/conditions/expand.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/conditions/expand.lua deleted file mode 100644 index e97d85fa..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/conditions/expand.lua +++ /dev/null @@ -1,14 +0,0 @@ -local cond_obj = require("luasnip.extras.conditions") - --- use the functions from show as basis and extend/overwrite functions specific for expand here -local M = vim.deepcopy(require("luasnip.extras.conditions.show")) ------------------------ --- PRESET CONDITIONS -- ------------------------ -local function line_begin(line_to_cursor, matched_trigger) - -- +1 because `string.sub("abcd", 1, -2)` -> abc - return line_to_cursor:sub(1, -(#matched_trigger + 1)):match("^%s*$") -end -M.line_begin = cond_obj.make_condition(line_begin) - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/conditions/init.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/conditions/init.lua deleted file mode 100644 index db9ff39f..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/conditions/init.lua +++ /dev/null @@ -1,55 +0,0 @@ -local M = {} - ------------------------ --- CONDITION OBJECTS -- ------------------------ -local condition_mt = { - -- logic operators - -- not '-' - __unm = function(o1) - return M.make_condition(function(...) - return not o1(...) - end) - end, - -- or '+' - __add = function(o1, o2) - return M.make_condition(function(...) - return o1(...) or o2(...) - end) - end, - __sub = function(o1, o2) - return M.make_condition(function(...) - return o1(...) and not o2(...) - end) - end, - -- and '*' - __mul = function(o1, o2) - return M.make_condition(function(...) - return o1(...) and o2(...) - end) - end, - -- xor '^' - __pow = function(o1, o2) - return M.make_condition(function(...) - return o1(...) ~= o2(...) - end) - end, - -- xnor '%' - -- might be counter intuitive, but as we can't use '==' (must return bool) - -- it's best to use something weird (doesn't have to be used) - __mod = function(o1, o2) - return function(...) - return o1(...) == o2(...) - end - end, - -- use table like a function by overloading __call - __call = function(tab, line_to_cursor, matched_trigger, captures) - return tab.func(line_to_cursor, matched_trigger, captures) - end, -} - -function M.make_condition(func) - return setmetatable({ func = func }, condition_mt) -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/conditions/show.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/conditions/show.lua deleted file mode 100644 index eb11cf4e..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/conditions/show.lua +++ /dev/null @@ -1,21 +0,0 @@ -local cond_obj = require("luasnip.extras.conditions") - -local M = {} ------------------------ --- PRESET CONDITIONS -- ------------------------ -local function line_end(line_to_cursor) - local line = vim.api.nvim_get_current_line() - -- looks pretty inefficient, but as lue interns strings, this is just a - -- comparision of pointers (which probably is faster than calculate the - -- length and then checking) - return line_to_cursor == line -end -M.line_end = cond_obj.make_condition(line_end) - -local function has_selected_text() - return vim.b.LUASNIP_TM_SELECT ~= nil -end -M.has_selected_text = cond_obj.make_condition(has_selected_text) - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/expand_conditions.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/expand_conditions.lua deleted file mode 100644 index 69c662fa..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/expand_conditions.lua +++ /dev/null @@ -1 +0,0 @@ -return require("luasnip.extras.conditions.expand") diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/filetype_functions.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/filetype_functions.lua deleted file mode 100644 index e7011f0c..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/filetype_functions.lua +++ /dev/null @@ -1,89 +0,0 @@ -local function fts_from_ts_lang(lang) - local fts = {} - -- In case of someone using nvim <= 0.9 - if vim.treesitter.language and vim.treesitter.language.get_filetypes then - fts = vim.treesitter.language.get_filetypes(lang) - end - -- Keep lang as part of the result, for backward compatibility. - -- If lang is already part of fts, one entry will be removed by deduplicate - -- in get_snippet_filetypes(). - table.insert(fts, lang) - return fts -end - -local function from_cursor_pos() - -- get_parser errors if parser not present (no grammar for language). - local has_parser, parser = pcall(vim.treesitter.get_parser) - - if has_parser then - local cursor = require("luasnip.util.util").get_cursor_0ind() - -- assumption: languagetree uses 0-indexed byte-ranges. - local lang = parser - :language_for_range({ - cursor[1], - cursor[2], - cursor[1], - cursor[2], - }) - :lang() - return fts_from_ts_lang(lang) - else - return {} - end -end - -local function from_filetype() - return vim.split(vim.bo.filetype, ".", { plain = true, trimemtpy = false }) -end - --- NOTE: Beware that the resulting filetypes may differ from the ones in `vim.bo.filetype`. (for --- example the filetype for LaTeX is 'latex' and not 'tex' as in `vim.bo.filetype`) -- -local function from_pos_or_filetype() - local from_cursor = from_cursor_pos() - if not vim.tbl_isempty(from_cursor) then - return from_cursor - else - return from_filetype() - end -end - -local function from_filetype_load(bufnr) - return vim.split(vim.api.nvim_buf_get_option(bufnr, "filetype"), ".", true) -end - -local function extend_load_ft(extend_fts) - setmetatable(extend_fts, { - -- if the filetype is not extended, only it itself should be loaded. - -- preventing ifs via __index. - __index = function(t, ft) - local val = { ft } - rawset(t, ft, val) - return val - end, - }) - - for ft, _ in pairs(extend_fts) do - -- append the regular filetype to the extend-filetypes. - table.insert(extend_fts[ft], ft) - end - - return function(bufnr) - local fts = - vim.split(vim.api.nvim_buf_get_option(bufnr, "filetype"), ".", true) - local res = {} - - for _, ft in ipairs(fts) do - vim.list_extend(res, extend_fts[ft]) - end - - return res - end -end - -return { - from_filetype = from_filetype, - from_cursor_pos = from_cursor_pos, - from_pos_or_filetype = from_pos_or_filetype, - from_filetype_load = from_filetype_load, - extend_load_ft = extend_load_ft, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/fmt.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/fmt.lua deleted file mode 100644 index 4d8e3152..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/fmt.lua +++ /dev/null @@ -1,231 +0,0 @@ -local text_node = require("luasnip.nodes.textNode").T -local wrap_nodes = require("luasnip.util.util").wrap_nodes -local extend_decorator = require("luasnip.util.extend_decorator") -local Str = require("luasnip.util.str") -local rp = require("luasnip.extras").rep - --- https://gist.github.com/tylerneylon/81333721109155b2d244 -local function copy3(obj, seen) - -- Handle non-tables and previously-seen tables. - if type(obj) ~= "table" then - return obj - end - if seen and seen[obj] then - return seen[obj] - end - - -- New table; mark it as seen an copy recursively. - local s = seen or {} - local res = {} - s[obj] = res - for k, v in next, obj do - res[copy3(k, s)] = copy3(v, s) - end - return setmetatable(res, getmetatable(obj)) -end - --- Interpolate elements from `args` into format string with placeholders. --- --- The placeholder syntax for selecting from `args` is similar to fmtlib and --- Python's .format(), with some notable differences: --- * no format options (like `{:.2f}`) --- * 1-based indexing --- * numbered/auto-numbered placeholders can be mixed; numbered ones set the --- current index to new value, so following auto-numbered placeholders start --- counting from the new value (e.g. `{} {3} {}` is `{1} {3} {4}`) --- --- Arguments: --- fmt: string with placeholders --- args: table with list-like and/or map-like keys --- opts: --- delimiters: string, 2 distinct characters (left, right), default "{}" --- strict: boolean, set to false to allow for unused `args`, default true --- repeat_duplicates: boolean, repeat nodes which have jump_index instead of copying them, default false --- Returns: a list of strings and elements of `args` inserted into placeholders -local function interpolate(fmt, args, opts) - local defaults = { - delimiters = "{}", - strict = true, - repeat_duplicates = false, - } - opts = vim.tbl_extend("force", defaults, opts or {}) - - -- sanitize delimiters - assert( - #opts.delimiters == 2, - 'Currently only single-char delimiters are supported, e.g. delimiters="{}" (left, right)' - ) - assert( - opts.delimiters:sub(1, 1) ~= opts.delimiters:sub(2, 2), - "Delimiters must be two _different_ characters" - ) - local delimiters = { - left = opts.delimiters:sub(1, 1), - right = opts.delimiters:sub(2, 2), - esc_left = vim.pesc(opts.delimiters:sub(1, 1)), - esc_right = vim.pesc(opts.delimiters:sub(2, 2)), - } - - -- manage insertion of text/args - local elements = {} - local last_index = 0 - local used_keys = {} - - local add_text = function(text) - if #text > 0 then - table.insert(elements, text) - end - end - local add_arg = function(placeholder) - local num = tonumber(placeholder) - local key - if num then -- numbered placeholder - last_index = num - key = last_index - elseif placeholder == "" then -- auto-numbered placeholder - key = last_index + 1 - last_index = key - else -- named placeholder - key = placeholder - end - assert( - args[key], - string.format( - "Missing key `%s` in format arguments: `%s`", - key, - fmt - ) - ) - -- if the node was already used, insert a copy of it. - -- The nodes are modified in-place as part of constructing the snippet, - -- modifying one node twice will lead to UB. - if used_keys[key] then - local jump_index = args[key]:get_jump_index() -- For nodes that don't have a jump index, copy it instead - if not opts.repeat_duplicates or jump_index == nil then - table.insert(elements, copy3(args[key])) - else - table.insert(elements, rp(jump_index)) - end - else - table.insert(elements, args[key]) - used_keys[key] = true - end - end - - -- iterate keeping a range from previous match, e.g. (not in_placeholder vs in_placeholder) - -- "Sample {2} string {3}." OR "Sample {2} string {3}." - -- left^--------^right OR left^-^right - local pattern = - string.format("[%s%s]", delimiters.esc_left, delimiters.esc_right) - local in_placeholder = false - local left = 0 - - while true do - local right = fmt:find(pattern, left + 1) - -- if not found, add the remaining part of string and finish - if right == nil then - assert( - not in_placeholder, - string.format('Missing closing delimiter: "%s"', fmt:sub(left)) - ) - add_text(fmt:sub(left + 1)) - break - end - -- check if the delimiters are escaped - local delim = fmt:sub(right, right) - local next_char = fmt:sub(right + 1, right + 1) - if not in_placeholder and delim == next_char then - -- add the previous part of the string with a single delimiter - add_text(fmt:sub(left + 1, right)) - -- and jump over the second one - left = right + 1 - -- "continue" - else -- non-escaped delimiter - assert( - delim - == (in_placeholder and delimiters.right or delimiters.left), - string.format( - 'Found unescaped %s %s placeholder; format[%d:%d]="%s"', - delim, - in_placeholder and "inside" or "outside", - left, - right, - fmt:sub(left, right) - ) - ) - -- add arg/text depending on current state - local add = in_placeholder and add_arg or add_text - add(fmt:sub(left + 1, right - 1)) - -- update state - left = right - in_placeholder = delim == delimiters.left - end - end - - -- sanity check: all arguments were used - if opts.strict then - for key, _ in pairs(args) do - assert( - used_keys[key], - string.format("Unused argument: args[%s]", key) - ) - end - end - - return elements -end - --- Use a format string with placeholders to interpolate nodes. --- --- See `interpolate` documentation for details on the format. --- --- Arguments: --- str: format string --- nodes: snippet node or list of nodes --- opts: optional table --- trim_empty: boolean, remove whitespace-only first/last lines, default true --- dedent: boolean, remove all common indent in `str`, default true --- ... the rest is passed to `interpolate` --- Returns: list of snippet nodes -local function format_nodes(str, nodes, opts) - local defaults = { - trim_empty = true, - dedent = true, - } - opts = vim.tbl_extend("force", defaults, opts or {}) - - -- allow to pass a single node - nodes = wrap_nodes(nodes) - - -- optimization: avoid splitting multiple times - local lines = nil - - lines = vim.split(str, "\n", true) - Str.process_multiline(lines, opts) - str = table.concat(lines, "\n") - - -- pop format_nodes's opts - for key, _ in ipairs(defaults) do - opts[key] = nil - end - - local parts = interpolate(str, nodes, opts) - return vim.tbl_map(function(part) - -- wrap strings in text nodes - if type(part) == "string" then - return text_node(vim.split(part, "\n", true)) - else - return part - end - end, parts) -end - -extend_decorator.register(format_nodes, { arg_indx = 3 }) - -return { - interpolate = interpolate, - format_nodes = format_nodes, - -- alias - fmt = format_nodes, - fmta = extend_decorator.apply(format_nodes, { delimiters = "<>" }), -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/init.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/init.lua deleted file mode 100644 index c4be557d..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/init.lua +++ /dev/null @@ -1,164 +0,0 @@ -local F = require("luasnip.nodes.functionNode").F -local SN = require("luasnip.nodes.snippet").SN -local D = require("luasnip.nodes.dynamicNode").D -local I = require("luasnip.nodes.insertNode").I - -local lambda = {} - -local function _concat(lines) - return table.concat(lines, "\n") -end - -local function make_lambda_args(node_args, imm_parent) - local snip = imm_parent.snippet - -- turn args' table-multilines into \n-multilines (needs to be possible - -- to process args with luas' string-functions). - local args = vim.tbl_map(_concat, node_args) - - setmetatable(args, { - __index = function(table, key) - local val - -- key may be capture or env-variable. - local num = key:match("CAPTURE(%d+)") - if num then - val = snip.captures[tonumber(num)] - else - -- env may be string or table. - if type(snip.env[key]) == "table" then - -- table- to \n-multiline. - val = _concat(snip.env[key]) - else - val = snip.env[key] - end - end - rawset(table, key, val) - return val - end, - }) - return args -end - -local function expr_to_fn(expr) - local _lambda = require("luasnip.extras._lambda") - - local fn_code = _lambda.instantiate(expr) - local function fn(args, snip) - -- to be sure, lambda may end with a `match` returning nil. - local out = fn_code(make_lambda_args(args, snip)) or "" - return vim.split(out, "\n") - end - return fn -end - -local LM = {} -function LM:__index(key) - return require("luasnip.extras._lambda")[key] -end -function LM:__call(expr, input_ids) - return F(expr_to_fn(expr), input_ids) -end - -setmetatable(lambda, LM) - -local function to_function(val, use_re) - if type(val) == "function" then - return val - end - if type(val) == "string" and not use_re then - return function() - return val - end - end - if type(val) == "string" and use_re then - return function(args) - return _concat(args[1]):match(val) - end - end - if lambda.isPE(val) then - local lmb = lambda.instantiate(val) - return function(args, snip) - return lmb(make_lambda_args(args, snip)) - end - end - assert(false, "Can't convert argument to function") -end - -local function match(index, _match, _then, _else) - assert(_match, "You have to pass at least 2 arguments") - - _match = to_function(_match, true) - _then = to_function(_then or function(args, snip) - local match_return = _match(args, snip) - return ( - ( - type(match_return) == "string" - -- _assume_ table of string. - or type(match_return) == "table" - ) and match_return - ) or "" - end) - _else = to_function(_else or "") - - local function func(args, snip) - local out = nil - if _match(args, snip) then - out = _then(args, snip) - else - out = _else(args, snip) - end - -- \n is used as a line-separator for simple strings. - return type(out) == "string" and vim.split(out, "\n") or out - end - - return F(func, index) -end - -return { - lambda = lambda, - match = match, - -- repeat a node. - rep = function(node_indx) - return F(function(args) - return args[1] - end, node_indx) - end, - -- Insert the output of a function. - partial = function(func, ...) - return F(function(_, _, ...) - return func(...) - end, {}, { user_args = { ... } }) - end, - nonempty = function(indx, text_if, text_if_not) - assert( - type(indx) == "number", - "this only checks one node for emptiness!" - ) - assert( - text_if, - "At least the text for nonemptiness has to be supplied." - ) - - return F(function(args) - return (args[1][1] ~= "" or #args[1] > 1) and text_if - or (text_if_not or "") - end, { - indx, - }) - end, - dynamic_lambda = function(pos, lambd, args_indcs) - local insert_preset_text_func = lambda.instantiate(lambd) - return D(pos, function(args, imm_parent) - -- to be sure, lambda may end with a `match` returning nil. - local out = insert_preset_text_func( - make_lambda_args(args, imm_parent) - ) or "" - return SN(pos, { - I(1, vim.split(out, "\n")), - }) - end, args_indcs) - end, - - --alias - l = lambda, - m = match, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/otf.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/otf.lua deleted file mode 100644 index 514ddb05..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/otf.lua +++ /dev/null @@ -1,89 +0,0 @@ -local ls = require("luasnip") -local cp = require("luasnip.util.functions").copy -local p = require("luasnip.extras._parser_combinator") -local dedent = require("luasnip.util.str").dedent -local M = {} - -local T = { EOL = "EOL", TXT = "TXT", INP = "INP" } - -local chunk = p.any( - p.map(p.literal("$$"), function() - return { T.TXT, "$" } - end), - p.map(p.literal("\n"), function() - return { T.EOL } - end), - p.map(p.seq(p.literal("$"), p.pattern("%w*")), function(c) - return { T.INP, c[1] } - end), - p.map(p.pattern("[^\n$]*"), function(c) - return { T.TXT, c } - end) -) - -M._snippet_chunks = p.star(chunk) - -function M._txt_to_snip(txt) - local t = ls.t - local s = ls.s - local i = ls.i - local f = ls.f - txt = dedent(txt) - - -- The parser does not handle empty strings - if txt == "" then - return s("", t({ "" })) - end - - local _, chunks, _ = M._snippet_chunks(txt, 1) - - local current_text_arg = { "" } - local nodes = {} - local know_inputs = {} - local last_input_pos = 0 - - for _, part in ipairs(chunks) do - if part[1] == T.TXT then - current_text_arg[#current_text_arg] = current_text_arg[#current_text_arg] - .. part[2] - elseif #current_text_arg > 1 or current_text_arg[1] ~= "" then - table.insert(nodes, t(current_text_arg)) - current_text_arg = { "" } - end - - if part[1] == T.EOL then - table.insert(current_text_arg, "") - elseif part[1] == T.INP then - local inp_pos = know_inputs[part[2]] - if inp_pos then - table.insert(nodes, f(cp, { inp_pos })) - else - last_input_pos = last_input_pos + 1 - know_inputs[part[2]] = last_input_pos - table.insert(nodes, i(last_input_pos, part[2])) - end - end - end - if #current_text_arg > 1 or current_text_arg[1] ~= "" then - table.insert(nodes, t(current_text_arg)) - end - return s("", nodes) -end - -local last_snip = nil -local last_reg = nil - --- Create snippets On The Fly --- It's advaisable not to use the default register as luasnip will probably --- override it -function M.on_the_fly(regname) - regname = regname or "" - local reg = table.concat(vim.fn.getreg(regname, 1, true), "\n") -- Avoid eol in the last line - if last_reg ~= reg then - last_reg = reg - last_snip = M._txt_to_snip(reg) - end - ls.snip_expand(last_snip) -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/postfix.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/postfix.lua deleted file mode 100644 index c951b5a8..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/postfix.lua +++ /dev/null @@ -1,75 +0,0 @@ -local snip = require("luasnip.nodes.snippet").S -local events = require("luasnip.util.events") -local extend_decorator = require("luasnip.util.extend_decorator") -local node_util = require("luasnip.nodes.util") -local util = require("luasnip.util.util") - -local matches = { - default = [[[%w%.%_%-%"%']+$]], - line = "^.+$", -} - -local function wrap_resolve_expand_params(match_pattern, user_resolve) - return function(snippet, line_to_cursor, match, captures) - if line_to_cursor:sub(1, -1 - #match):match(match_pattern) == nil then - return nil - end - - local pos = util.get_cursor_0ind() - local line_to_cursor_except_match = - line_to_cursor:sub(1, #line_to_cursor - #match) - local postfix_match = line_to_cursor_except_match:match(match_pattern) - or "" - local res = { - clear_region = { - from = { pos[1], pos[2] - #postfix_match - #match }, - to = pos, - }, - env_override = { - POSTFIX_MATCH = postfix_match, - }, - } - - if user_resolve then - local user_res = - user_resolve(snippet, line_to_cursor, match, captures) - if user_res then - res = vim.tbl_deep_extend("force", res, user_res, { - env_override = {}, - }) - else - return nil - end - end - return res - end -end - -local function postfix(context, nodes, opts) - opts = opts or {} - local user_callback = vim.tbl_get(opts, "callbacks", -1, events.pre_expand) - vim.validate({ - context = { context, { "string", "table" } }, - nodes = { nodes, "table" }, - opts = { opts, "table" }, - user_callback = { user_callback, { "nil", "function" } }, - }) - - context = node_util.wrap_context(context) - context.wordTrig = false - local match_pattern = context.match_pattern or matches.default - context.resolveExpandParams = - wrap_resolve_expand_params(match_pattern, context.resolveExpandParams) - - return snip(context, nodes, opts) -end -extend_decorator.register( - postfix, - { arg_indx = 1, extend = node_util.snippet_extend_context }, - { arg_indx = 3 } -) - -return { - postfix = postfix, - matches = matches, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/select_choice.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/select_choice.lua deleted file mode 100644 index adca3a2a..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/select_choice.lua +++ /dev/null @@ -1,25 +0,0 @@ -local session = require("luasnip.session") -local ls = require("luasnip") - -local function set_choice_callback(_, indx) - if not indx then - return - end - -- feed+immediately execute i to enter INSERT after vim.ui.input closes. - vim.api.nvim_feedkeys("i", "x", false) - ls.set_choice(indx) -end - -local function select_choice() - assert( - session.active_choice_nodes[vim.api.nvim_get_current_buf()], - "No active choiceNode" - ) - vim.ui.select( - ls.get_current_choices(), - { kind = "luasnip" }, - set_choice_callback - ) -end - -return select_choice diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/snip_location.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/snip_location.lua deleted file mode 100644 index cb4618ad..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/snip_location.lua +++ /dev/null @@ -1,190 +0,0 @@ -local Source = require("luasnip.session.snippet_collection.source") -local util = require("luasnip.util.util") - --- stylua: ignore -local tsquery_parse = - (vim.treesitter.query and vim.treesitter.query.parse) - and vim.treesitter.query.parse - or vim.treesitter.parse_query - -local M = {} - --- return: 4-tuple, {start_line, start_col, end_line, end_col}, range of --- function-call. -local function lua_find_function_call_node_at(bufnr, line) - local has_parser, parser = pcall(vim.treesitter.get_parser, bufnr, "lua") - if not has_parser then - error("Error while getting parser: " .. parser) - end - - local root = parser:parse()[1]:root() - local query = tsquery_parse("lua", [[(function_call) @f_call]]) - for _, node, _ in query:iter_captures(root, bufnr, line, line + 300) do - if node:range() == line then - return { node:range() } - end - end - error( - "Query for `(function_call)` starting at line %s did not yield a result." - ) -end - -local function range_highlight(line_start, line_end, hl_duration_ms) - -- make sure line_end is also visible. - vim.api.nvim_win_set_cursor(0, { line_end, 0 }) - vim.api.nvim_win_set_cursor(0, { line_start, 0 }) - - if hl_duration_ms > 0 then - local hl_buf = vim.api.nvim_get_current_buf() - - -- highlight snippet for 1000ms - local id = vim.api.nvim_buf_set_extmark( - hl_buf, - ls.session.ns_id, - line_start - 1, - 0, - { - -- one line below, at col 0 => entire last line is highlighted. - end_row = line_end - 1 + 1, - hl_group = "Visual", - } - ) - vim.defer_fn(function() - vim.api.nvim_buf_del_extmark(hl_buf, ls.session.ns_id, id) - end, hl_duration_ms) - end -end - -local function json_find_snippet_definition(bufnr, filetype, snippet_name) - local parser_ok, parser = pcall(vim.treesitter.get_parser, bufnr, filetype) - if not parser_ok then - error("Error while getting parser: " .. parser) - end - - local root = parser:parse()[1]:root() - -- don't want to pass through whether this file is json or jsonc, just use - -- parser-language. - local query = tsquery_parse( - parser:lang(), - ([[ - (pair - key: (string (string_content) @key (#eq? @key "%s")) - ) @snippet - ]]):format(snippet_name) - ) - for id, node, _ in query:iter_captures(root, bufnr) do - if - query.captures[id] == "snippet" - and node:parent():parent() == root - then - -- return first match. - return { node:range() } - end - end - - error( - ("Treesitter did not find the definition for snippet `%s`"):format( - snippet_name - ) - ) -end - -local function win_edit(file) - vim.api.nvim_command(":e " .. file) -end - -function M.jump_to_snippet(snip, opts) - opts = opts or {} - local hl_duration_ms = opts.hl_duration_ms or 1500 - local edit_fn = opts.edit_fn or win_edit - - local source = Source.get(snip) - if not source then - print("Snippet does not have a source.") - return - end - - edit_fn(source.file) - -- assumption: after this, file is the current buffer. - - if source.line and source.line_end then - -- happy path: we know both begin and end of snippet-definition. - range_highlight(source.line, source.line_end, hl_duration_ms) - return - end - - local fcall_range - local ft = util.ternary( - vim.bo[0].filetype ~= "", - vim.bo[0].filetype, - vim.api.nvim_buf_get_name(0):match("%.([^%.]+)$") - ) - if ft == "lua" then - if source.line then - -- in lua-file, can get region of definition via treesitter. - -- 0: current buffer. - local ok - ok, fcall_range = - pcall(lua_find_function_call_node_at, 0, source.line - 1) - if not ok then - print( - "Could not determine range for snippet-definition: " - .. fcall_range - ) - vim.api.nvim_win_set_cursor(0, { source.line, 0 }) - return - end - else - print("Can't jump to snippet: source does not provide line.") - return - end - -- matches *.json or *.jsonc. - elseif ft == "json" or ft == "jsonc" then - local ok - ok, fcall_range = pcall(json_find_snippet_definition, 0, ft, snip.name) - if not ok then - print( - "Could not determine range of snippet-definition: " - .. fcall_range - ) - return - end - else - print( - ("Don't know how to highlight snippet-definitions in current buffer `%s`.%s"):format( - vim.api.nvim_buf_get_name(0), - source.line ~= nil and " Jumping to `source.line`" or "" - ) - ) - - if source.line ~= nil then - vim.api.nvim_win_set_cursor(0, { source.line, 0 }) - end - return - end - assert(fcall_range ~= nil, "fcall_range is not nil") - - -- 1 is line_from, 3 is line_end. - -- +1 since range is row-0-indexed. - range_highlight(fcall_range[1] + 1, fcall_range[3] + 1, hl_duration_ms) - - local new_source = Source.from_location( - source.file, - { line = fcall_range[1] + 1, line_end = fcall_range[3] + 1 } - ) - Source.set(snip, new_source) -end - -function M.jump_to_active_snippet(opts) - local active_node = - require("luasnip.session").current_nodes[vim.api.nvim_get_current_buf()] - if not active_node then - print("No active snippet.") - return - end - - local snip = active_node.parent.snippet - M.jump_to_snippet(snip, opts) -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/snippet_list.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/snippet_list.lua deleted file mode 100644 index 818714bc..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/snippet_list.lua +++ /dev/null @@ -1,96 +0,0 @@ -local available = require("luasnip").available - -local function snip_info(snippet) - return { - name = snippet.name, - trigger = snippet.trigger, - description = snippet.description, - wordTrig = snippet.wordTrig and true or false, - regTrig = snippet.regTrig and true or false, - docstring = snippet:get_docstring(), - } -end - -local function get_name(buf) - return "LuaSnip://Snippets" -end - -local win_opts = { foldmethod = "indent" } -local buf_opts = { filetype = "lua" } - -local function set_win_opts(win, opts) - for opt, val in pairs(opts) do - vim.api.nvim_win_set_option(win, opt, val) - end -end - -local function set_buf_opts(buf, opts) - for opt, val in pairs(opts) do - vim.api.nvim_buf_set_option(buf, opt, val) - end -end - -local function make_scratch_buf(buf) - local opts = { - buftype = "nofile", - bufhidden = "wipe", - buflisted = false, - swapfile = false, - modified = false, - modeline = false, - } - - set_buf_opts(buf, opts) -end - -local function display_split(opts) - opts = opts or {} - opts.win_opts = opts.win_opts or win_opts - opts.buf_opts = opts.buf_opts or buf_opts - opts.get_name = opts.get_name or get_name - - return function(printer_result) - -- create and open buffer on right vertical split - vim.cmd("botright vnew") - - -- get buf and win handle - local buf = vim.api.nvim_get_current_buf() - local win = vim.api.nvim_get_current_win() - - -- make scratch buffer - vim.api.nvim_buf_set_name(buf, opts.get_name(buf)) - make_scratch_buf(buf) - - -- disable diagnostics - vim.diagnostic.disable(buf) - - -- set any extra win and buf opts - set_win_opts(win, opts.win_opts) - set_buf_opts(buf, opts.buf_opts) - - -- dump snippets - local replacement = vim.split(printer_result, "\n") - vim.api.nvim_buf_set_lines(buf, 0, 0, false, replacement) - - -- make it unmodifiable at this point - vim.api.nvim_buf_set_option(buf, "modifiable", false) - end -end - -local function open(opts) - opts = opts or {} - opts.snip_info = opts.snip_info or snip_info - opts.printer = opts.printer or vim.inspect - opts.display = opts.display or display_split() - - -- load snippets before changing windows/buffers - local snippets = available(opts.snip_info) - - -- open snippets - opts.display(opts.printer(snippets)) -end - -return { - open = open, - options = { display = display_split }, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/treesitter_postfix.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/treesitter_postfix.lua deleted file mode 100644 index b313d92d..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/extras/treesitter_postfix.lua +++ /dev/null @@ -1,324 +0,0 @@ -if vim.version().major == 0 and vim.version().minor < 9 then - -- need LanguageTree:tree_for_range and don't want to go through the hassle - -- of differentiating multiple version of query.get/parse. - error("treesitter_postfix does not support neovim < 0.9") -end - -local snip = require("luasnip.nodes.snippet").S -local ts = require("luasnip.extras._treesitter") -local node_util = require("luasnip.nodes.util") -local extend_decorator = require("luasnip.util.extend_decorator") -local tbl = require("luasnip.util.table") -local util = require("luasnip.util.util") - ---- Normalize the arguments passed to treesitter_postfix into a function that ---- returns treesitter-matches to the specified query+captures. ----@param opts LuaSnip.extra.MatchTSNodeOpts ----@return LuaSnip.extra.MatchTSNodeFunc -local function generate_match_tsnode_func(opts) - local match_opts = {} - - if opts.query then - match_opts.query = - vim.treesitter.query.parse(opts.query_lang, opts.query) - else - match_opts.query = vim.treesitter.query.get( - opts.query_lang, - opts.query_name or "luasnip" - ) - end - - match_opts.generator = ts.captures_iter(opts.match_captures or "prefix") - - if type(opts.select) == "function" then - match_opts.selector = opts.select - elseif type(opts.select) == "string" then - match_opts.selector = ts.builtin_tsnode_selectors[opts.select] - assert( - match_opts.selector, - "Selector " .. opts.select .. "is not known" - ) - else - match_opts.selector = ts.builtin_tsnode_selectors.any - end - - ---@param parser LuaSnip.extra.TSParser - ---@param pos { [1]: number, [2]: number } - return function(parser, pos) - return parser:match_at( - match_opts, --[[@as LuaSnip.extra.MatchTSNodeOpts]] - pos - ) - end -end - -local function make_reparse_enter_and_leave_func( - reparse, - bufnr, - trigger_region, - trigger -) - if reparse == "live" then - local context = ts.FixBufferContext.new(bufnr, trigger_region, trigger) - return function() - return context:enter() - end, function(_) - context:leave() - end - elseif reparse == "copy" then - local parser, source = - ts.reparse_buffer_after_removing_match(bufnr, trigger_region) - return function() - return parser, source - end, function() - parser:destroy() - end - else - return function() - return vim.treesitter.get_parser(bufnr), bufnr - end, function(_) end - end -end - ----Optionally parse the buffer ----@param reparse boolean|string|nil ----@param real_resolver function ----@return fun(snippet, line_to_cursor, matched_trigger, captures):table? -local function wrap_with_reparse_context(reparse, real_resolver) - return function(snippet, line_to_cursor, matched_trigger, captures) - local bufnr = vim.api.nvim_win_get_buf(0) - local cursor = util.get_cursor_0ind() - local trigger_region = { - row = cursor[1], - col_range = { - -- includes from, excludes to. - cursor[2] - #matched_trigger, - cursor[2], - }, - } - - local enter, leave = make_reparse_enter_and_leave_func( - reparse, - bufnr, - trigger_region, - matched_trigger - ) - local parser, source = enter() - if parser == nil or source == nil then - return nil - end - - local ret = real_resolver( - snippet, - line_to_cursor, - matched_trigger, - captures, - parser, - source, - bufnr, - { cursor[1], cursor[2] - #matched_trigger } - ) - - leave() - - return ret - end -end - ----@param match_tsnode LuaSnip.extra.MatchTSNodeFunc Determines the constraints on the matched node. -local function generate_resolve_expand_param(match_tsnode, user_resolver) - ---@param snippet any - ---@param line_to_cursor string - ---@param matched_trigger string - ---@param captures any - ---@param parser LanguageTree - ---@param source number|string - ---@param bufnr number - ---@param pos { [1]: number, [2]: number } - return function( - snippet, - line_to_cursor, - matched_trigger, - captures, - parser, - source, - bufnr, - pos - ) - local ts_parser = ts.TSParser.new(bufnr, parser, source) - if ts_parser == nil then - return - end - - local row, col = unpack(pos) - - local best_match, prefix_node = match_tsnode(ts_parser, { row, col }) - - if best_match == nil or prefix_node == nil then - return nil - end - - local start_row, start_col, _, _ = prefix_node:range() - - local env = { - LS_TSMATCH = vim.split(ts_parser:get_node_text(prefix_node), "\n"), - -- filled subsequently. - LS_TSDATA = {}, - } - for capture_name, node in pairs(best_match) do - env["LS_TSCAPTURE_" .. capture_name:upper()] = - vim.split(ts_parser:get_node_text(node), "\n") - - local from_r, from_c, to_r, to_c = node:range() - env.LS_TSDATA[capture_name] = { - type = node:type(), - range = { { from_r, from_c }, { to_r, to_c } }, - } - end - - local ret = { - trigger = matched_trigger, - captures = captures, - clear_region = { - from = { - start_row, - start_col, - }, - to = { - pos[1], - pos[2] + #matched_trigger, - }, - }, - env_override = env, - } - - if user_resolver then - local user_res = user_resolver( - snippet, - line_to_cursor, - matched_trigger, - captures - ) - if user_res then - ret = vim.tbl_deep_extend( - "force", - ret, - user_res, - { env_override = {} } - ) - else - return nil - end - end - - return ret - end -end - -local function generate_simple_parent_lookup_function(lookup_fun) - ---@param types string|string[] - ---@return LuaSnip.extra.MatchTSNodeFunc - return function(types) - local type_checker = tbl.list_to_set(types) - ---@param parser LuaSnip.extra.TSParser - ---@param pos { [1]: number, [2]: number } - return function(parser, pos) - -- check node just before the position. - local root = parser:get_node_at_pos({ pos[1], pos[2] - 1 }) - - if root == nil then - return - end - - ---@param node TSNode - local check_node_exclude_pos = function(node) - local _, _, end_row, end_col = node:range(false) - return end_row == pos[1] and end_col == pos[2] - end - ---@param node TSNode - local check_node_type = function(node) - return type_checker[node:type()] - end - - local prefix_node = lookup_fun(root, function(node) - return check_node_type(node) and check_node_exclude_pos(node) - end) - if prefix_node == nil then - return nil, nil - end - return {}, prefix_node - end - end -end - ----@param n number -local function find_nth_parent(n) - ---@param parser LuaSnip.extra.TSParser - ---@param pos { [1]: number, [2]: number } - return function(parser, pos) - local inner_node = parser:get_node_at_pos({ pos[1], pos[2] - 1 }) - - if inner_node == nil then - return - end - - ---@param node TSNode - local check_node_exclude_pos = function(node) - local _, _, end_row, end_col = node:range(false) - return end_row == pos[1] and end_col == pos[2] - end - - return {}, ts.find_nth_parent(inner_node, n, check_node_exclude_pos) - end -end - -local function treesitter_postfix(context, nodes, opts) - opts = opts or {} - vim.validate({ - context = { context, { "string", "table" } }, - nodes = { nodes, "table" }, - opts = { opts, "table" }, - }) - - context = node_util.wrap_context(context) - context.wordTrig = false - - ---@type LuaSnip.extra.MatchTSNodeFunc - local match_tsnode_func - if type(context.matchTSNode) == "function" then - match_tsnode_func = context.matchTSNode - else - match_tsnode_func = generate_match_tsnode_func(context.matchTSNode) - end - - local expand_params_resolver = generate_resolve_expand_param( - match_tsnode_func, - context.resolveExpandParams - ) - - context.resolveExpandParams = - wrap_with_reparse_context(context.reparseBuffer, expand_params_resolver) - - return snip(context, nodes, opts) -end - -extend_decorator.register( - treesitter_postfix, - { arg_indx = 1, extend = node_util.snippet_extend_context }, - { arg_indx = 3 } -) - -return { - treesitter_postfix = treesitter_postfix, - builtin = { - tsnode_matcher = { - find_topmost_types = generate_simple_parent_lookup_function( - ts.find_topmost_parent - ), - find_first_types = generate_simple_parent_lookup_function( - ts.find_first_parent - ), - find_nth_parent = find_nth_parent, - }, - }, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/health.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/health.lua deleted file mode 100644 index a06fea12..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/health.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - check = function() - vim.health.start("luasnip") - local jsregexp = require("luasnip.util.jsregexp") - if jsregexp then - vim.health.ok("jsregexp is installed") - else - vim.health.warn([[ - For Variable/Placeholder-transformations, luasnip requires - the jsregexp library. See `:h luasnip-lsp-snippets-transformations` for advice - ]]) - end - end, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/init.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/init.lua deleted file mode 100644 index 14d07443..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/init.lua +++ /dev/null @@ -1,896 +0,0 @@ -local util = require("luasnip.util.util") -local lazy_table = require("luasnip.util.lazy_table") -local types = require("luasnip.util.types") -local node_util = require("luasnip.nodes.util") - -local session = require("luasnip.session") -local snippet_collection = require("luasnip.session.snippet_collection") -local Environ = require("luasnip.util.environ") -local extend_decorator = require("luasnip.util.extend_decorator") - -local loader = require("luasnip.loaders") - -local next_expand = nil -local next_expand_params = nil -local ls -local luasnip_data_dir = vim.fn.stdpath("cache") .. "/luasnip" - -local log = require("luasnip.util.log").new("main") - -local function get_active_snip() - local node = session.current_nodes[vim.api.nvim_get_current_buf()] - if not node then - return nil - end - while node.parent do - node = node.parent - end - return node -end - --- returns matching snippet (needs to be copied before usage!) and its expand- --- parameters(trigger and captures). params are returned here because there's --- no need to recalculate them. -local function match_snippet(line, type) - return snippet_collection.match_snippet( - line, - util.get_snippet_filetypes(), - type - ) -end - --- ft: --- * string: interpreted as filetype, return corresponding snippets. --- * nil: return snippets for all filetypes: --- { --- lua = {...}, --- cpp = {...}, --- ... --- } --- opts: optional args, can contain `type`, either "snippets" or "autosnippets". --- --- return table, may be empty. -local function get_snippets(ft, opts) - opts = opts or {} - - return snippet_collection.get_snippets(ft, opts.type or "snippets") or {} -end - -local function default_snip_info(snip) - return { - name = snip.name, - trigger = snip.trigger, - description = snip.description, - wordTrig = snip.wordTrig and true or false, - regTrig = snip.regTrig and true or false, - } -end - -local function available(snip_info) - snip_info = snip_info or default_snip_info - - local fts = util.get_snippet_filetypes() - local res = {} - for _, ft in ipairs(fts) do - res[ft] = {} - for _, snip in ipairs(get_snippets(ft)) do - if not snip.invalidated then - table.insert(res[ft], snip_info(snip)) - end - end - for _, snip in ipairs(get_snippets(ft, { type = "autosnippets" })) do - if not snip.invalidated then - table.insert(res[ft], snip_info(snip)) - end - end - end - return res -end - -local unlink_set_adjacent_as_current -local function unlink_set_adjacent_as_current_no_log(snippet) - -- prefer setting previous/outer insertNode as current node. - local next_current = - -- either pick i0 of snippet before, or i(-1) of next snippet. - snippet.prev.prev or snippet:next_node() - snippet:remove_from_jumplist() - - if next_current then - -- if snippet was active before, we need to now set its parent to be no - -- longer inner_active. - if - snippet.parent_node == next_current and next_current.inner_active - then - snippet.parent_node:input_leave_children() - else - -- set no_move. - local ok, err = pcall(next_current.input_enter, next_current, true) - if not ok then - -- this won't try to set the previously broken snippet as - -- current, since that link is removed in - -- `remove_from_jumplist`. - unlink_set_adjacent_as_current( - next_current.parent.snippet, - "Error while setting adjacent snippet as current node: %s", - err - ) - end - end - end - - session.current_nodes[vim.api.nvim_get_current_buf()] = next_current -end -function unlink_set_adjacent_as_current(snippet, reason, ...) - log.warn("Removing snippet %s: %s", snippet.trigger, reason:format(...)) - unlink_set_adjacent_as_current_no_log(snippet) -end - -local function unlink_current() - local current = session.current_nodes[vim.api.nvim_get_current_buf()] - if not current then - print("No active Snippet") - return - end - unlink_set_adjacent_as_current_no_log(current.parent.snippet) -end - --- return next active node. -local function safe_jump_current(dir, no_move, dry_run) - local node = session.current_nodes[vim.api.nvim_get_current_buf()] - if not node then - return nil - end - - local ok, res = pcall(node.jump_from, node, dir, no_move, dry_run) - if ok then - return res - else - local snip = node.parent.snippet - - unlink_set_adjacent_as_current( - snip, - "Removing snippet `%s` due to error %s", - snip.trigger, - res - ) - return session.current_nodes[vim.api.nvim_get_current_buf()] - end -end -local function jump(dir) - local current = session.current_nodes[vim.api.nvim_get_current_buf()] - if current then - local next_node = util.no_region_check_wrap(safe_jump_current, dir) - if next_node == nil then - session.current_nodes[vim.api.nvim_get_current_buf()] = nil - return true - end - if session.config.exit_roots then - if next_node.pos == 0 and next_node.parent.parent_node == nil then - session.current_nodes[vim.api.nvim_get_current_buf()] = nil - return true - end - end - session.current_nodes[vim.api.nvim_get_current_buf()] = next_node - return true - else - return false - end -end -local function jump_destination(dir) - -- dry run of jump (+no_move ofc.), only retrieves destination-node. - return safe_jump_current(dir, true, { active = {} }) -end - -local function jumpable(dir) - -- node is jumpable if there is a destination. - return jump_destination(dir) - ~= session.current_nodes[vim.api.nvim_get_current_buf()] -end - -local function expandable() - next_expand, next_expand_params = - match_snippet(util.get_current_line_to_cursor(), "snippets") - return next_expand ~= nil -end - -local function expand_or_jumpable() - return expandable() or jumpable(1) -end - -local function in_snippet() - -- check if the cursor on a row inside a snippet. - local node = session.current_nodes[vim.api.nvim_get_current_buf()] - if not node then - return false - end - local snippet = node.parent.snippet - local ok, snip_begin_pos, snip_end_pos = - pcall(snippet.mark.pos_begin_end, snippet.mark) - if not ok then - -- if there was an error getting the position, the snippets text was - -- most likely removed, resulting in messed up extmarks -> error. - -- remove the snippet. - unlink_set_adjacent_as_current( - snippet, - "Error while getting extmark-position: %s", - snip_begin_pos - ) - return - end - local pos = vim.api.nvim_win_get_cursor(0) - if pos[1] - 1 >= snip_begin_pos[1] and pos[1] - 1 <= snip_end_pos[1] then - return true -- cursor not on row inside snippet - end -end - -local function expand_or_locally_jumpable() - return expandable() or (in_snippet() and jumpable(1)) -end - -local function locally_jumpable(dir) - return in_snippet() and jumpable(dir) -end - -local function _jump_into_default(snippet) - return util.no_region_check_wrap(snippet.jump_into, snippet, 1) -end - --- opts.clear_region: table, keys `from` and `to`, both (0,0)-indexed. -local function snip_expand(snippet, opts) - local snip = snippet:copy() - - opts = opts or {} - opts.expand_params = opts.expand_params or {} - -- override with current position if none given. - opts.pos = opts.pos or util.get_cursor_0ind() - opts.jump_into_func = opts.jump_into_func or _jump_into_default - opts.indent = vim.F.if_nil(opts.indent, true) - - snip.trigger = opts.expand_params.trigger or snip.trigger - snip.captures = opts.expand_params.captures or {} - - local info = - { trigger = snip.trigger, captures = snip.captures, pos = opts.pos } - local env = Environ:new(info) - Environ:override(env, opts.expand_params.env_override or {}) - - local pos_id = vim.api.nvim_buf_set_extmark( - 0, - session.ns_id, - opts.pos[1], - opts.pos[2], - -- track position between pos[2]-1 and pos[2]. - { right_gravity = false } - ) - - -- optionally clear text. Text has to be cleared befor jumping into the new - -- snippet, as the cursor-position can end up in the wrong position (to be - -- precise the text will be moved, the cursor will stay at the same - -- position, which is just as bad) if text before the cursor, on the same - -- line is cleared. - if opts.clear_region then - vim.api.nvim_buf_set_text( - 0, - opts.clear_region.from[1], - opts.clear_region.from[2], - opts.clear_region.to[1], - opts.clear_region.to[2], - { "" } - ) - end - - local snip_parent_node = snip:trigger_expand( - session.current_nodes[vim.api.nvim_get_current_buf()], - pos_id, - env, - opts.indent - ) - - -- jump_into-callback returns new active node. - session.current_nodes[vim.api.nvim_get_current_buf()] = - opts.jump_into_func(snip) - - local buf_snippet_roots = - session.snippet_roots[vim.api.nvim_get_current_buf()] - if not session.config.keep_roots and #buf_snippet_roots > 1 then - -- if history is not set, and there is more than one snippet-root, - -- remove the other one. - -- The nice thing is: since we maintain that #buf_snippet_roots == 1 - -- whenever outside of this function, we know that if we're here, it's - -- because this snippet was just inserted into buf_snippet_roots. - -- Armed with this knowledge, we can just check which of the roots is - -- this snippet, and remove the other one. - buf_snippet_roots[buf_snippet_roots[1] == snip and 2 or 1]:remove_from_jumplist() - end - - -- stores original snippet, it doesn't contain any data from expansion. - session.last_expand_snip = snippet - session.last_expand_opts = opts - - -- set last action for vim-repeat. - -- will silently fail if vim-repeat isn't available. - -- -1 to disable count. - vim.cmd([[silent! call repeat#set("\luasnip-expand-repeat", -1)]]) - - return snip -end - ----Find a snippet matching the current cursor-position. ----@param opts table: may contain: ---- - `jump_into_func`: passed through to `snip_expand`. ----@return boolean: whether a snippet was expanded. -local function expand(opts) - local expand_params - local snip - -- find snip via next_expand (set from previous expandable()) or manual matching. - if next_expand ~= nil then - snip = next_expand - expand_params = next_expand_params - - next_expand = nil - next_expand_params = nil - else - snip, expand_params = - match_snippet(util.get_current_line_to_cursor(), "snippets") - end - if snip then - local jump_into_func = opts and opts.jump_into_func - - local cursor = util.get_cursor_0ind() - - local clear_region = expand_params.clear_region - or { - from = { - cursor[1], - cursor[2] - #expand_params.trigger, - }, - to = cursor, - } - - -- override snip with expanded copy. - snip = snip_expand(snip, { - expand_params = expand_params, - -- clear trigger-text. - clear_region = clear_region, - jump_into_func = jump_into_func, - }) - - return true - end - return false -end - -local function expand_auto() - local snip, expand_params = - match_snippet(util.get_current_line_to_cursor(), "autosnippets") - if snip then - local cursor = util.get_cursor_0ind() - local clear_region = expand_params.clear_region - or { - from = { - cursor[1], - cursor[2] - #expand_params.trigger, - }, - to = cursor, - } - snip = snip_expand(snip, { - expand_params = expand_params, - -- clear trigger-text. - clear_region = clear_region, - }) - end -end - -local function expand_repeat() - -- prevent clearing text with repeated expand. - session.last_expand_opts.clear_region = nil - session.last_expand_opts.pos = nil - - snip_expand(session.last_expand_snip, session.last_expand_opts) -end - --- return true and expand snippet if expandable, return false if not. -local function expand_or_jump() - if expand() then - return true - end - if jump(1) then - return true - end - return false -end - -local function lsp_expand(body, opts) - -- expand snippet as-is. - snip_expand( - ls.parser.parse_snippet( - "", - body, - { trim_empty = false, dedent = false } - ), - opts - ) -end - -local function choice_active() - return session.active_choice_nodes[vim.api.nvim_get_current_buf()] ~= nil -end - --- attempts to do some action on the snippet (like change_choice, set_choice), --- if it fails the snippet is removed and the next snippet becomes the current node. --- ... is passed to pcall as-is. -local function safe_choice_action(snip, ...) - local ok, res = pcall(...) - if ok then - return res - else - -- not very elegant, but this way we don't have a near - -- re-implementation of unlink_current. - unlink_set_adjacent_as_current( - snip, - "Removing snippet `%s` due to error %s", - snip.trigger, - res - ) - return session.current_nodes[vim.api.nvim_get_current_buf()] - end -end -local function change_choice(val) - local active_choice = - session.active_choice_nodes[vim.api.nvim_get_current_buf()] - assert(active_choice, "No active choiceNode") - local new_active = util.no_region_check_wrap( - safe_choice_action, - active_choice.parent.snippet, - active_choice.change_choice, - active_choice, - val, - session.current_nodes[vim.api.nvim_get_current_buf()] - ) - session.current_nodes[vim.api.nvim_get_current_buf()] = new_active -end - -local function set_choice(choice_indx) - local active_choice = - session.active_choice_nodes[vim.api.nvim_get_current_buf()] - assert(active_choice, "No active choiceNode") - local choice = active_choice.choices[choice_indx] - assert(choice, "Invalid Choice") - local new_active = util.no_region_check_wrap( - safe_choice_action, - active_choice.parent.snippet, - active_choice.set_choice, - active_choice, - choice, - session.current_nodes[vim.api.nvim_get_current_buf()] - ) - session.current_nodes[vim.api.nvim_get_current_buf()] = new_active -end - -local function get_current_choices() - local active_choice = - session.active_choice_nodes[vim.api.nvim_get_current_buf()] - assert(active_choice, "No active choiceNode") - - local choice_lines = {} - - active_choice:update_static_all() - for i, choice in ipairs(active_choice.choices) do - choice_lines[i] = table.concat(choice:get_docstring(), "\n") - end - - return choice_lines -end - -local function active_update_dependents() - local active = session.current_nodes[vim.api.nvim_get_current_buf()] - -- special case for startNode, cannot focus on those (and they can't - -- have dependents) - -- don't update if a jump/change_choice is in progress. - if not session.jump_active and active and active.pos > 0 then - -- Save cursor-pos to restore later. - local cur = util.get_cursor_0ind() - local cur_mark = vim.api.nvim_buf_set_extmark( - 0, - session.ns_id, - cur[1], - cur[2], - { right_gravity = false } - ) - - local ok, err = pcall(active.update_dependents, active) - if not ok then - unlink_set_adjacent_as_current( - active.parent.snippet, - "Error while updating dependents for snippet %s due to error %s", - active.parent.snippet.trigger, - err - ) - return - end - - -- 'restore' orientation of extmarks, may have been changed by some set_text or similar. - ok, err = pcall(active.focus, active) - if not ok then - unlink_set_adjacent_as_current( - active.parent.snippet, - "Error while entering node in snippet %s: %s", - active.parent.snippet.trigger, - err - ) - - return - end - - -- Don't account for utf, nvim_win_set_cursor doesn't either. - cur = vim.api.nvim_buf_get_extmark_by_id( - 0, - session.ns_id, - cur_mark, - { details = false } - ) - util.set_cursor_0ind(cur) - end -end - -local function store_snippet_docstrings(snippet_table) - -- ensure the directory exists. - -- 493 = 0755 - vim.loop.fs_mkdir(luasnip_data_dir, 493) - - -- fs_open() with w+ creates the file if nonexistent. - local docstring_cache_fd = vim.loop.fs_open( - luasnip_data_dir .. "/docstrings.json", - "w+", - -- 420 = 0644 - 420 - ) - - -- get size for fs_read() - local cache_size = vim.loop.fs_fstat(docstring_cache_fd).size - local file_could_be_read, docstrings = pcall( - util.json_decode, - -- offset 0. - vim.loop.fs_read(docstring_cache_fd, cache_size, 0) - ) - docstrings = file_could_be_read and docstrings or {} - - for ft, snippets in pairs(snippet_table) do - if not docstrings[ft] then - docstrings[ft] = {} - end - for _, snippet in ipairs(snippets) do - docstrings[ft][snippet.trigger] = snippet:get_docstring() - end - end - - vim.loop.fs_write(docstring_cache_fd, util.json_encode(docstrings)) -end - -local function load_snippet_docstrings(snippet_table) - -- ensure the directory exists. - -- 493 = 0755 - vim.loop.fs_mkdir(luasnip_data_dir, 493) - - -- fs_open() with "r" returns nil if the file doesn't exist. - local docstring_cache_fd = vim.loop.fs_open( - luasnip_data_dir .. "/docstrings.json", - "r", - -- 420 = 0644 - 420 - ) - - if not docstring_cache_fd then - error("Cached docstrings could not be read!") - return - end - -- get size for fs_read() - local cache_size = vim.loop.fs_fstat(docstring_cache_fd).size - local docstrings = util.json_decode( - -- offset 0. - vim.loop.fs_read(docstring_cache_fd, cache_size, 0) - ) - - for ft, snippets in pairs(snippet_table) do - -- skip if fieltype not in cache. - if docstrings[ft] then - for _, snippet in ipairs(snippets) do - -- only set if it hasn't been set already. - if not snippet.docstring then - snippet.docstring = docstrings[ft][snippet.trigger] - end - end - end - end -end - -local function unlink_current_if_deleted() - local node = session.current_nodes[vim.api.nvim_get_current_buf()] - if not node then - return - end - local snippet = node.parent.snippet - - -- extmarks_valid checks that - -- * textnodes that should contain text still do so, and - -- * that extmarks still fulfill all expectations (should be successive, no gaps, etc.) - if not snippet:extmarks_valid() then - unlink_set_adjacent_as_current( - snippet, - "Detected deletion of snippet `%s`, removing it", - snippet.trigger - ) - end -end - -local function exit_out_of_region(node) - -- if currently jumping via luasnip or no active node: - if session.jump_active or not node then - return - end - - local pos = util.get_cursor_0ind() - local snippet - if node.type == types.snippet then - snippet = node - else - snippet = node.parent.snippet - end - - -- find root-snippet. - while snippet.parent_node do - snippet = snippet.parent_node.parent.snippet - end - - local ok, snip_begin_pos, snip_end_pos = - pcall(snippet.mark.pos_begin_end, snippet.mark) - - if not ok then - unlink_set_adjacent_as_current( - snippet, - "Error while getting extmark-position: %s", - snip_begin_pos - ) - return - end - - -- stylua: ignore - -- leave if curser before or behind snippet - if pos[1] < snip_begin_pos[1] or - pos[1] > snip_end_pos[1] then - - -- make sure the snippet can safely be entered, since it may have to - -- be, in `refocus`. - if not snippet:extmarks_valid() then - unlink_set_adjacent_as_current(snippet, "Leaving snippet-root due to invalid extmarks.") - return - end - - local next_active = snippet.insert_nodes[0] - -- if there is a snippet nested into the $0, enter its $0 instead, - -- recursively. - -- This is to ensure that a jump forward after leaving the region of a - -- root will jump to the next root, or not result in a jump at all. - while next_active.inner_first do - -- make sure next_active is nested into completely intact - -- snippets, since that is a precondition on the to-node of - if not next_active.inner_first:extmarks_valid() then - next_active.inner_first:remove_from_jumplist() - else - -- inner_first is always the snippet, not the -1-node. - next_active = next_active.inner_first.insert_nodes[0] - end - end - - node_util.refocus(node, next_active) - session.current_nodes[vim.api.nvim_get_current_buf()] = next_active - end -end - --- ft string, extend_ft table of strings. -local function filetype_extend(ft, extend_ft) - vim.list_extend(session.ft_redirect[ft], extend_ft) - session.ft_redirect[ft] = util.deduplicate(session.ft_redirect[ft]) -end - --- ft string, fts table of strings. -local function filetype_set(ft, fts) - session.ft_redirect[ft] = util.deduplicate(fts) -end - -local function cleanup() - -- Use this to reload luasnip - vim.api.nvim_exec_autocmds( - "User", - { pattern = "LuasnipCleanup", modeline = false } - ) - -- clear all snippets. - snippet_collection.clear_snippets() - loader.cleanup() -end - -local function refresh_notify(ft) - snippet_collection.refresh_notify(ft) -end - -local function setup_snip_env() - local combined_table = vim.tbl_extend("force", _G, session.config.snip_env) - -- TODO: if desired, take into account _G's __index before looking into - -- snip_env's __index. - setmetatable(combined_table, getmetatable(session.config.snip_env)) - - setfenv(2, combined_table) -end -local function get_snip_env() - return session.get_snip_env() -end - -local function get_id_snippet(id) - return snippet_collection.get_id_snippet(id) -end - -local function add_snippets(ft, snippets, opts) - -- don't use yet, not available in some neovim-versions. - -- - -- vim.validate({ - -- filetype = { ft, { "string", "nil" } }, - -- snippets = { snippets, "table" }, - -- opts = { opts, { "table", "nil" } }, - -- }) - - opts = opts or {} - opts.refresh_notify = opts.refresh_notify or true - -- alternatively, "autosnippets" - opts.type = opts.type or "snippets" - - -- if ft is nil, snippets already has this format. - if ft then - snippets = { - [ft] = snippets, - } - end - - snippet_collection.add_snippets(snippets, opts) - - if opts.refresh_notify then - for ft_, _ in pairs(snippets) do - refresh_notify(ft_) - end - end -end - -local function clean_invalidated(opts) - opts = opts or {} - snippet_collection.clean_invalidated(opts) -end - -local function activate_node(opts) - opts = opts or {} - local pos = opts.pos or util.get_cursor_0ind() - local strict = vim.F.if_nil(opts.strict, false) - local select = vim.F.if_nil(opts.select, true) - - -- find tree-node the snippet should be inserted at (could be before another node). - local _, _, _, node = node_util.snippettree_find_undamaged_node(pos, { - tree_respect_rgravs = false, - tree_preference = node_util.binarysearch_preference.inside, - snippet_mode = "interactive", - }) - - if not node then - error("No Snippet at that position") - return - end - - -- only activate interactive nodes, or nodes that are immediately nested - -- inside a choiceNode. - if not node:interactive() then - if strict then - error("Refusing to activate a non-interactive node.") - return - else - -- fall back to known insertNode. - -- snippet.insert_nodes[1] may be preferable, but that is not - -- certainly an insertNode (and does not even certainly contain an - -- insertNode, think snippetNode with only textNode). - -- We could *almost* find the first activateable node by - -- dry_run-jumping into the snippet, but then we'd also need some - -- mechanism for setting the active-state of all nodes to false, - -- which we don't yet have. - -- - -- Instead, just choose -1-node, and allow jumps from there, which - -- is much simpler. - node = node.parent.snippet.prev - end - end - - node_util.refocus( - session.current_nodes[vim.api.nvim_get_current_buf()], - node - ) - if select then - -- input_enter node again, to get highlight and the like. - -- One side-effect of this is that an event will be execute twice, but I - -- feel like that is a trade-off worth doing, since it otherwise refocus - -- would have to be more complicated (or at least, restructured). - node:input_enter() - end - session.current_nodes[vim.api.nvim_get_current_buf()] = node -end - --- make these lazy, such that we don't have to load them before it's really --- necessary (drives up cost of initial load, otherwise). --- stylua: ignore -local ls_lazy = { - s = function() return require("luasnip.nodes.snippet").S end, - sn = function() return require("luasnip.nodes.snippet").SN end, - t = function() return require("luasnip.nodes.textNode").T end, - f = function() return require("luasnip.nodes.functionNode").F end, - i = function() return require("luasnip.nodes.insertNode").I end, - c = function() return require("luasnip.nodes.choiceNode").C end, - d = function() return require("luasnip.nodes.dynamicNode").D end, - r = function() return require("luasnip.nodes.restoreNode").R end, - snippet = function() return require("luasnip.nodes.snippet").S end, - snippet_node = function() return require("luasnip.nodes.snippet").SN end, - parent_indexer = function() return require("luasnip.nodes.snippet").P end, - indent_snippet_node = function() return require("luasnip.nodes.snippet").ISN end, - text_node = function() return require("luasnip.nodes.textNode").T end, - function_node = function() return require("luasnip.nodes.functionNode").F end, - insert_node = function() return require("luasnip.nodes.insertNode").I end, - choice_node = function() return require("luasnip.nodes.choiceNode").C end, - dynamic_node = function() return require("luasnip.nodes.dynamicNode").D end, - restore_node = function() return require("luasnip.nodes.restoreNode").R end, - parser = function() return require("luasnip.util.parser") end, - config = function() return require("luasnip.config") end, - multi_snippet = function() return require("luasnip.nodes.multiSnippet").new_multisnippet end, - snippet_source = function() return require("luasnip.session.snippet_collection.source") end, - select_keys = function() return require("luasnip.util.select").select_keys end -} - -ls = lazy_table({ - expand_or_jumpable = expand_or_jumpable, - expand_or_locally_jumpable = expand_or_locally_jumpable, - locally_jumpable = locally_jumpable, - jumpable = jumpable, - expandable = expandable, - in_snippet = in_snippet, - expand = expand, - snip_expand = snip_expand, - expand_repeat = expand_repeat, - expand_auto = expand_auto, - expand_or_jump = expand_or_jump, - jump = jump, - get_active_snip = get_active_snip, - choice_active = choice_active, - change_choice = change_choice, - set_choice = set_choice, - get_current_choices = get_current_choices, - unlink_current = unlink_current, - lsp_expand = lsp_expand, - active_update_dependents = active_update_dependents, - available = available, - exit_out_of_region = exit_out_of_region, - load_snippet_docstrings = load_snippet_docstrings, - store_snippet_docstrings = store_snippet_docstrings, - unlink_current_if_deleted = unlink_current_if_deleted, - filetype_extend = filetype_extend, - filetype_set = filetype_set, - add_snippets = add_snippets, - get_snippets = get_snippets, - get_id_snippet = get_id_snippet, - setup_snip_env = setup_snip_env, - get_snip_env = get_snip_env, - clean_invalidated = clean_invalidated, - get_snippet_filetypes = util.get_snippet_filetypes, - jump_destination = jump_destination, - session = session, - cleanup = cleanup, - refresh_notify = refresh_notify, - env_namespace = Environ.env_namespace, - setup = require("luasnip.config").setup, - extend_decorator = extend_decorator, - log = require("luasnip.util.log"), - activate_node = activate_node, -}, ls_lazy) - -return ls diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/data.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/data.lua deleted file mode 100644 index 6e21d6c7..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/data.lua +++ /dev/null @@ -1,27 +0,0 @@ ---- This module stores all files loaded by any of the loaders, ordered by their ---- filetype, and other data. ---- This is to facilitate luasnip.loaders.edit_snippets, and to handle ---- persistency of data, which is not given if it is stored in the module-file, ---- since the module-name we use (luasnip.loaders.*) is not necessarily the one ---- used by the user (luasnip/loader/*, for example), and the returned modules ---- are different tables. - -local autotable = require("luasnip.util.auto_table").autotable - -local M = { - lua_collections = {}, - lua_ft_paths = autotable(2), - - snipmate_collections = {}, - snipmate_ft_paths = autotable(2), - -- set by loader. - snipmate_cache = nil, - - vscode_package_collections = {}, - vscode_standalone_watchers = {}, - vscode_ft_paths = autotable(2), - -- set by loader. - vscode_cache = nil, -} - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/from_lua.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/from_lua.lua deleted file mode 100644 index 629d5c64..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/from_lua.lua +++ /dev/null @@ -1,466 +0,0 @@ --- loads snippets from directory structured almost like snipmate-collection: --- - files all named .lua --- - each returns table containing keys (optional) "snippets" and --- "autosnippets", value for each a list of snippets. --- --- cache: --- - lazy_load_paths: { --- { --- add_opts = {...}, --- ft1 = {filename1, filename2}, --- ft2 = {filename1}, --- ... --- }, { --- add_opts = {...}, --- ft1 = {filename1}, --- ... --- } --- } --- --- each call to load generates a new entry in that list. We cannot just merge --- all files for some ft since add_opts might be different (they might be from --- different lazy_load-calls). - -local loader_util = require("luasnip.loaders.util") -local log = require("luasnip.util.log").new("lua-loader") -local session = require("luasnip.session") -local util = require("luasnip.util.util") -local autotable = require("luasnip.util.auto_table").autotable -local tree_watcher = require("luasnip.loaders.fs_watchers").tree -local path_watcher = require("luasnip.loaders.fs_watchers").path -local digraph = require("luasnip.util.directed_graph") -local refresh_notify = - require("luasnip.session.enqueueable_operations").refresh_notify -local clean_invalidated = - require("luasnip.session.enqueueable_operations").clean_invalidated - -local Data = require("luasnip.loaders.data") - -local M = {} - --- ASSUMPTION: this function will only be called inside the snippet-constructor, --- to find the location of the lua-loaded file calling it. --- It is not exported, because it will (in its current state) only ever be used --- in one place, and it feels a bit wrong to expose put a function into `M`. --- Instead, it is inserted into the global environment before a luasnippet-file --- is loaded, and removed from it immediately when this is done -local function get_loaded_file_debuginfo() - -- we can skip looking at the first four stackframes, since - -- 1 is this function - -- 2 is the snippet-constructor - -- ... (here anything is going on, could be 0 stackframes, could be many) - -- n-2 (at least 3) is the loaded file - -- n-1 (at least 4) is pcall - -- n (at least 5) is _luasnip_load_file - local current_call_depth = 4 - local debuginfo - - repeat - current_call_depth = current_call_depth + 1 - debuginfo = debug.getinfo(current_call_depth, "n") - until debuginfo.name == "_luasnip_load_file" - - -- ret is stored into a local, and not returned immediately to prevent tail - -- call optimization, which seems to invalidate the stackframe-numbers - -- determined earlier. - -- - -- current_call_depth-0 is _luasnip_load_file, - -- current_call_depth-1 is pcall, and - -- current_call_depth-2 is the lua-loaded file. - -- "Sl": get only source-file and current line. - local ret = debug.getinfo(current_call_depth - 2, "Sl") - return ret -end - -local function search_lua_rtp(modulename) - -- essentially stolen from vim.loader. - local rtp_lua_path = package.path - for _, path in ipairs(vim.api.nvim_get_runtime_file("", true)) do - rtp_lua_path = rtp_lua_path - .. (";%s/lua/?.lua;%s/lua/?/init.lua"):format(path, path) - end - - return package.searchpath(modulename, rtp_lua_path) -end - -local function _luasnip_load_file(file) - -- vim.loader.enabled does not seem to be official api, so always reset - -- if the loader is available. - -- To be sure, even pcall it, in case there are conditions under which - -- it might error. - if vim.loader then - -- pcall, not sure if this can fail in some way.. - -- Does not seem like it though - local ok, res = pcall(vim.loader.reset, file) - if not ok then - log.warn("Could not reset cache for file %s\n: %s", file, res) - end - end - - local func, error_msg = loadfile(file) - if error_msg then - log.error("Failed to load %s\n: %s", file, error_msg) - error(string.format("Failed to load %s\n: %s", file, error_msg)) - end - - -- the loaded file may add snippets to these tables, they'll be - -- combined with the snippets returned regularly. - local file_added_snippets = {} - local file_added_autosnippets = {} - - local dependent_files = {} - - -- setup snip_env in func - local func_env - local function ls_tracked_dofile(filename) - local package_func, err_msg = loadfile(filename) - if package_func then - setfenv(package_func, func_env) - table.insert(dependent_files, filename) - else - error(("File %s could not be loaded: %s"):format(filename, err_msg)) - end - - return package_func() - end - func_env = vim.tbl_extend( - "force", - -- extend the current(expected!) globals with the snip_env, and the - -- two tables. - _G, - session.get_snip_env(), - { - ls_file_snippets = file_added_snippets, - ls_file_autosnippets = file_added_autosnippets, - ls_tracked_dofile = ls_tracked_dofile, - ls_tracked_dopackage = function(package_name) - local package_file = search_lua_rtp(package_name) - if not package_file then - error( - ("Could not find package %s in rtp and package.path"):format( - package_name - ) - ) - end - return ls_tracked_dofile(package_file) - end, - } - ) - -- defaults snip-env requires metatable for resolving - -- lazily-initialized keys. If we have to combine this with an eventual - -- metatable of _G, look into unifying ls.setup_snip_env and this. - setmetatable(func_env, getmetatable(session.get_snip_env())) - setfenv(func, func_env) - - -- Since this function has to reach the snippet-constructor, and fenvs - -- aren't inherited by called functions, we have to set it in the global - -- environment. - _G.__luasnip_get_loaded_file_frame_debuginfo = util.ternary( - session.config.loaders_store_source, - get_loaded_file_debuginfo, - nil - ) - local run_ok, file_snippets, file_autosnippets = pcall(func) - -- immediately nil it. - _G.__luasnip_get_loaded_file_frame_debuginfo = nil - - if not run_ok then - log.error("Failed to execute\n: %s", file, file_snippets) - error("Failed to execute " .. file .. "\n: " .. file_snippets) - end - - -- make sure these aren't nil. - file_snippets = file_snippets or {} - file_autosnippets = file_autosnippets or {} - - vim.list_extend(file_snippets, file_added_snippets) - vim.list_extend(file_autosnippets, file_added_autosnippets) - - return file_snippets, file_autosnippets, dependent_files -end - -local function lua_package_file_filter(fname) - return fname:match("%.lua$") -end - ---- Collection watches all files that belong to a collection of snippets below ---- some root, and registers new files. -local Collection = {} -local Collection_mt = { - __index = Collection, -} - -function Collection.new( - root, - lazy, - include_ft, - exclude_ft, - add_opts, - lazy_watcher, - fs_event_providers -) - local ft_filter = loader_util.ft_filter(include_ft, exclude_ft) - local o = setmetatable({ - root = root, - file_filter = function(path, ft) - if not path:sub(1, #root) == root then - log.warn( - "Tried to filter file `%s`, which is not inside the root `%s`.", - path, - root - ) - return false - end - return lua_package_file_filter(path) and ft_filter(ft) - end, - add_opts = add_opts, - lazy = lazy, - -- store ft -> set of files that should be lazy-loaded. - lazy_files = autotable(2, { warn = false }), - -- store, for all files in this collection, their filetype. - -- No need to always recompute it, and we can use this to store which - -- files belong to the collection. - loaded_path_ft = {}, - file_dependencies = digraph.new_labeled(), - -- store fs_watchers for files the snippets-files depend on. - dependency_watchers = {}, - fs_event_providers = fs_event_providers, - }, Collection_mt) - - -- only register files up to a depth of 2. - local ok, err_or_watcher = pcall(tree_watcher, root, 2, { - -- don't handle removals for now. - new_file = function(path) - local path_ft = loader_util.collection_file_ft(o.root, path) - -- detected new file, make sure it is allowed by our filters. - if o.file_filter(path, path_ft) then - o:add_file(path, path_ft) - end - end, - change_file = function(path) - o:reload(path) - end, - }, { lazy = lazy_watcher, fs_event_providers = fs_event_providers }) - - if not ok then - error(("Could not create watcher: %s"):format(err_or_watcher)) - end - - o.watcher = err_or_watcher - - log.info("Initialized snippet-collection at `%s`", root) - - return o -end - --- Add file with some filetype to collection. -function Collection:add_file(path, ft) - Data.lua_ft_paths[ft][path] = true - - if self.lazy then - if not session.loaded_fts[ft] then - log.info( - "Registering lazy-load-snippets for ft `%s` from file `%s`", - ft, - path - ) - - -- only register to load later. - self.lazy_files[ft][path] = true - return - else - log.info( - "Filetype `%s` is already active, loading immediately.", - ft - ) - end - end - - self:load_file(path, ft) -end -function Collection:load_file(path, ft) - log.info("Adding snippets for filetype `%s` from file `%s`", ft, path) - self.loaded_path_ft[path] = ft - - local snippets, autosnippets, dependent_files = _luasnip_load_file(path) - - -- ignored if it already exists. - self.file_dependencies:set_vertex(path) - -- make sure we don't retain any old dependencies. - self.file_dependencies:clear_edges(path) - - for _, file_dependency in ipairs(dependent_files) do - -- ignored if it already exists. - self.file_dependencies:set_vertex(file_dependency) - -- path depends on dependent_file => if dependent_file is changed, path - -- should be updated. - self.file_dependencies:set_edge(file_dependency, path, path) - - if not self.dependency_watchers[file_dependency] then - self.dependency_watchers[file_dependency] = path_watcher( - file_dependency, - { - change = function(_) - local depending_files = - self.file_dependencies:connected_component( - file_dependency, - "Forward" - ) - for _, file in ipairs(depending_files) do - -- Prevent loading one of the utility-files as a snippet-file. - -- This will not reject any snippet-file in - -- depending_files. This is because since they are in - -- depending_files, we have their dependency-information, - -- which can only be obtained by loading them, and so there - -- can't be any unloaded files in there. - if self.loaded_path_ft[file] then - self:load_file(file, self.loaded_path_ft[file]) - end - end - end, - }, - { lazy = false, fs_event_providers = self.fs_event_providers } - ) - end - end - - loader_util.add_file_snippets( - ft, - path, - snippets, - autosnippets, - self.add_opts - ) - - refresh_notify(ft) -end -function Collection:do_lazy_load(ft) - for file, _ in pairs(self.lazy_files[ft]) do - if not self.loaded_path_ft[file] then - self:load_file(file, ft) - end - end -end - --- will only do something, if the file at `path` was loaded previously. -function Collection:reload(path) - local path_ft = self.loaded_path_ft[path] - if not path_ft then - -- file not yet loaded. - return - end - - -- will override previously-loaded snippets from this path. - self:load_file(path, path_ft) - - -- clean snippets if enough were removed. - clean_invalidated() -end - -function Collection:stop() - self.watcher:stop() - for _, watcher in pairs(self.dependency_watchers) do - watcher:stop() - end -end - -function M._load_lazy_loaded_ft(ft) - log.info("Loading lazy-load-snippets for filetype `%s`", ft) - - for _, collection in ipairs(Data.lua_collections) do - collection:do_lazy_load(ft) - end -end - -local function _load(lazy, opts) - local o = loader_util.normalize_opts(opts) - - local collection_roots = - loader_util.resolve_root_paths(o.paths, "luasnippets") - local lazy_roots = loader_util.resolve_lazy_root_paths(o.lazy_paths) - - log.info( - "Found roots `%s` for paths `%s`.", - vim.inspect(collection_roots), - vim.inspect(o.paths) - ) - if o.paths and #o.paths ~= #collection_roots then - log.warn( - "Could not resolve all collection-roots for paths `%s`: only found `%s`", - vim.inspect(o.paths), - vim.inspect(collection_roots) - ) - end - - log.info( - "Determined roots `%s` for lazy_paths `%s`.", - vim.inspect(lazy_roots), - vim.inspect(o.lazy_paths) - ) - if o.lazy_paths and #o.lazy_paths ~= #lazy_roots then - log.warn( - "Could not resolve all collection-roots for lazy_paths `%s`: only found `%s`", - vim.inspect(o.lazy_paths), - vim.inspect(lazy_roots) - ) - end - - for paths_lazy, roots in pairs({ - [true] = lazy_roots, - [false] = collection_roots, - }) do - for _, collection_root in ipairs(roots) do - local ok, coll_or_err = pcall( - Collection.new, - collection_root, - lazy, - o.include, - o.exclude, - o.add_opts, - paths_lazy, - o.fs_event_providers - ) - - if not ok then - log.error( - "Could not create collection at %s: %s", - collection_root, - coll_or_err - ) - else - table.insert(Data.lua_collections, coll_or_err) - end - end - end -end - ---- Load lua-snippet-collections immediately. ---- @param opts LuaSnip.Loaders.LoadOpts? -function M.load(opts) - _load(false, opts) -end - ---- Load lua-snippet-collections on demand. ---- @param opts LuaSnip.Loaders.LoadOpts? -function M.lazy_load(opts) - _load(true, opts) - - -- load for current buffer on startup. - for _, ft in - ipairs(loader_util.get_load_fts(vim.api.nvim_get_current_buf())) - do - M._load_lazy_loaded_ft(ft) - end -end - -function M.clean() - for _, collection in ipairs(Data.lua_collections) do - collection:stop() - end - -- bit ugly, keep in sync with defaults in data.lua. - -- Don't anticipate those changing, so fine I guess. - Data.lua_collections = {} - Data.lua_ft_paths = autotable(2) -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/from_snipmate.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/from_snipmate.lua deleted file mode 100644 index f70288de..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/from_snipmate.lua +++ /dev/null @@ -1,512 +0,0 @@ -local loader_util = require("luasnip.loaders.util") -local util = require("luasnip.util.util") -local tbl_util = require("luasnip.util.table") -local Path = require("luasnip.util.path") -local autotable = require("luasnip.util.auto_table").autotable -local digraph = require("luasnip.util.directed_graph") -local tree_watcher = require("luasnip.loaders.fs_watchers").tree -local Data = require("luasnip.loaders.data") -local session = require("luasnip.session") -local snippetcache = require("luasnip.loaders.snippet_cache") -local refresh_notify = - require("luasnip.session.enqueueable_operations").refresh_notify -local clean_invalidated = - require("luasnip.session.enqueueable_operations").clean_invalidated - -local log = require("luasnip.util.log").new("snipmate-loader") - ---- Load data from any snippet-file. ---- @param filename string ---- @return LuaSnip.Loaders.SnippetFileData -local function load_snipmate(filename) - local buffer_ok, buffer = pcall(Path.read_file, filename) - if not buffer_ok then - log.error(("Could not read file %s: %s"):format(filename, buffer)) - -- return dummy-data. - return { - snippets = {}, - autosnippets = {}, - misc = {}, - } - end - - local sp = require("luasnip.nodes.snippetProxy") - local snipmate_parse_fn = require("luasnip.util.parser").parse_snipmate - local source = require("luasnip.session.snippet_collection.source") - - -- could also be separate variables, but easier to access this way. - local snippets = { - snippet = {}, - autosnippet = {}, - } - local extends = {} - - ---@type string[] - local lines = loader_util.split_lines(buffer) - local i = 1 - - local function _parse(snippet_type, snipmate_opts) - local line = lines[i] - -- "snippet" or "autosnippet" - local prefix, description = - line:match("^" .. snippet_type .. [[%s+(%S+)%s*(.*)]]) - local body = {} - - local snip_begin_line = i - i = i + 1 - ---@type number - local indent - - while i <= #lines do - line = lines[i] - if line:find("^%s+") then - if not indent then - indent = #line:match("^%s+") - end - line = line:sub(indent + 1) - line = line:gsub("${VISUAL}", "${TM_SELECTED_TEXT}") - elseif line ~= "" then - break - end - table.insert(body, line) - i = i + 1 - end - - body = table.concat(body, "\n") - local snip = sp( - { - trig = prefix, - desc = description, - wordTrig = true, - priority = snipmate_opts.priority, - }, - body, - { - parse_fn = snipmate_parse_fn, - } - ) - if session.config.loaders_store_source then - snip._source = source.from_location( - filename, - { line = snip_begin_line, line_end = i - 1 } - ) - end - table.insert(snippets[snippet_type], snip) - end - - -- options for some snippet can be specified in the lines before the - -- {auto}snippet-keyword ("priority 2000\nsnippet...."). - -- They are stored in snipmate_opts, which is cleaned whenever a snippet is - -- actually created. - local snipmate_opts = {} - while i <= #lines do - local line = lines[i] - if vim.startswith(line, "snippet") then - _parse("snippet", snipmate_opts) - snipmate_opts = {} - elseif vim.startswith(line, "autosnippet") then - _parse("autosnippet", snipmate_opts) - snipmate_opts = {} - elseif vim.startswith(line, "extends") then - vim.list_extend(extends, vim.split(vim.trim(line:sub(8)), "[,%s]+")) - i = i + 1 - elseif vim.startswith(line, "#") or line:find("^%s*$") then - -- comment and blank line - i = i + 1 - elseif vim.startswith(line, "priority") then - snipmate_opts.priority = tonumber(line:match("priority%s+(%d+)")) - i = i + 1 - else - log.error("Invalid line in %s: %s", filename, i) - error(("Invalid line in %s: %s"):format(filename, i)) - end - end - - return { - snippets = snippets.snippet, - autosnippets = snippets.autosnippet, - misc = extends, - } -end - --- cache snippets without filetype-association for reuse. -Data.snipmate_cache = snippetcache.new(load_snipmate) - ---- Collection watches all files that belong to a collection of snippets below ---- some root, and registers new files. -local Collection = {} -local Collection_mt = { - __index = Collection, -} - -local function snipmate_package_file_filter(fname) - return fname:match("%.snippets$") -end - -function Collection.new( - root, - lazy, - include_ft, - exclude_ft, - add_opts, - lazy_watcher, - fs_event_providers -) - local ft_filter = loader_util.ft_filter(include_ft, exclude_ft) - local o = setmetatable({ - root = root, - - --- @alias LuaSnip.Loaders.Snipmate.FileCategory - --- | '"collection"' File only belongs to the collection - --- | '"load"' File should be loaded - - --- Determine whether a file should be loaded, belongs to the - --- collection, or doesn't. - --- This distinction is important because we need to know about all - --- files to correctly resolve `extend `, but only want to load - --- the filetypes allowed by in/exclude. - --- @param path string - ---@return LuaSnip.Loaders.Snipmate.FileCategory? - categorize_file = function(path) - if not path:sub(1, #root) == root then - log.warn( - "Tried to filter file `%s`, which is not inside the root `%s`.", - path, - root - ) - return nil - end - if snipmate_package_file_filter(path) then - local path_ft = loader_util.collection_file_ft(root, path) - if ft_filter(path_ft) then - return "load" - end - return "collection" - end - return nil - end, - -- sometimes we don't want the full categorize-file-data, only which - -- filetypes should be loaded. - ft_filter = ft_filter, - - add_opts = add_opts, - lazy = lazy, - -- store ft -> set of files that should be lazy-loaded. - lazy_files = autotable(2, { warn = false }), - -- store for each path the set of filetypes it has been loaded with. - loaded_path_fts = autotable(2, { warn = false }), - -- model filetype-extensions (`extends ` in `ft.snippets`). - -- Better than a flat table with t[ft] = {someft=true, somotherft=true} - -- since transitive dependencies are easier to understand/query. - -- There is an edge with source src to destination dst, if snippets for - -- filetype src also contribute to filetype dst. - -- Since we respect transitive `extends`, we can get all filetypes a - -- snippet-file for some filetype A contributes to by querying the - -- connected component of A (all filetype-vertices reachable from A). - ft_extensions = digraph.new_labeled(), - -- store all files in the collection, by their filetype. - -- This information is necessary to handle `extends` even for files - -- that are not actually loaded (due to in/exclude). - collection_files_by_ft = autotable(2, { warn = false }), - -- set if creation successful. - watcher = nil, - }, Collection_mt) - - -- only register files up to a depth of 2. - local ok, err_or_watcher = pcall(tree_watcher, root, 2, { - -- don't handle removals for now. - new_file = function(path) - ---@as LuaSnip.Loaders.Snipmate.FileCategory - local file_category = o.categorize_file(path) - - if file_category then - -- know it's at least in the collection -> can register it. - local file_ft = loader_util.collection_file_ft(o.root, path) - o:register_file(path, file_ft) - if file_category == "load" then - -- actually load if allowed by in/exclude. - o:add_file(path, file_ft) - end - end - end, - change_file = function(path) - vim.schedule_wrap(function() - o:reload(path) - end)() - end, - }, { lazy = lazy_watcher, fs_event_providers = fs_event_providers }) - - if not ok then - error(("Could not create watcher: %s"):format(err_or_watcher)) - end - - o.watcher = err_or_watcher - - log.info("Initialized snippet-collection at `%s`", root) - - return o -end - ---- Makes the file known to the collection, but does not load its snippets. ---- This is important because `extends` may require loading a file excluded by ---- `file_filter`, ie `include` and `exclude`. ---- @param path string ---- @param ft string -function Collection:register_file(path, ft) - self.collection_files_by_ft[ft][path] = true -end - ---- Register a file-filetype-association with the collection. ---- @param path string Path to a file that belongs to this collection. ---- @param add_ft string The original filetype this file should be added as. ---- Since we have to support filetype-extensions, this may ---- add the snippets of the file to several other ---- filetypes. -function Collection:add_file(path, add_ft) - -- register known file. - Data.snipmate_ft_paths[add_ft][path] = true - - if self.lazy then - if not session.loaded_fts[add_ft] then - log.info( - "Registering lazy-load-snippets for ft `%s` from file `%s`", - add_ft, - path - ) - - -- only register to load later. - self.lazy_files[add_ft][path] = true - return - else - log.info( - "Filetype `%s` is already active, loading immediately.", - add_ft - ) - end - end - - -- extended filetypes will be loaded in load_file. - self:load_file(path, add_ft, "SkipIfLoaded") -end - ---- @alias LuaSnip.Loaders.Snipmate.SkipLoad ---- | '"ForceLoad"' Always load, even if it was already loaded. ---- | '"SkipIfLoaded"' Skip the load if the file has been loaded already. - --- loads the fts that extend load_ft as well. --- skip_load_mode allows this code to both prevent unnecessary loads (which --- could be caused if some file is added to the same filetype more than once), --- while still handling reload (where the files has to be loaded again for --- every filetype, even if it already is loaded (since it may have different --- snippets)) -function Collection:load_file(path, ft, skip_load_mode) - if skip_load_mode == "SkipIfLoaded" and self.loaded_path_fts[path][ft] then - return - end - -- ignore load_file if ft is excluded/not included. - if not self.ft_filter(ft) then - return - end - - log.info("Adding snippets for filetype `%s` from file `%s`", ft, path) - - -- Set here to skip loads triggered for the same path-file-combination in - -- subsequent code, which would trigger and endless loop. - self.loaded_path_fts[path][ft] = true - - -- this may already be set, but setting again here ensures that a file is - -- certainly associated with each filetype it's loaded for. (for example, - -- file-ft-combinations loaded as a dependency from another file may not be - -- set already). - Data.snipmate_ft_paths[ft][path] = true - - -- snippets may already be loaded -> get them from cache. - local data = Data.snipmate_cache:fetch(path) - local snippets = data.snippets - local autosnippets = data.autosnippets - -- data.misc is user-input, clean it here. - local extended_fts = util.deduplicate(data.misc) - - -- ignored if it already exists. - self.ft_extensions:set_vertex(ft) - -- make sure we don't retain any old dependencies. - self.ft_extensions:clear_edges(path) - - for _, extended_ft in pairs(extended_fts) do - -- ignored if it already exists. - self.ft_extensions:set_vertex(extended_ft) - -- snippets for extended_ft should also be loaded if ft is loaded - -- label edge with path, so all edges from this file can be updated on - -- reload. - self.ft_extensions:set_edge(extended_ft, ft, path) - end - - loader_util.add_file_snippets( - ft, - path, - snippets, - autosnippets, - self.add_opts - ) - - -- get all filetypes this one extends (directly or transitively), and load - -- their files for ft. - local load_fts = self.ft_extensions:connected_component(ft, "Backward") - for _, extended_ft in ipairs(load_fts) do - for file, _ in pairs(self.collection_files_by_ft[extended_ft]) do - -- check which filetypes a file with filetype extended_ft has to be - -- loaded for currently!! (ie. which filetypes directly or - -- transitively extend extended_ft. - -- The reason we can't just check that statically once, or just load - -- a file for the filetypes its filetype is initially extended by is - -- that the extends-graph may change on each `load_file`, and we - -- want to respect these changes. - for _, file_ft in - ipairs( - self.ft_extensions:connected_component( - extended_ft, - "Forward" - ) - ) - do - -- skips load if the file is already loaded for the given filetype. - -- One bad side-effect of this current implementation is that - -- the edges in the graph will be reset/set multiple times, - -- until they are retained in the last load_file-call to the - -- last filetype. - self:load_file(file, file_ft, "SkipIfLoaded") - end - end - end - - refresh_notify(ft) -end - -function Collection:do_lazy_load(lazy_ft) - for file, _ in pairs(self.lazy_files[lazy_ft]) do - for _, ft in - ipairs(self.ft_extensions:connected_component(lazy_ft, "Forward")) - do - -- skips load if the file is already loaded for the given filetype. - self:load_file(file, ft, "SkipIfLoaded") - end - end -end --- will only do something, if the file at `path` is actually in the collection. -function Collection:reload(path) - local loaded_fts = tbl_util.set_to_list(self.loaded_path_fts[path]) - for _, loaded_ft in ipairs(loaded_fts) do - -- will override previously-loaded snippets from this path. - self:load_file(path, loaded_ft, "ForceLoad") - end - - -- clean snippets if enough were removed. - clean_invalidated() -end - -function Collection:stop() - self.watcher:stop() -end - -local M = {} - -function M._load_lazy_loaded_ft(ft) - log.info("Loading lazy-load-snippets for filetype `%s`", ft) - - for _, collection in ipairs(Data.snipmate_collections) do - collection:do_lazy_load(ft) - end -end - ---- Generalized loading of collections. ---- @param lazy boolean Whether the collection should be loaded lazily. ---- @param opts LuaSnip.Loaders.LoadOpts? -local function _load(lazy, opts) - local o = loader_util.normalize_opts(opts) - - local collection_roots = loader_util.resolve_root_paths(o.paths, "snippets") - local lazy_roots = loader_util.resolve_lazy_root_paths(o.lazy_paths) - - log.info( - "Found roots `%s` for paths `%s`.", - vim.inspect(collection_roots), - vim.inspect(o.paths) - ) - if o.paths and #o.paths ~= #collection_roots then - log.warn( - "Could not resolve all collection-roots for paths `%s`: only found `%s`", - vim.inspect(o.paths), - vim.inspect(collection_roots) - ) - end - - log.info( - "Determined roots `%s` for lazy_paths `%s`.", - vim.inspect(lazy_roots), - vim.inspect(o.lazy_paths) - ) - if o.lazy_paths and #o.lazy_paths ~= #lazy_roots then - log.warn( - "Could not resolve all collection-roots for lazy_paths `%s`: only found `%s`", - vim.inspect(o.lazy_paths), - vim.inspect(lazy_roots) - ) - end - - for paths_lazy, roots in pairs({ - [true] = lazy_roots, - [false] = collection_roots, - }) do - for _, collection_root in ipairs(roots) do - local ok, coll_or_err = pcall( - Collection.new, - collection_root, - lazy, - o.include, - o.exclude, - o.add_opts, - paths_lazy, - o.fs_event_providers - ) - - if not ok then - log.error( - "Could not create collection at %s: %s", - collection_root, - coll_or_err - ) - else - table.insert(Data.snipmate_collections, coll_or_err) - end - end - end -end - ---- Load snipmate-snippet-collections immediately. ---- @param opts LuaSnip.Loaders.LoadOpts? -function M.load(opts) - _load(false, opts) -end - ---- Load snipmate-snippet-collections on demand. ---- @param opts LuaSnip.Loaders.LoadOpts? -function M.lazy_load(opts) - _load(true, opts) - -- load for current buffer on startup. - for _, ft in - ipairs(loader_util.get_load_fts(vim.api.nvim_get_current_buf())) - do - M._load_lazy_loaded_ft(ft) - end -end - -function M.clean() - for _, collection in ipairs(Data.snipmate_collections) do - collection:stop() - end - Data.snipmate_ft_paths = autotable(2) - -- don't reset cache, snippets are correctly updated on file-change anyway, - -- and there is no persistent data passed on. -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/from_vscode.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/from_vscode.lua deleted file mode 100644 index f8c3f7b6..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/from_vscode.lua +++ /dev/null @@ -1,645 +0,0 @@ -local util = require("luasnip.util.util") -local loader_util = require("luasnip.loaders.util") -local Path = require("luasnip.util.path") -local log = require("luasnip.util.log").new("vscode-loader") -local autotable = require("luasnip.util.auto_table").autotable -local path_watcher = require("luasnip.loaders.fs_watchers").path -local Data = require("luasnip.loaders.data") -local session = require("luasnip.session") -local refresh_notify = - require("luasnip.session.enqueueable_operations").refresh_notify -local clean_invalidated = - require("luasnip.session.enqueueable_operations").clean_invalidated - --- create snippetProxy which does not trim lines and dedent text. --- It's fair to use passed test as-is, if it's from json. -local parse = require("luasnip.util.parser").parse_snippet -local sp = require("luasnip.util.extend_decorator").apply( - require("luasnip.nodes.snippetProxy"), - {}, - { - parse_fn = function(ctx, body) - return parse(ctx, body, { trim_empty = false, dedent = false }) - end, - } -) - -local json_decoders = { - json = util.json_decode, - jsonc = require("luasnip.util.jsonc").decode, - ["code-snippets"] = require("luasnip.util.jsonc").decode, -} - -local function read_json(fname) - local data_ok, data = pcall(Path.read_file, fname) - if not data_ok then - log.error("Could not read file %s", fname) - return nil - end - - local fname_extension = Path.extension(fname) - if json_decoders[fname_extension] == nil then - log.error( - "`%s` was expected to have file-extension either `json`, `jsonc` or `code-snippets`, but doesn't.", - fname - ) - return nil - end - local fname_decoder = json_decoders[fname_extension] - - local status, result = pcall(fname_decoder, data) - if status then - return result - else - log.error("Could not parse file %s: %s", fname, result) - return nil - end -end - ---- Load snippets from vscode-snippet-file. ---- @param file string Path to file ----@return LuaSnip.Loaders.SnippetFileData -local function get_file_snippets(file) - local source = require("luasnip.session.snippet_collection.source") - local multisnippet = require("luasnip.nodes.multiSnippet") - - -- since most snippets we load don't have a scope-field, we just insert - -- them here by default. - local snippets = {} - - local snippet_set_data = read_json(file) - if snippet_set_data == nil then - log.error("Reading json from file `%s` failed, skipping it.", file) - - return { - snippets = {}, - autosnippets = {}, - misc = {}, - } - end - - for name, parts in pairs(snippet_set_data) do - local body = type(parts.body) == "string" and parts.body - or table.concat(parts.body, "\n") - - local ls_conf = parts.luasnip or {} - - -- we may generate multiple interfaces to the same snippet - -- (different filetype, different triggers) - - -- context common to all snippets generated here. - local common_context = { - name = name, - desc = parts.description or name, - wordTrig = ls_conf.wordTrig, - priority = ls_conf.priority, - snippetType = ls_conf.autotrigger and "autosnippet" or "snippet", - } - - -- Sometimes it's a list of prefixes instead of a single one - local prefixes = type(parts.prefix) == "table" and parts.prefix - or { parts.prefix } - - -- vscode documents `,`, but `.` also works. - -- an entry `false` in this list will cause a `ft=nil` for the snippet. - local filetypes = parts.scope and vim.split(parts.scope, "[.,]") - or { false } - - local contexts = {} - for _, prefix in ipairs(prefixes) do - for _, filetype in ipairs(filetypes) do - table.insert( - contexts, - { filetype = filetype or nil, trig = prefix } - ) - end - end - - local snip - if #contexts > 1 then - -- only construct multisnippet if it is actually necessary. - contexts.common = common_context - snip = multisnippet._raw_ms(contexts, sp(nil, body), {}) - elseif #contexts == 1 then - -- have to add options from common context to the trig/filetype-context. - snip = sp(vim.tbl_extend("keep", contexts[1], common_context), body) - end - - if snip then - if session.config.loaders_store_source then - -- only know file, not line or line_end. - snip._source = source.from_location(file) - end - - table.insert(snippets, snip) - end - end - - return { - snippets = snippets, - autosnippets = {}, - misc = {}, - } -end - --- has to be set in separate module to allow different module-path-separators --- in `require`. -Data.vscode_cache = - require("luasnip.loaders.snippet_cache").new(get_file_snippets) - ---- Parse package.json(c), determine all files that contribute snippets, and ---- which filetype is associated with them. ---- @param manifest string ---- @return table> -local function get_snippet_files(manifest) - -- if root doesn't contain a package.json, or it contributes no snippets, - -- return no snippets. - if not Path.exists(manifest) then - log.warn("Manifest %s does not exist", manifest) - return {} - end - - local package_data = read_json(manifest) - if not package_data then - -- since it is a `.json/jsonc`, the json not being correct should be an error. - log.error("Could not read json from `%s`", manifest) - return {} - end - - if - not package_data.contributes or not package_data.contributes.snippets - then - log.warn("Manifest %s does not contribute any snippets.", manifest) - return {} - end - - -- stores ft -> files -> true|nil, allow iterating files and their - -- filetypes while preventing duplicates. - local ft_file_set = autotable(2, { warn = false }) - - -- parent-directory of package.json(c), all files in the package.json(c) - -- are relative to it. - local package_parent = Path.parent(manifest) - - for _, snippet_entry in pairs(package_data.contributes.snippets) do - local absolute_path = Path.join(package_parent, snippet_entry.path) - - local normalized_snippet_file = Path.normalize(absolute_path) - - if not normalized_snippet_file then - -- path does not exist (yet), try and guess the correct path anyway. - normalized_snippet_file = Path.normalize_nonexisting(absolute_path) - log.warn( - "Could not find file %s advertised in %s, guessing %s as the absolute and normalized path.", - absolute_path, - manifest, - normalized_snippet_file - ) - end - - local langs = snippet_entry.language - if type(langs) ~= "table" then - langs = { langs } - end - for _, ft in ipairs(langs) do - ft_file_set[ft][normalized_snippet_file] = true - end - end - - return ft_file_set -end - --- Responsible for watching a single json-snippet-file. -local SnippetfileWatcher = {} -local SnippetfileWatcher_mt = { __index = SnippetfileWatcher } - -function SnippetfileWatcher.new( - path, - initial_ft, - fs_event_providers, - lazy, - load_cb -) - local o = setmetatable({ - path = path, - load_cb = load_cb, - -- track which filetypes this file has been loaded for, so we can - -- reload for all of them. - loaded_fts = { [initial_ft] = true }, - }, SnippetfileWatcher_mt) - - local load_all_fts = function() - for ft, _ in pairs(o.loaded_fts) do - load_cb(path, ft) - refresh_notify(ft) - end - end - local ok, err_or_watcher = pcall(path_watcher, path, { - add = load_all_fts, - change = function() - load_all_fts() - - -- clean snippets if enough were removed. - clean_invalidated() - end, - }, { lazy = lazy, fs_event_providers = fs_event_providers }) - - if not ok then - -- has to be handled by caller, we can't really proceed if the creation - -- failed. - error( - ("Could not create path_watcher for path %s: %s"):format( - path, - err_or_watcher - ) - ) - end - - o.watcher = err_or_watcher - - return o -end - --- called by collection. -function SnippetfileWatcher:add_ft(ft) - if self.loaded_fts[ft] then - -- already loaded. - return - end - self.loaded_fts[ft] = true - self.load_cb(self.path, ft) -end - -function SnippetfileWatcher:stop() - self.watcher:stop() -end - ---- Collection watches all files that belong to a collection of snippets below ---- some root, and registers new files. -local Collection = {} -local Collection_mt = { - __index = Collection, -} - -function Collection.new( - manifest_path, - lazy, - include_ft, - exclude_ft, - add_opts, - lazy_watcher, - fs_event_providers -) - local ft_filter = loader_util.ft_filter(include_ft, exclude_ft) - local o = setmetatable({ - lazy = lazy, - -- store ft -> set of files that should be lazy-loaded. - lazy_files = autotable(2, { warn = false }), - fs_event_providers = fs_event_providers, - - -- store path-watchers (so we don't register more than one for one - -- path), and so we can disable them. - path_watchers = {}, - -- for really loading a file. - -- this is not done in Collection:load itself, since it may have to be - -- performed as a callback on file-creation. - load_callback = function(path, ft) - local data = Data.vscode_cache:fetch(path) - -- autosnippets are included in snippets for this loader. - local snippets = data.snippets - loader_util.add_file_snippets(ft, path, snippets, {}, add_opts) - end, - -- initialized in a bit, we have to store+reset a watcher for the manifest-file. - manifest_watcher = nil, - }, Collection_mt) - - -- callback for updating the file-filetype-associations from the manifest. - local update_manifest = function() - local manifest_ft_paths = get_snippet_files(manifest_path) - for ft, path_set in pairs(manifest_ft_paths) do - if ft_filter(ft) then - for path, _ in pairs(path_set) do - o:add_file(path, ft) - end - end - end - end - - local ok, watcher_or_err = pcall(path_watcher, manifest_path, { - -- don't handle removals for now. - add = update_manifest, - change = update_manifest, - }, { lazy = lazy_watcher, fs_event_providers = fs_event_providers }) - - if not ok then - error(("Could not create watcher: %s"):format(watcher_or_err)) - end - o.manifest_watcher = watcher_or_err - - log.info("Initialized snippet-collection with manifest %s", manifest_path) - - return o -end - --- Add file with some filetype to collection, load according to lazy_load. -function Collection:add_file(path, ft) - Data.vscode_ft_paths[ft][path] = true - - if self.lazy then - if not session.loaded_fts[ft] then - log.info( - "Registering lazy-load-snippets for ft `%s` from file `%s`", - ft, - path - ) - - -- only register to load later. - self.lazy_files[ft][path] = true - return - else - log.info( - "Filetype `%s` is already active, loading immediately.", - ft - ) - end - end - - self:load_file(path, ft) -end - -function Collection:load_file(path, ft) - log.info("Registering file %s with filetype %s for loading.", path, ft) - if not self.path_watchers[path] then - -- always register these lazily, that way an upate to the package.json - -- without the snippet-file existing will work! - -- Also make sure we use the same fs_event_providers. - local ok, watcher_or_err = pcall( - SnippetfileWatcher.new, - path, - ft, - self.fs_event_providers, - true, - self.load_callback - ) - if not ok then - log.error( - "Could not create SnippetFileWatcher for path %s: %s", - path, - watcher_or_err - ) - return - end - self.path_watchers[path] = watcher_or_err - else - -- make new filetype known to existing watcher. - self.path_watchers[path]:add_ft(ft) - end -end - --- stop all watchers associated with this collection, to make sure no snippets --- are added from this collection again. -function Collection:stop() - self.manifest_watcher:stop() - for _, watcher in pairs(self.path_watchers) do - watcher:stop() - end -end - -function Collection:do_lazy_load(ft) - for file, _ in pairs(self.lazy_files[ft]) do - self:load_file(file, ft) - end -end - -local M = {} - -local function get_rtp_paths() - return vim.list_extend( - -- would be very surprised if this yields duplicates :D - vim.api.nvim_get_runtime_file("package.json", true), - vim.api.nvim_get_runtime_file("package.jsonc", true) - ) -end - ---- Generate list of manifest-paths from list of directory-paths. ---- If nil, search rtp. ---- If a given directory, or the mani ---- ---- @param paths string|table? List of existing directories. If nil, search runtimepath. ----@return string[] manifest_paths -local function get_manifests(paths) - local manifest_paths = {} - -- list of paths to crawl for loading (could be a table or a comma-separated-list) - if paths then - -- Get path to package.json/package.jsonc, or continue if it does not exist. - for _, dir in ipairs(paths) do - local tentative_manifest_path = - Path.expand_keep_symlink(Path.join(dir, "package.json")) - if Path.exists(tentative_manifest_path) then - table.insert(manifest_paths, tentative_manifest_path) - else - tentative_manifest_path = - Path.expand_keep_symlink(Path.join(dir, "package.jsonc")) - if Path.exists(tentative_manifest_path) then - table.insert(manifest_paths, tentative_manifest_path) - else - log.warn( - "Could not find package.json(c) in path %s (expanded to %s).", - dir, - Path.expand(dir) - ) - end - end - end - else - manifest_paths = get_rtp_paths() - end - - return manifest_paths -end - ---- Generate list of paths to manifests that may not yet exist, from list of ---- directories (which also may not yet exist). ---- One peculiarity: This will generate two paths for each directory, since we ---- don't know if the package.json or the package.jsonc will be created. ---- This may cause a bit of overhead (not much due to snippet-cache) if both ---- are created and contribute the same snippets, but that's unlikely and/or ---- user error :P ---- @param paths string[] ----@return string[] -local function get_lazy_manifests(paths) - local lazy_manifest_paths = {} - if paths then - -- list of directories, convert to list of existing manifest-files. - if type(paths) == "string" then - paths = vim.split(paths, ",") - end - for _, dir in ipairs(paths) do - local absolute_dir = Path.expand_maybe_nonexisting(dir) - - table.insert( - lazy_manifest_paths, - Path.join(absolute_dir, "package.json") - ) - table.insert( - lazy_manifest_paths, - Path.join(absolute_dir, "package.jsonc") - ) - end - end - - return lazy_manifest_paths -end - -local function _load(lazy, opts) - local o = loader_util.normalize_opts(opts) - - local manifests = get_manifests(o.paths) - local lazy_manifests = get_lazy_manifests(o.lazy_paths) - - log.info( - "Found manifests `%s` for paths `%s`.", - vim.inspect(manifests), - vim.inspect(o.paths) - ) - if o.paths and #o.paths ~= #manifests then - log.warn( - "Could not resolve all manifests for paths `%s`: only found `%s`", - vim.inspect(o.paths), - vim.inspect(manifests) - ) - end - - log.info( - "Determined roots `%s` for lazy_paths `%s`.", - vim.inspect(lazy_manifests), - vim.inspect(o.lazy_paths) - ) - -- two lazy manifests from each lazy directory. - if o.lazy_paths and #o.lazy_paths ~= 2 * #lazy_manifests then - log.warn( - "Could not resolve all manifests for lazy_paths `%s`: only found `%s`", - vim.inspect(o.lazy_paths), - vim.inspect(lazy_manifests) - ) - end - - for is_lazy, manifest_paths in pairs({ - [true] = lazy_manifests, - [false] = manifests, - }) do - for _, manifest_path in ipairs(manifest_paths) do - local ok, coll_or_err = pcall( - Collection.new, - manifest_path, - lazy, - o.include, - o.exclude, - o.add_opts, - is_lazy, - o.fs_event_providers - ) - - if not ok then - log.error( - "Could not create collection for manifest %s: %s", - manifest_path, - coll_or_err - ) - else - table.insert(Data.vscode_package_collections, coll_or_err) - end - end - end -end - -function M._load_lazy_loaded_ft(ft) - log.info("Loading lazy-load-snippets for filetype `%s`", ft) - - for _, collection in ipairs(Data.vscode_package_collections) do - collection:do_lazy_load(ft) - end - -- no need to lazy_load standalone-snippets. -end - -function M.load(opts) - _load(false, opts) -end - -function M.lazy_load(opts) - _load(true, opts) - - -- load for current buffer on startup. - for _, ft in - ipairs(loader_util.get_load_fts(vim.api.nvim_get_current_buf())) - do - M._load_lazy_loaded_ft(ft) - end -end - -function M.load_standalone(opts) - opts = opts or {} - - local lazy = vim.F.if_nil(opts.lazy, false) - local add_opts = loader_util.make_add_opts(opts) - local fs_event_providers = - vim.F.if_nil(opts.fs_event_providers, { autocmd = true, libuv = false }) - - local path - if not lazy then - path = Path.expand(opts.path) - if not path then - log.error( - "Expanding path %s does not produce an existing path.", - opts.path - ) - return - end - else - path = Path.expand_maybe_nonexisting(opts.path) - end - - Data.vscode_ft_paths["all"][path] = true - - local ok, watcher_or_err = pcall( - SnippetfileWatcher.new, - path, - "all", - fs_event_providers, - lazy, - function() - local data = Data.vscode_cache:fetch(path) - -- autosnippets are included in snippets for this loader. - local snippets = data.snippets - loader_util.add_file_snippets("all", path, snippets, {}, add_opts) - end - ) - - if not ok then - log.error( - "Could not create SnippetFileWatcher for path %s: %s", - path, - watcher_or_err - ) - return - end - - table.insert(Data.vscode_standalone_watchers, watcher_or_err) -end - -function M.clean() - for _, collection in ipairs(Data.vscode_package_collections) do - collection:stop() - end - Data.vscode_package_collections = {} - for _, standalone_watcher in ipairs(Data.vscode_standalone_watchers) do - standalone_watcher:stop() - end - Data.vscode_standalone_watchers = {} - - Data.vscode_ft_paths = autotable(2) - -- don't reset cache, there's no reason to discard the already-loaded - -- snippets as long as they're unchanged. -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/fs_watchers.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/fs_watchers.lua deleted file mode 100644 index 11f90539..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/fs_watchers.lua +++ /dev/null @@ -1,723 +0,0 @@ -local Path = require("luasnip.util.path") -local uv = vim.uv or vim.loop -local util = require("luasnip.util.util") -local log_tree = require("luasnip.util.log").new("tree-watcher") -local log_path = require("luasnip.util.log").new("path-watcher") -local log = require("luasnip.util.log").new("fs-watchers") - -local M = {} - --- used by both watchers. -local callback_mt = { - __index = function() - return util.nop - end, -} - ---- @alias LuaSnip.FSWatcher.FSEventProviders ---- | '"autocmd"' Hook into BufWritePost to receive notifications on file-changes. ---- | '"libuv"' Register uv.fs_event to receive notifications on file-changes. - ---- @alias LuaSnip.FSWatcher.Callback fun(full_path: string) - ---- @class LuaSnip.FSWatcher.TreeCallbacks ---- @field new_file LuaSnip.FSWatcher.Callback? ---- @field new_dir LuaSnip.FSWatcher.Callback? ---- @field remove_file LuaSnip.FSWatcher.Callback? ---- @field remove_dir LuaSnip.FSWatcher.Callback? ---- @field remove_root LuaSnip.FSWatcher.Callback? ---- @field change_file LuaSnip.FSWatcher.Callback? ---- @field change_dir LuaSnip.FSWatcher.Callback? ---- The callbacks are called with the full path to the file/directory that is ---- affected. ---- Callbacks that are not set will be replaced by a nop. - ---- @class LuaSnip.FSWatcher.PathCallbacks ---- @field add LuaSnip.FSWatcher.Callback? ---- @field remove LuaSnip.FSWatcher.Callback? ---- @field change LuaSnip.FSWatcher.Callback? ---- The callbacks are called with the full path to the file that path-watcher ---- is registered on. ---- Callbacks that are not set will be replaced by a nop. - ---- @class LuaSnip.FSWatcher.Options ---- @field lazy boolean? ---- If set, the watcher will be initialized even if the root/watched path does ---- not yet exist, and start notifications once it is created. ---- @field fs_event_providers table? ---- Which providers to use for receiving file-changes. - -local function get_opts(opts) - opts = opts or {} - local lazy = vim.F.if_nil(opts.lazy, false) - local fs_event_providers = - vim.F.if_nil(opts.fs_event_providers, { autocmd = true, libuv = false }) - - return lazy, fs_event_providers -end - --- plain list, don't use map-style table since we'll only need direct access to --- a watcher when it is stopped, which seldomly happens (at least, compared to --- how often it is iterated in the autocmd-callback). -M.autocmd_watchers = {} - -vim.api.nvim_create_augroup("_luasnip_fs_watcher", {}) -vim.api.nvim_create_autocmd({ "BufWritePost" }, { - callback = function(args) - log.debug("Received BufWritePost for file %s.", args.file) - local realpath = Path.normalize(args.file) - if not realpath then - -- if nil, the path does not exist for some reason. - log.info( - "Registered BufWritePost with %s, but realpath does not exist. Aborting fs-watcher-notification.", - args.file - ) - return - end - log.debug( - "Received update for file %s, using realpath %s.", - args.file, - realpath - ) - - -- remove stopped watchers. - -- Does not really matter whether we do this before or after the - -- callbacks, since stopped watchers already take care to not do - -- callbacks. - -- Doing this during the callback-invocations, however, would incur - -- some more complexity since ipairs does not support removal of - -- elements during the iteration. - M.autocmd_watchers = vim.tbl_filter(function(watcher) - -- this won't catch unstarted watchers, since they can't be in this - -- list in the first place. - return not watcher.stopped - end, M.autocmd_watchers) - - for _, watcher in ipairs(M.autocmd_watchers) do - watcher:BufWritePost_callback(realpath) - end - end, - group = "_luasnip_fs_watcher", -}) - --- similar autocmd_watchers, only this list contains watchers that should be --- notified on a manual update (which right now is every watcher). -M.active_watchers = {} -function M.write_notify(realpath) - M.active_watchers = vim.tbl_filter(function(watcher) - -- this won't catch unstarted watchers, since they can't be in this - -- list in the first place. - return not watcher.stopped - end, M.active_watchers) - - for _, watcher in ipairs(M.active_watchers) do - watcher:BufWritePost_callback(realpath) - end -end - ---- @class LuaSnip.FSWatcher.Tree ---- @field root string ---- @field fs_event userdata ---- @field files table ---- @field dir_watchers table ---- @field removed boolean ---- @field stopped boolean ---- @field callbacks LuaSnip.FSWatcher.TreeCallbacks ---- @field depth number How deep the root should be monitored. ---- @field fs_event_providers table ---- @field root_realpath string? Set as soon as the watcher is started. -local TreeWatcher = {} -local TreeWatcher_mt = { - __index = TreeWatcher, -} - -function TreeWatcher:stop() - for _, child_watcher in ipairs(self.dir_watchers) do - child_watcher:stop() - end - self:stop_self() -end - -function TreeWatcher:stop_self() - -- don't check which fs_event_providers were actually started, for both of - -- these it should not matter if they weren't. - self.stopped = true - self.send_notifications = false - - self.fs_event:stop() - -- will be removed from active_watchers/autocmd_watchers after the next event, but already won't receive it. -end - -function TreeWatcher:fs_event_callback(err, relpath, events) - if not self.send_notifications then - -- abort if we should not send notifications anymore. - return - end - vim.schedule_wrap(function() - log_tree.debug( - "raw: self.root: %s; err: %s; relpath: %s; change: %s; rename: %s", - self.root, - err, - relpath, - events.change, - events.rename - ) - local full_path = Path.join(self.root, relpath) - local path_stat = uv.fs_stat(full_path) - - -- try to figure out what happened in the directory. - if events.rename then - if not uv.fs_stat(self.root) then - self:remove_root() - return - end - if not path_stat then - self:remove_child(relpath, full_path) - return - end - - local f_type - -- if there is a link to a directory, we are notified on changes!! - if path_stat.type == "link" then - f_type = uv.fs_stat(uv.fs_realpath(full_path)) - else - f_type = path_stat.type - end - - if f_type == "file" then - if self.files[relpath] then - -- rename and file exists => a new file was moved into its - -- place => handle as changed file. - self:change_file(relpath, full_path) - else - self:new_file(relpath, full_path) - end - return - elseif f_type == "directory" then - if self.dir_watchers[relpath] then - -- rename and directory exists => directory is overwritten - -- => stop recursively, clear, and start a new watcher. - self.dir_watchers[relpath]:stop() - self.dir_watchers[relpath] = nil - end - self:new_dir(relpath, full_path) - return - end - elseif events.change then - self:change_child(relpath, full_path) - end - end)() -end - --- May not recognize child correctly if there are symlinks on the path from the --- child to the directory-root. --- Should be fine, especially since, I think, fs_event can recognize those --- correctly, which means that this is an issue only very seldomly. -function TreeWatcher:BufWritePost_callback(realpath) - if not self.send_notifications then - return - end - - if realpath:sub(1, #self.realpath_root) ~= self.realpath_root then - -- not inside this root. - return - end - - -- `#self.realpath_root+2`: remove root and path-separator. - local root_relative_components = - Path.components(realpath:sub(#self.realpath_root + 2)) - local rel = root_relative_components[1] - if #root_relative_components == 1 then - -- wrote file. - -- either new, or changed. - if self.files[rel] then - -- use regular root for notifications! - self:change_file(rel, Path.join(self.root, rel)) - else - self:new_file(rel, Path.join(self.root, rel)) - end - else - if self.dir_watchers[rel] then - if #root_relative_components == 2 then - -- only notify if the changed file is immediately in the - -- directory we're watching! - -- I think this is the behaviour of fs_event, and logically - -- makes sense. - self:change_dir(rel, Path.join(self.root, rel)) - end - else - -- does nothing if the directory already exists. - self:new_dir(rel, Path.join(self.root, rel)) - end - end -end - -function TreeWatcher:start() - if self.depth == 0 then - -- don't watch children for 0-depth. - return - end - - if self.stopped then - -- stopping overrides and prevents starting. - return - end - - self.send_notifications = true - - if self.fs_event_providers.libuv then - -- does not work on nfs-drive, at least if it's edited from another - -- machine. - local success, err = self.fs_event:start( - self.root, - {}, - function(err, relpath, events) - self:fs_event_callback(err, relpath, events) - end - ) - - if not success then - log_tree.error( - "Could not start libuv-monitor for path %s due to error %s", - self.path, - err - ) - else - log_tree.info( - "Monitoring root-directory %s with libuv-monitor.", - self.root - ) - end - end - - -- needed by BufWritePost-callback. - self.realpath_root = Path.normalize(self.root) - - if self.fs_event_providers.autocmd then - if self.realpath_root then - -- receive notifications on BufWritePost. - table.insert(M.autocmd_watchers, self) - log_tree.info( - "Monitoring root-directory %s with autocmd-monitor.", - self.root - ) - else - log_tree.error( - "Could not resolve realpath for root %s, not enabling autocmd-monitor", - self.root - ) - end - end - - if self.realpath_root then - table.insert(M.active_watchers, self) - end - - -- do initial scan after starting the watcher. - -- Scanning first, and then starting the watcher leaves a period of time - -- where a new file may be created (after scanning, before watching), where - -- we wont know about it. - -- If I understand the uv-eventloop correctly, this function, `new`, will - -- be executed completely before a callback is called, so self.files and - -- self.dir_watchers should be populated correctly when a callback is - -- received, even if it was received before all directories/files were - -- added. - -- This difference can be observed, at least on my machine, by watching a - -- directory A, and then creating a nested directory B, and children for it - -- in one command, ie. `mkdir -p A/B/{1,2,3,4,5,6,7,8,9}`. - -- If the callback is registered after the scan, the latter directories - -- (ie. 4-9) did not show up, whereas everything did work correctly if the - -- watcher was activated before the scan. - -- (almost everything, one directory was included in the initial scan and - -- the watch-event, but that seems okay for our purposes) - local files, dirs = Path.scandir(self.root) - for _, file in ipairs(files) do - local relpath = file:sub(#self.root + 2) - self:new_file(relpath, file) - end - for _, dir in ipairs(dirs) do - local relpath = dir:sub(#self.root + 2) - self:new_dir(relpath, dir) - end -end - --- these functions maintain our logical view of the directory, and call --- callbacks when we detect a change. -function TreeWatcher:new_file(rel, full) - if self.files[rel] then - -- already added - return - end - - log_tree.debug("new file %s %s", rel, full) - self.files[rel] = true - self.callbacks.new_file(full) -end -function TreeWatcher:new_dir(rel, full) - if self.dir_watchers[rel] then - -- already added - return - end - - log_tree.debug("new dir %s %s", rel, full) - -- first do callback for this directory, then look into (and potentially do - -- callbacks for) children. - self.callbacks.new_dir(full) - -- directory exists => don't need to set lazy. - -- inherit fs_event_providers. - self.dir_watchers[rel] = M.tree( - full, - self.depth - 1, - self.callbacks, - { lazy = false, fs_event_providers = self.fs_event_providers } - ) -end - -function TreeWatcher:change_file(rel, full) - log_tree.debug("changed file %s %s", rel, full) - self.callbacks.change_file(full) -end -function TreeWatcher:change_dir(rel, full) - log_tree.debug("changed dir %s %s", rel, full) - self.callbacks.change_dir(full) -end -function TreeWatcher:change_child(rel, full) - if self.dir_watchers[rel] then - self:change_dir(rel, full) - elseif self.files[rel] then - self:change_file(rel, full) - end -end - -function TreeWatcher:remove_child(rel, full) - if self.dir_watchers[rel] then - log_tree.debug("removing dir %s %s", rel, full) - -- should have been stopped by the watcher for the child, or it was not - -- even started due to depth. - self.dir_watchers[rel]:remove_root() - self.dir_watchers[rel] = nil - - self.callbacks.remove_dir(full) - elseif self.files[rel] then - log_tree.debug("removing file %s %s", rel, full) - self.files[rel] = nil - - self.callbacks.remove_file(full) - end -end - -function TreeWatcher:remove_root() - if self.removed then - -- already removed - return - end - log_tree.debug("removing root %s", self.root) - self.removed = true - -- stop own, children should have handled themselves, if they are watched - -- (and we don't need to do anything for unwatched children). - self:stop_self() - - -- removing entries (set them to nil) is apparently fine when iterating via - -- pairs. - for relpath, _ in pairs(self.files) do - local child_full = Path.join(self.root, relpath) - self:remove_child(relpath, child_full) - end - for relpath, _ in pairs(self.dir_watchers) do - local child_full = Path.join(self.root, relpath) - self:remove_child(relpath, child_full) - end - - self.callbacks.remove_root(self.root) -end - ---- Set up new watcher for a tree of files and directories. ---- @param root string Absolute path to the root. ---- @param depth number The depth up to which to monitor. 1 means that the ---- immediate children will be monitored, 2 includes their ---- children, and so on. ---- @param callbacks LuaSnip.FSWatcher.TreeCallbacks The callbacks to use for this watcher. ---- @param opts LuaSnip.FSWatcher.Options Options, described in their class. ---- @return LuaSnip.FSWatcher.Tree -function M.tree(root, depth, callbacks, opts) - local lazy, fs_event_providers = get_opts(opts) - - -- do nothing on missing callback. - callbacks = setmetatable(callbacks or {}, callback_mt) - - local o = setmetatable({ - root = root, - fs_event = uv.new_fs_event(), - files = {}, - dir_watchers = {}, - -- removed: have not yet triggered the removed-callback. - removed = false, - - -- track whether the watcher was stopped at some point, and if it as, - -- don't allow it to start again. - stopped = false, - -- whether notifications should be sent. - -- Modified by start/stop, wait for start to send any => start out as - -- false. - send_notifications = false, - - callbacks = callbacks, - depth = depth, - fs_event_providers = fs_event_providers, - }, TreeWatcher_mt) - - -- if the path does not yet exist, set watcher up s.t. it will start - -- watching when the directory is created. - if not uv.fs_stat(root) and lazy then - -- root does not yet exist, need to create a watcher that notifies us - -- of its creation. - local parent_path = Path.parent(root) - if not parent_path then - error(("Could not find parent-path for %s"):format(root)) - end - - log_tree.info( - "Path %s does not exist yet, watching %s for creation.", - root, - parent_path - ) - - local parent_watcher - parent_watcher = M.tree(parent_path, 1, { - new_dir = function(full) - if full == root then - o:start() - -- directory was created, stop watching. - parent_watcher:stop_self() - end - end, - -- use same providers. - }, { lazy = true, fs_event_providers = fs_event_providers }) - else - o:start() - end - - return o -end - ---- @class LuaSnip.FSWatcher.Path ---- @field private path string ---- @field private fs_event userdata ---- @field private removed boolean ---- @field private stopped boolean ---- @field private send_notifications boolean ---- @field private callbacks LuaSnip.FSWatcher.TreeCallbacks ---- @field private fs_event_providers table ---- @field private realpath string? Set as soon as the watcher is started. -local PathWatcher = {} - -local PathWatcher_mt = { - __index = PathWatcher, -} - -function PathWatcher:change(full) - log_path.info("detected change at path %s", full) - if self.removed then - -- this is certainly unexpected. - log_path.warn( - "PathWatcher at %s detected change, but path does not exist logically. Not triggering callback.", - full - ) - else - self.callbacks.change(self.path) - end -end - -function PathWatcher:add() - if not self.removed then - -- already added - return - end - log_path.info("adding path %s", self.path) - self.removed = false - - self.callbacks.add(self.path) -end -function PathWatcher:remove() - if self.removed then - -- already removed - return - end - log_path.debug("removing path %s", self.path) - log_path.info("path %s was removed, stopping watcher.", self.path) - - self.removed = true - - self.callbacks.remove(self.path) - - -- Would have to re-register for new file to receive new notifications. - self:stop() -end - -function PathWatcher:fs_event_callback(err, relpath, events) - if not self.send_notifications then - return - end - - vim.schedule_wrap(function() - log_path.debug( - "raw: path: %s; err: %s; relpath: %s; change: %s; rename: %s", - self.path, - err, - relpath, - events.change, - events.rename - ) - - if events.rename then - if not uv.fs_stat(self.path) then - self:remove() - else - self:add() - end - elseif events.change then - self:change() - end - end)() -end - -function PathWatcher:BufWritePost_callback(realpath) - if not self.send_notifications then - return - end - - if realpath == self.realpath then - -- notify using passed path, not realpath. - self:change(self.path) - end -end - -function PathWatcher:start() - if self.stopped then - -- stop() prevents start. - return - end - self.send_notifications = true - - if self.fs_event_providers.libuv then - -- does not work on nfs-drive, at least if it's edited from another - -- machine. - local success, err = self.fs_event:start( - self.path, - {}, - function(err, relpath, events) - self:fs_event_callback(err, relpath, events) - end - ) - - if not success then - log_path.error( - "Could not start libuv-monitor for file %s due to error %s", - self.path, - err - ) - else - log_path.info("Monitoring file %s with libuv-monitor.", self.path) - end - end - - local realpath = Path.normalize(self.path) - - if self.fs_event_providers.autocmd then - if realpath then - self.realpath = realpath - - -- path exists, add file-monitor. - table.insert(M.autocmd_watchers, self) - log_path.info("Monitoring file %s with autocmd-monitor.", self.path) - else - log_path.error( - "Could not resolve realpath for file %s, not enabling BufWritePost-monitor", - self.path - ) - end - end - - if realpath then - table.insert(M.active_watchers, self) - end - - if realpath then - -- path exists, notify. - self:add() - -- no else, never added the path, never call remove. - end -end - -function PathWatcher:stop() - -- don't check which fs_event_providers were actually started, for both of - -- these it should not matter if they weren't. - self.stopped = true - self.send_notifications = false - - self.fs_event:stop() -end - ---- Set up new watcher on a single path only. ---- @param path string Absolute path to the root. ---- @param callbacks LuaSnip.FSWatcher.PathCallbacks The callbacks to use for this watcher. ---- @param opts LuaSnip.FSWatcher.Options? Options, described in their class. ---- @return LuaSnip.FSWatcher.Path -function M.path(path, callbacks, opts) - local lazy, fs_event_providers = get_opts(opts) - - -- do nothing on missing callback. - callbacks = setmetatable(callbacks or {}, callback_mt) - - --- @as LuaSnip.FSWatcher.Path - local o = setmetatable({ - path = path, - fs_event = uv.new_fs_event(), - -- Don't send an initial remove-callback if the path does not yet - -- exist. - -- Always send add first, or send nothing. - removed = true, - -- these two are just like in TreeWatcher. - stopped = false, - -- wait for `start()` to send notifications. - send_notifications = false, - callbacks = callbacks, - fs_event_providers = fs_event_providers, - }, PathWatcher_mt) - - -- if the path does not yet exist, set watcher up s.t. it will start - -- watching when the directory is created. - if not uv.fs_stat(path) and lazy then - -- root does not yet exist, need to create a watcher that notifies us - -- of its creation. - local parent_path = Path.parent(path) - if not parent_path then - error(("Could not find parent-path for %s"):format(path)) - end - - log_path.info( - "Path %s does not exist yet, watching %s for creation.", - path, - parent_path - ) - - local parent_watcher - parent_watcher = M.tree(parent_path, 1, { - -- in path_watcher, watch for new file. - new_file = function(full) - log_path.info("Path: %s %s", full, path) - if full == path then - o:start() - -- directory was created, stop watching. - parent_watcher:stop_self() - end - end, - }, { lazy = true, fs_event_providers = fs_event_providers }) - else - o:start() - end - - return o -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/init.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/init.lua deleted file mode 100644 index daf6064c..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/init.lua +++ /dev/null @@ -1,158 +0,0 @@ -local util = require("luasnip.util.util") -local Path = require("luasnip.util.path") -local loader_util = require("luasnip.loaders.util") -local session = require("luasnip.session") -local loader_data = require("luasnip.loaders.data") -local fs_watchers = require("luasnip.loaders.fs_watchers") -local log = require("luasnip.util.log").new("loader") - -local M = {} - --- used to map cache-name to name passed to format. -local clean_name = { - vscode_packages = "vscode", - vscode_standalone = "vscode-standalone", - snipmate = "snipmate", - lua = "lua", -} -local function default_format(path, _) - path = path:gsub( - vim.pesc(vim.fn.stdpath("data") .. "/site/pack/packer/start"), - "$PLUGINS" - ) - if vim.env.HOME then - path = path:gsub(vim.pesc(vim.env.HOME .. "/.config/nvim"), "$CONFIG") - end - return path -end - -local function default_edit(file) - vim.cmd("edit " .. file) -end - ---- Quickly jump to snippet-file from any source for the active filetypes. ----@param opts nil|table, options for this function: ---- - ft_filter: fn(filetype:string) -> bool ---- Optionally filter filetypes which can be picked from. `true` -> filetype ---- is listed, `false` -> not listed. ---- ---- - format: fn(path:string, source_name:string) -> string|nil ---- source_name is one of "vscode", "snipmate" or "lua". ---- May be used to format the displayed items. For example, replace the ---- excessively long packer-path with something shorter. ---- If format returns nil for some item, the item will not be displayed. ---- ---- - edit: fn(file:string): this function is called with the snippet-file as ---- the lone argument. ---- The default is a function which just calls `vim.cmd("edit " .. file)`. -function M.edit_snippet_files(opts) - opts = opts or {} - local format = opts.format or default_format - local edit = opts.edit or default_edit - local extend = opts.extend or function(_, _) - return {} - end - - local function ft_edit_picker(ft, _) - if ft then - local ft_paths = {} - local items = {} - - -- concat files from all loaders for the selected filetype ft. - for cache_name, ft_file_set in pairs({ - vscode_packages = loader_data.vscode_ft_paths[ft], - vscode_standalone = {}, - snipmate = loader_data.snipmate_ft_paths[ft], - lua = loader_data.lua_ft_paths[ft], - }) do - for path, _ in pairs(ft_file_set or {}) do - local fmt_name = format(path, clean_name[cache_name]) - if fmt_name then - table.insert(ft_paths, path) - table.insert(items, fmt_name) - end - end - end - - -- extend filetypes with user-defined function. - local extended = extend(ft, ft_paths) - assert( - type(extended) == "table", - "You must return a table in extend function" - ) - for _, pair in ipairs(extended) do - table.insert(items, pair[1]) - table.insert(ft_paths, pair[2]) - end - - -- prompt user again if there are multiple files providing this filetype. - if #ft_paths > 1 then - vim.ui.select(items, { - prompt = "Multiple files for this filetype, choose one:", - }, function(_, indx) - if indx and ft_paths[indx] then - edit(ft_paths[indx]) - end - end) - elseif ft_paths[1] then - edit(ft_paths[1]) - end - end - end - - local ft_filter = opts.ft_filter or util.yes - - local all_fts = {} - vim.list_extend(all_fts, util.get_snippet_filetypes()) - vim.list_extend( - all_fts, - loader_util.get_load_fts(vim.api.nvim_get_current_buf()) - ) - all_fts = util.deduplicate(all_fts) - - local filtered_fts = {} - for _, ft in ipairs(all_fts) do - if ft_filter(ft) then - table.insert(filtered_fts, ft) - end - end - - if #filtered_fts == 1 then - ft_edit_picker(filtered_fts[1]) - elseif #filtered_fts > 1 then - vim.ui.select(filtered_fts, { - prompt = "Select filetype:", - }, ft_edit_picker) - end -end - -function M.cleanup() - require("luasnip.loaders.from_lua").clean() - require("luasnip.loaders.from_snipmate").clean() - require("luasnip.loaders.from_vscode").clean() -end - -function M.load_lazy_loaded(bufnr) - local fts = loader_util.get_load_fts(bufnr) - - for _, ft in ipairs(fts) do - if not session.loaded_fts[ft] then - require("luasnip.loaders.from_lua")._load_lazy_loaded_ft(ft) - require("luasnip.loaders.from_snipmate")._load_lazy_loaded_ft(ft) - require("luasnip.loaders.from_vscode")._load_lazy_loaded_ft(ft) - end - session.loaded_fts[ft] = true - end -end - -function M.reload_file(path) - local realpath = Path.normalize(path) - if not realpath then - return nil, ("Could not reload file %s: does not exist."):format(path) - else - fs_watchers.write_notify(realpath) - return true - end -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/snippet_cache.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/snippet_cache.lua deleted file mode 100644 index 42a590cb..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/snippet_cache.lua +++ /dev/null @@ -1,93 +0,0 @@ -local uv = vim.uv or vim.loop -local duplicate = require("luasnip.nodes.duplicate") - ---- @class LuaSnip.Loaders.SnippetCache.Mtime ---- @field sec number ---- @field nsec number ---- Stores modified time for a file. - ---- @class LuaSnip.Loaders.SnippetCache.TimeCacheEntry ---- @field mtime LuaSnip.Loaders.SnippetCache.Mtime? ---- @field data LuaSnip.Loaders.SnippetFileData ---- mtime is nil if the file does not currently exist. Since `get_fn` may still ---- return data, there's no need to treat this differently. - ---- @class LuaSnip.Loaders.SnippetCache ---- SnippetCache stores snippets and other data loaded by files. ---- @field private get_fn fun(file: string): LuaSnip.Loaders.SnippetFileData ---- @field private cache table -local SnippetCache = {} -SnippetCache.__index = SnippetCache - -local M = {} - ---- @class LuaSnip.Loaders.SnippetFileData ---- @field snippets LuaSnip.Addable[] ---- @field autosnippets LuaSnip.Addable[] ---- @field misc table any data. - ---- Create new cache. ---- @param get_fn fun(file: string): LuaSnip.Loaders.SnippetFileData ---- @return LuaSnip.Loaders.SnippetCache -function M.new(get_fn) - return setmetatable({ - get_fn = get_fn, - cache = {}, - }, SnippetCache) -end - ---- Copy addables from data to new table. ---- @param data LuaSnip.Loaders.SnippetFileData ---- @return LuaSnip.Loaders.SnippetFileData -local function copy_filedata(data) - --- @as LuaSnip.Loaders.SnippetFileData - return { - snippets = vim.tbl_map(duplicate.duplicate_addable, data.snippets), - autosnippets = vim.tbl_map( - duplicate.duplicate_addable, - data.autosnippets - ), - misc = vim.deepcopy(data.misc), - } -end - ---- Retrieve loaded data for any file, either from the cache, or directly from ---- the file. ---- For storage-efficiency (and to elide the otherwise necessary deepcopy), the ---- snippets are duplicated, which should not leak. ---- @param fname string ---- @return LuaSnip.Loaders.SnippetFileData -function SnippetCache:fetch(fname) - local cached = self.cache[fname] - local current_stat = uv.fs_stat(fname) - - --- @as LuaSnip.Loaders.SnippetCache.Mtime - local mtime = current_stat and current_stat.mtime - - if - cached - and mtime - and mtime.sec == cached.mtime.sec - and mtime.nsec == cached.mtime.nsec - then - -- happy path: data is cached, and valid => just return cached data. - return copy_filedata(cached.data) - end - - -- data is stale (cache entry does not exist, file was written after - -- cache-creation, or the file was deleted). - -- fetch data from updated file - local res = self.get_fn(fname) - - -- store it. - self.cache[fname] = { - data = res, - mtime = mtime, - } - - -- return it. - -- Don't copy here, no need to. - return res -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/types.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/types.lua deleted file mode 100644 index b1297e14..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/types.lua +++ /dev/null @@ -1,8 +0,0 @@ ---- @class LuaSnip.Loaders.LoadOpts ---- @field paths string[]?|string? Either a list of paths, or ","-delimited paths. If nil, searches rtp for snippet-collections. ---- @field lazy_paths string[]?|string? Like paths, but these will be watched, and loaded when creation is detected. ---- @field include string[]? If set, all filetypes not in include will be excluded from loading. ---- @field exclude string[]? Exclude these filetypes, even if they are set in include. ---- @field override_priority number? load all snippets with this priority. ---- @field default_priority number? snippet-priority, unless the snippet sets its own priority. ---- @field fs_event_providers table? How to monitor the filesystem diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/util.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/util.lua deleted file mode 100644 index 59333af6..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/loaders/util.lua +++ /dev/null @@ -1,299 +0,0 @@ -local Path = require("luasnip.util.path") -local util = require("luasnip.util.util") -local session = require("luasnip.session") -local snippet_collection = require("luasnip.session.snippet_collection") -local log = require("luasnip.util.log").new("loaders") - -local function filetypelist_to_set(list) - vim.validate({ list = { list, "table", true } }) - if not list then - return list - end - local out = {} - for _, ft in ipairs(list) do - out[ft] = true - end - return out -end - -local function split_lines(filestring) - local newline_code - if vim.endswith(filestring, "\r\n") then -- dos - newline_code = "\r\n" - elseif vim.endswith(filestring, "\r") then -- mac - -- both mac and unix-files contain a trailing newline which would lead - -- to an additional empty line being read (\r, \n _terminate_ lines, they - -- don't _separate_ them) - newline_code = "\r" - filestring = filestring:sub(1, -2) - elseif vim.endswith(filestring, "\n") then -- unix - newline_code = "\n" - filestring = filestring:sub(1, -2) - else -- dos - newline_code = "\r\n" - end - return vim.split( - filestring, - newline_code, - { plain = true, trimemtpy = false } - ) -end - -local function non_nil(v) - return v ~= nil -end - -local function resolve_root_paths(paths, rtp_dirname) - if not paths then - paths = vim.api.nvim_get_runtime_file(rtp_dirname, true) - end - - paths = vim.tbl_map(Path.expand, paths) - paths = vim.tbl_filter(non_nil, paths) - paths = util.deduplicate(paths) - - return paths -end - -local function resolve_lazy_root_paths(paths) - paths = vim.tbl_map(Path.expand_maybe_nonexisting, paths) - paths = vim.tbl_filter(non_nil, paths) - paths = util.deduplicate(paths) - - return paths -end - -local function ft_filter(include, exclude) - exclude = filetypelist_to_set(exclude) - include = filetypelist_to_set(include) - - return function(lang) - if exclude and exclude[lang] then - return false - end - if include == nil or include[lang] then - return true - end - end -end - -local function _append(tbl, name, elem) - if tbl[name] == nil then - tbl[name] = {} - end - table.insert(tbl[name], elem) -end - ----Get paths of .snippets files ----@param root string @snippet directory path ----@return table @keys are file types, values are paths -local function get_ft_paths(root, extension) - local ft_path = {} - local files, dirs = Path.scandir(root) - for _, file in ipairs(files) do - local ft, ext = Path.basename(file, true) - if ext == extension then - _append(ft_path, ft, file) - end - end - for _, dir in ipairs(dirs) do - -- directory-name is ft for snippet-files. - local ft = vim.fn.fnamemodify(dir, ":t") - files, _ = Path.scandir(dir) - for _, file in ipairs(files) do - if vim.endswith(file, extension) then - -- produce normalized filenames. - local normalized_fname = Path.normalize(file) - if normalized_fname then - _append(ft_path, ft, normalized_fname) - end - end - end - end - return ft_path -end - --- fname must be in the directory-tree below root. --- collection_root may not end with a path-separator. --- If both are from "realpath", and fname belongs to the collection, this --- should be a given. -local function collection_file_ft(collection_root, fname) - local collection_components = Path.components(collection_root) - local fname_components = Path.components(fname) - - if #fname_components == #collection_components + 1 then - -- if the file is a direct child of the collection-root, get the text - -- before the last dot. - return fname_components[#collection_components + 1]:match( - "(.*)%.[^%.]*" - ) - else - -- if the file is nested deeper, the name of the directory immediately - -- below the root is the filetype. - return fname_components[#collection_components + 1] - end -end - --- extend table like {lua = {path1}, c = {path1, path2}, ...}, new_paths has the same layout. -local function extend_ft_paths(paths, new_paths) - for ft, path in pairs(new_paths) do - if paths[ft] then - vim.list_extend(paths[ft], path) - else - paths[ft] = vim.deepcopy(path) - end - end -end - ---- Find ---- 1. all files that belong to a collection and ---- 2. the files from that ---- collection that should actually be loaded. ----@param opts table: straight from `load`/`lazy_load`. ----@param rtp_dirname string: if no path is given in opts, we look for a ---- directory named `rtp_dirname` in the runtimepath. ----@param extension string: extension of valid snippet-files for the given ---- collection (eg `.lua` or `.snippets`) ----@return table: a list of tables, each of the inner tables contains two ---- entries: ---- - collection_paths: ft->files for the entire collection and ---- - load_paths: ft->files for only the files that should be loaded. ---- All produced filenames are normalized, eg. links are resolved and ---- unnecessary . or .. removed. -local function get_load_paths_snipmate_like(opts, rtp_dirname, extension) - local collections_load_paths = {} - - for _, path in ipairs(resolve_root_paths(opts.paths, rtp_dirname)) do - local collection_ft_paths = get_ft_paths(path, extension) - - local load_paths = vim.deepcopy(collection_ft_paths) - -- remove files for excluded/non-included filetypes here. - local collection_filter = ft_filter(opts.exclude, opts.include) - for ft, _ in pairs(load_paths) do - if not collection_filter(ft) then - load_paths[ft] = nil - end - end - - table.insert(collections_load_paths, { - collection_paths = collection_ft_paths, - load_paths = load_paths, - }) - end - - return collections_load_paths -end - ---- Asks (via vim.ui.select) to edit a file that currently provides snippets ----@param ft_files table, map filetype to a number of files. -local function edit_snippet_files(ft_files) - local fts = util.get_snippet_filetypes() - vim.ui.select(fts, { - prompt = "Select filetype:", - }, function(item, _) - if item then - local ft_paths = ft_files[item] - if ft_paths then - -- prompt user again if there are multiple files providing this filetype. - if #ft_paths > 1 then - vim.ui.select(ft_paths, { - prompt = "Multiple files for this filetype, choose one:", - }, function(multi_item) - if multi_item then - vim.cmd("edit " .. multi_item) - end - end) - else - vim.cmd("edit " .. ft_paths[1]) - end - else - print("No file for this filetype.") - end - end - end) -end - -local function make_add_opts(opts) - return { - override_priority = opts.override_priority, - default_priority = opts.default_priority, - } -end - -local function get_load_fts(bufnr) - local fts = session.config.load_ft_func(bufnr) - -- also add "all", loaded by all buffers. - table.insert(fts, "all") - - return util.deduplicate(util.redirect_filetypes(fts)) -end - -local function add_file_snippets(ft, filename, snippets, autosnippets, add_opts) - snippet_collection.add_snippets( - { [ft] = snippets }, - vim.tbl_extend("keep", { - type = "snippets", - key = "__snippets__" .. ft .. "__" .. filename, - }, add_opts) - ) - snippet_collection.add_snippets( - { [ft] = autosnippets }, - vim.tbl_extend("keep", { - type = "autosnippets", - key = "__autosnippets__" .. ft .. "__" .. filename, - }, add_opts) - ) - log.info( - "Adding %s snippets and %s autosnippets from %s to ft `%s`", - #snippets, - #autosnippets, - filename, - ft - ) -end - -local function normalize_opts(opts) - opts = opts or {} - - local paths = opts.paths - if type(paths) == "string" then - paths = vim.split(paths, ",") - end - - local add_opts = make_add_opts(opts) - local include = opts.include - local exclude = opts.exclude - local lazy_paths = opts.lazy_paths or {} - if type(lazy_paths) == "string" then - lazy_paths = vim.split(lazy_paths, ",") - end - - local fs_event_providers = - vim.F.if_nil(opts.fs_event_providers, { autocmd = true, libuv = false }) - - return { - paths = paths, - lazy_paths = lazy_paths, - include = include, - exclude = exclude, - add_opts = add_opts, - fs_event_providers = fs_event_providers, - } -end - -return { - filetypelist_to_set = filetypelist_to_set, - split_lines = split_lines, - resolve_root_paths = resolve_root_paths, - resolve_lazy_root_paths = resolve_lazy_root_paths, - ft_filter = ft_filter, - get_ft_paths = get_ft_paths, - get_load_paths_snipmate_like = get_load_paths_snipmate_like, - extend_ft_paths = extend_ft_paths, - edit_snippet_files = edit_snippet_files, - make_add_opts = make_add_opts, - collection_file_ft = collection_file_ft, - get_load_fts = get_load_fts, - add_file_snippets = add_file_snippets, - normalize_opts = normalize_opts, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/absolute_indexer.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/absolute_indexer.lua deleted file mode 100644 index 18546bdb..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/absolute_indexer.lua +++ /dev/null @@ -1,27 +0,0 @@ --- absolute_indexer[0][1][2][3] -> { absolute_insert_position = {0,1,2,3} } - -local function new() - return setmetatable({ - absolute_insert_position = {}, - }, { - __index = function(table, key) - table.absolute_insert_position[#table.absolute_insert_position + 1] = - key - return table - end, - }) -end - -return setmetatable({}, { - __index = function(_, key) - -- create new table and index it. - return new()[key] - end, - __call = function(_, ...) - return { - -- passing ... to a function passes only the first of the - -- variable number of args. - absolute_insert_position = type(...) == "number" and { ... } or ..., - } - end, -}) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/choiceNode.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/choiceNode.lua deleted file mode 100644 index 22de611b..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/choiceNode.lua +++ /dev/null @@ -1,427 +0,0 @@ -local Node = require("luasnip.nodes.node").Node -local ChoiceNode = Node:new() -local util = require("luasnip.util.util") -local node_util = require("luasnip.nodes.util") -local types = require("luasnip.util.types") -local events = require("luasnip.util.events") -local mark = require("luasnip.util.mark").mark -local session = require("luasnip.session") -local sNode = require("luasnip.nodes.snippet").SN -local extend_decorator = require("luasnip.util.extend_decorator") - -function ChoiceNode:init_nodes() - for i, choice in ipairs(self.choices) do - -- setup jumps - choice.next = self - choice.prev = self - - -- forward values for unknown keys from choiceNode. - choice.choice = self - local node_mt = getmetatable(choice) - setmetatable(choice, { - __index = function(node, key) - return node_mt[key] or node.choice[key] - end, - }) - - -- replace nodes' original update_dependents with function that also - -- calls this choiceNodes' update_dependents. - -- - -- cannot define as `function node:update_dependents()` as _this_ - -- choiceNode would be `self`. - -- Also rely on node.choice, as using `self` there wouldn't be caught - -- by copy and the wrong node would be updated. - choice.update_dependents = function(node) - node:_update_dependents() - node.choice:update_dependents() - end - - choice.next_choice = self.choices[i + 1] - choice.prev_choice = self.choices[i - 1] - end - self.choices[#self.choices].next_choice = self.choices[1] - self.choices[1].prev_choice = self.choices[#self.choices] - - self.active_choice = self.choices[1] -end - -local function C(pos, choices, opts) - opts = opts or {} - if opts.restore_cursor == nil then - -- disable by default, can affect performance. - opts.restore_cursor = false - end - - -- allow passing table of nodes in choices, will be turned into a - -- snippetNode. - for indx, choice in ipairs(choices) do - if not getmetatable(choice) then - -- is a normal table, not a node. - choices[indx] = sNode(nil, choice) - end - end - - local c = ChoiceNode:new({ - active = false, - pos = pos, - choices = choices, - type = types.choiceNode, - mark = nil, - dependents = {}, - -- default to true. - restore_cursor = opts.restore_cursor, - }, opts) - c:init_nodes() - return c -end -extend_decorator.register(C, { arg_indx = 3 }) - -function ChoiceNode:subsnip_init() - node_util.subsnip_init_children(self.parent, self.choices) -end - -ChoiceNode.init_positions = node_util.init_child_positions_func( - "absolute_position", - "choices", - "init_positions" -) -ChoiceNode.init_insert_positions = node_util.init_child_positions_func( - "absolute_insert_position", - "choices", - "init_insert_positions" -) - -function ChoiceNode:make_args_absolute() - -- relative indices are relative to the parent of the choiceNode, - -- temporarily remove last component of position - local last_indx = #self.absolute_insert_position - local last = self.absolute_insert_position[last_indx] - self.absolute_insert_position[#self.absolute_insert_position] = nil - - for _, choice in ipairs(self.choices) do - -- relative to choiceNode!! - choice:make_args_absolute(self.absolute_insert_position) - end - - self.absolute_insert_position[last_indx] = last -end - -function ChoiceNode:put_initial(pos) - local old_pos = vim.deepcopy(pos) - - self.active_choice:put_initial(pos) - - local mark_opts = vim.tbl_extend("keep", { - right_gravity = false, - end_right_gravity = false, - }, self.active_choice:get_passive_ext_opts()) - - self.active_choice.mark = mark(old_pos, pos, mark_opts) - self.visible = true -end - -function ChoiceNode:indent(indentstr) - for _, node in ipairs(self.choices) do - node:indent(indentstr) - end -end - -function ChoiceNode:expand_tabs(tabwidth, indentstringlen) - for _, node in ipairs(self.choices) do - node:expand_tabs(tabwidth, indentstringlen) - end -end - -function ChoiceNode:input_enter(_, dry_run) - if dry_run then - dry_run.active[self] = true - return - end - - self.mark:update_opts(self.ext_opts.active) - self:focus() - - self.prev_choice_node = - session.active_choice_nodes[vim.api.nvim_get_current_buf()] - session.active_choice_nodes[vim.api.nvim_get_current_buf()] = self - self.visited = true - self.active = true - - self:event(events.enter) -end - -function ChoiceNode:input_leave(_, dry_run) - if dry_run then - dry_run.active[self] = false - return - end - - self:event(events.leave) - - self.mark:update_opts(self:get_passive_ext_opts()) - self:update_dependents() - session.active_choice_nodes[vim.api.nvim_get_current_buf()] = - self.prev_choice_node - self.active = false -end - -function ChoiceNode:set_old_text() - self.old_text = self:get_text() - self.active_choice.old_text = self.old_text -end - -function ChoiceNode:get_static_text() - return self.choices[1]:get_static_text() -end - -function ChoiceNode:get_docstring() - return util.string_wrap( - self.choices[1]:get_docstring(), - rawget(self, "pos") - ) -end - -function ChoiceNode:jump_into(dir, no_move, dry_run) - self:init_dry_run_active(dry_run) - - if self:is_active(dry_run) then - self:input_leave(no_move, dry_run) - - if dir == 1 then - return self.next:jump_into(dir, no_move, dry_run) - else - return self.prev:jump_into(dir, no_move, dry_run) - end - else - self:input_enter(no_move, dry_run) - - return self.active_choice:jump_into(dir, no_move, dry_run) - end -end - -function ChoiceNode:update() - self.active_choice:update() -end - -function ChoiceNode:update_static_all() - for _, choice in ipairs(self.choices) do - choice:update_static() - end -end - -function ChoiceNode:update_static() - self.active_choice:update_static() -end - -function ChoiceNode:update_restore() - self.active_choice:update_restore() -end - -function ChoiceNode:setup_choice_jumps() end - -function ChoiceNode:find_node(predicate) - if self.active_choice then - if predicate(self.active_choice) then - return self.active_choice - else - return self.active_choice:find_node(predicate) - end - end - return nil -end - --- used to uniquely identify this change-choice-action. -local change_choice_id = 0 - -function ChoiceNode:set_choice(choice, current_node) - change_choice_id = change_choice_id + 1 - -- to uniquely identify this node later (storing the pointer isn't enough - -- because this is supposed to work with restoreNodes, which are copied). - current_node.change_choice_id = change_choice_id - - local insert_pre_cc = vim.fn.mode() == "i" - -- is byte-indexed! Doesn't matter here, but important to be aware of. - local cursor_pos_pre_relative = - util.pos_sub(util.get_cursor_0ind(), current_node.mark:pos_begin_raw()) - - self.active_choice:store() - - -- tear down current choice. - -- leave all so the choice (could be a snippet) is in the correct state for the next enter. - node_util.leave_nodes_between(self.active_choice, current_node) - - self.active_choice:exit() - - -- clear text. - -- - -- active_choice has to be disabled (nilled?) to prevent reading from - -- cleared mark in set_mark_rgrav (which will be called in - -- self:set_text({""}) a few lines below). - self.active_choice = nil - self:set_text({ "" }) - - self.active_choice = choice - - self.active_choice.mark = self.mark:copy_pos_gravs( - vim.deepcopy(self.active_choice:get_passive_ext_opts()) - ) - - -- re-init positions for child-restoreNodes (they will update their - -- children in put_initial, but their own position has to be changed here). - self:init_positions(self.absolute_position) - self:init_insert_positions(self.absolute_insert_position) - - -- self is still focused, from `set_text`. - self.active_choice:put_initial(self.mark:pos_begin_raw()) - -- adjust gravity in left side of inserted node, such that it matches the - -- current gravity of self. - local _, to = self.mark:pos_begin_end_raw() - self.active_choice:subtree_set_pos_rgrav(to, -1, true) - - self.active_choice:update_restore() - self.active_choice:update_all_dependents() - self:update_dependents() - - -- Another node may have been entered in update_dependents. - self:focus() - self:event(events.change_choice) - - if self.restore_cursor then - local target_node = self:find_node(function(test_node) - return test_node.change_choice_id == change_choice_id - end) - - if target_node then - -- the node that the cursor was in when changeChoice was called exists - -- in the active choice! Enter it and all nodes between it and this choiceNode, - -- then set the cursor. - -- Pass no_move=true, we will set the cursor ourselves. - node_util.enter_nodes_between(self, target_node, true) - - if insert_pre_cc then - util.set_cursor_0ind( - util.pos_add( - target_node.mark:pos_begin_raw(), - cursor_pos_pre_relative - ) - ) - else - node_util.select_node(target_node) - end - return target_node - end - end - - return self.active_choice:jump_into(1) -end - -function ChoiceNode:change_choice(dir, current_node) - -- stylua: ignore - return self:set_choice( - dir == 1 and self.active_choice.next_choice - or self.active_choice.prev_choice, - current_node ) -end - -function ChoiceNode:copy() - local o = vim.deepcopy(self) - for i, node in ipairs(self.choices) do - if node.type == types.snippetNode or node.type == types.choiceNode then - o.choices[i] = node:copy() - else - setmetatable(o.choices[i], getmetatable(node)) - end - end - setmetatable(o, getmetatable(self)) - return o -end - -function ChoiceNode:exit() - self.visible = false - if self.active_choice then - self.active_choice:exit() - end - self.mark:clear() - if self.active then - session.active_choice_nodes[vim.api.nvim_get_current_buf()] = - self.prev_choice_node - end - self.active = false -end - -function ChoiceNode:set_ext_opts(name) - Node.set_ext_opts(self, name) - - self.active_choice:set_ext_opts(name) -end - -function ChoiceNode:store() - self.active_choice:store() -end - -function ChoiceNode:insert_to_node_absolute(position) - if #position == 0 then - return self.absolute_position - end - local front = util.pop_front(position) - return self.choices[front]:insert_to_node_absolute(position) -end - -function ChoiceNode:set_dependents() - for _, node in ipairs(self.choices) do - node:set_dependents() - end -end - -function ChoiceNode:set_argnodes(dict) - Node.set_argnodes(self, dict) - - for _, node in ipairs(self.choices) do - node:set_argnodes(dict) - end -end - -function ChoiceNode:update_all_dependents() - -- call the version that only updates this node. - self:_update_dependents() - - self.active_choice:update_all_dependents() -end - -function ChoiceNode:update_all_dependents_static() - -- call the version that only updates this node. - self:_update_dependents_static() - - self.active_choice:update_all_dependents_static() -end - -function ChoiceNode:resolve_position(position) - return self.choices[position] -end - -function ChoiceNode:static_init() - Node.static_init(self) - self.active_choice:static_init() -end - -function ChoiceNode:subtree_set_pos_rgrav(pos, direction, rgrav) - self.mark:set_rgrav(-direction, rgrav) - if self.active_choice then - self.active_choice:subtree_set_pos_rgrav(pos, direction, rgrav) - end -end - -function ChoiceNode:subtree_set_rgrav(rgrav) - self.mark:set_rgravs(rgrav, rgrav) - if self.active_choice then - self.active_choice:subtree_set_rgrav(rgrav) - end -end - -function ChoiceNode:extmarks_valid() - return node_util.generic_extmarks_valid(self, self.active_choice) -end - -return { - C = C, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/duplicate.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/duplicate.lua deleted file mode 100644 index eac2a31e..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/duplicate.lua +++ /dev/null @@ -1,73 +0,0 @@ -local snip_mod = require("luasnip.nodes.snippet") - -local M = {} - -local DupExpandable = {} - --- just pass these through to _expandable. -function DupExpandable:get_docstring() - return self._expandable:get_docstring() -end -function DupExpandable:copy() - local copy = self._expandable:copy() - copy.id = self.id - - return copy -end - --- this is modified in `self:invalidate` _and_ needs to be called on _expandable. -function DupExpandable:matches(...) - -- use snippet-module matches, self._expandable might have had its match - -- overwritten by invalidate. - -- (if there are more issues with this, consider some other mechanism for - -- invalidating) - return snip_mod.Snippet.matches(self._expandable, ...) -end - --- invalidate has to be called on this snippet itself. -function DupExpandable:invalidate() - snip_mod.Snippet.invalidate(self) -end - -local dup_mt = { - -- index DupExpandable for own functions, and then the expandable stored in - -- self/t. - __index = function(t, k) - if DupExpandable[k] then - return DupExpandable[k] - end - - return t._expandable[k] - end, -} - -function M.duplicate_expandable(expandable) - return setmetatable({ - _expandable = expandable, - -- copy these! - -- if `expandable` is invalidated, we don't necessarily want this - -- expandable to be invalidated as well. - hidden = expandable.hidden, - invalidated = expandable.invalidated, - }, dup_mt) -end - -local DupAddable = {} - -function DupAddable:retrieve_all() - -- always return the same set of items, necessary when for invalidate via - -- key to work correctly. - return self._all -end -local DupAddable_mt = { - __index = DupAddable, -} - -function M.duplicate_addable(addable) - return setmetatable({ - addable = addable, - _all = vim.tbl_map(M.duplicate_expandable, addable:retrieve_all()), - }, DupAddable_mt) -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/dynamicNode.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/dynamicNode.lua deleted file mode 100644 index 0daad6f2..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/dynamicNode.lua +++ /dev/null @@ -1,439 +0,0 @@ -local DynamicNode = require("luasnip.nodes.node").Node:new() -local util = require("luasnip.util.util") -local node_util = require("luasnip.nodes.util") -local Node = require("luasnip.nodes.node").Node -local types = require("luasnip.util.types") -local events = require("luasnip.util.events") -local FunctionNode = require("luasnip.nodes.functionNode").FunctionNode -local SnippetNode = require("luasnip.nodes.snippet").SN -local extend_decorator = require("luasnip.util.extend_decorator") - -local function D(pos, fn, args, opts) - opts = opts or {} - - return DynamicNode:new({ - pos = pos, - fn = fn, - args = node_util.wrap_args(args), - type = types.dynamicNode, - mark = nil, - user_args = opts.user_args or {}, - dependents = {}, - active = false, - }, opts) -end -extend_decorator.register(D, { arg_indx = 4 }) - -function DynamicNode:input_enter(_, dry_run) - if dry_run then - dry_run.active[self] = true - return - end - - self.visited = true - self.active = true - self.mark:update_opts(self.ext_opts.active) - - self:event(events.enter) -end - -function DynamicNode:input_leave(_, dry_run) - if dry_run then - dry_run.active[self] = false - return - end - self:event(events.leave) - - self:update_dependents() - self.active = false - self.mark:update_opts(self:get_passive_ext_opts()) -end - -function DynamicNode:get_static_text() - if self.static_snip then - return self.static_snip:get_static_text() - else - self:update_static() - if self.static_snip then - return self.static_snip:get_static_text() - else - return { "" } - end - end -end - -function DynamicNode:get_docstring() - if not self.docstring then - if self.static_snip then - self.docstring = self.static_snip:get_docstring() - else - self.docstring = { "" } - end - end - return self.docstring -end - --- DynamicNode's don't have static text, only set as visible. -function DynamicNode:put_initial(_) - self.visible = true -end - -function DynamicNode:indent(_) end - -function DynamicNode:expand_tabs(_) end - -function DynamicNode:jump_into(dir, no_move, dry_run) - -- init dry_run-state for this node. - self:init_dry_run_active(dry_run) - - if self:is_active(dry_run) then - self:input_leave(no_move, dry_run) - - if dir == 1 then - return self.next:jump_into(dir, no_move, dry_run) - else - return self.prev:jump_into(dir, no_move, dry_run) - end - else - self:input_enter(no_move, dry_run) - - if self.snip then - return self.snip:jump_into(dir, no_move, dry_run) - else - -- this will immediately enter and leave, but IMO that's expected - -- behaviour. - self:input_leave(no_move, dry_run) - if dir == 1 then - return self.next:jump_into(dir, no_move, dry_run) - else - return self.prev:jump_into(dir, no_move, dry_run) - end - end - end -end - -function DynamicNode:update() - local args = self:get_args() - if vim.deep_equal(self.last_args, args) then - -- no update, the args still match. - return - end - - if not self.parent.snippet:extmarks_valid() then - error("Refusing to update inside a snippet with invalid extmarks") - end - - local tmp - if self.snip then - if not args then - -- a snippet exists, don't delete it. - return - end - - -- build new snippet before exiting, markers may be needed for construncting. - tmp = self.fn( - args, - self.parent, - self.snip.old_state, - unpack(self.user_args) - ) - self.snip:exit() - self.snip = nil - - -- focuses node. - self:set_text({ "" }) - else - self:focus() - if not args then - -- no snippet exists, set an empty one. - tmp = SnippetNode(nil, {}) - else - -- also enter node here. - tmp = self.fn(args, self.parent, nil, unpack(self.user_args)) - end - end - self.last_args = args - - -- act as if snip is directly inside parent. - tmp.parent = self.parent - tmp.indx = self.indx - - tmp.next = self - tmp.prev = self - - tmp.snippet = self.parent.snippet - - tmp:resolve_child_ext_opts() - tmp:resolve_node_ext_opts() - tmp:subsnip_init() - - tmp.mark = - self.mark:copy_pos_gravs(vim.deepcopy(tmp:get_passive_ext_opts())) - tmp.dynamicNode = self - tmp.update_dependents = function(node) - node:_update_dependents() - node.dynamicNode:update_dependents() - end - - tmp:init_positions(self.snip_absolute_position) - tmp:init_insert_positions(self.snip_absolute_insert_position) - - tmp:make_args_absolute() - - tmp:set_dependents() - tmp:set_argnodes(self.parent.snippet.dependents_dict) - - if vim.bo.expandtab then - tmp:expand_tabs(util.tab_width(), #self.parent.indentstr) - end - tmp:indent(self.parent.indentstr) - - -- sets own extmarks false,true - self:focus() - local from, to = self.mark:pos_begin_end_raw() - -- inserts nodes with extmarks false,false - tmp:put_initial(from) - -- adjust gravity in left side of snippet, such that it matches the current - -- gravity of self. - tmp:subtree_set_pos_rgrav(to, -1, true) - - self.snip = tmp - - -- Update, tbh no idea how that could come in handy, but should be done. - -- Both are needed, because - -- - a node could only depend on nodes outside of tmp - -- - a node outside of tmp could depend on one inside of tmp - tmp:update() - tmp:update_all_dependents() - - self:update_dependents() -end - -local update_errorstring = [[ -Error while evaluating dynamicNode@%d for snippet '%s': -%s - -:h luasnip-docstring for more info]] -function DynamicNode:update_static() - local args = self:get_static_args() - if vim.deep_equal(self.last_static_args, args) then - -- no update, the args still match. - return - end - - local tmp, ok - if self.static_snip then - if not args then - -- a snippet exists, don't delete it. - return - end - - -- build new snippet before exiting, markers may be needed for construncting. - ok, tmp = pcall( - self.fn, - args, - self.parent, - self.snip.old_state, - unpack(self.user_args) - ) - else - if not args then - -- no snippet exists, set an empty one. - tmp = SnippetNode(nil, {}) - else - -- also enter node here. - ok, tmp = - pcall(self.fn, args, self.parent, nil, unpack(self.user_args)) - end - end - if not ok then - print( - update_errorstring:format(self.indx, self.parent.snippet.name, tmp) - ) - -- set empty snippet on failure - tmp = SnippetNode(nil, {}) - end - self.last_static_args = args - - -- act as if snip is directly inside parent. - tmp.parent = self.parent - tmp.indx = self.indx - tmp.pos = rawget(self, "pos") - - tmp.next = self - tmp.prev = self - - -- doesn't matter here, but they'll have to be set. - tmp.ext_opts = self.parent.ext_opts - tmp.snippet = self.parent.snippet - - tmp.dynamicNode = self - tmp.update_dependents_static = function(node) - node:_update_dependents_static() - node.dynamicNode:update_dependents_static() - end - - tmp:resolve_child_ext_opts() - tmp:resolve_node_ext_opts() - tmp:subsnip_init() - - tmp:init_positions(self.snip_absolute_position) - tmp:init_insert_positions(self.snip_absolute_insert_position) - - tmp:make_args_absolute() - - tmp:set_dependents() - tmp:set_argnodes(self.parent.snippet.dependents_dict) - - -- do not expand tabs!! This is only necessary if the snippet is inserted - -- in a buffer, some information is lost if tabs (indent) is replaced with - -- whitespace. - -- This might make a difference when another f/dynamicNode depends on this - -- one, and the function expects expanded tabs... imo the function should - -- be adjusted to accept any whitespace. - tmp:indent(self.parent.indentstr) - - tmp:static_init() - - tmp:update_static() - -- updates dependents in tmp. - tmp:update_all_dependents_static() - - self.static_snip = tmp - -- updates own dependents. - self:update_dependents_static() -end - -function DynamicNode:exit() - self.visible = false - self.mark:clear() - -- check if snip actually exists, may not be the case if - -- the surrounding snippet was deleted just before. - if self.snip then - self.snip:exit() - end - self.stored_snip = self.snip - self.snip = nil - self.active = false -end - -function DynamicNode:set_ext_opts(name) - Node.set_ext_opts(self, name) - - -- might not have been generated (missing nodes). - if self.snip then - self.snip:set_ext_opts(name) - end -end - -function DynamicNode:store() - if self.snip then - self.snip:store() - end -end - -function DynamicNode:update_restore() - -- only restore snippet if arg-values still match. - if self.stored_snip and vim.deep_equal(self:get_args(), self.last_args) then - local tmp = self.stored_snip - - tmp.mark = - self.mark:copy_pos_gravs(vim.deepcopy(tmp:get_passive_ext_opts())) - - -- position might (will probably!!) still have changed, so update it - -- here too (as opposed to only in update). - tmp:init_positions(self.snip_absolute_position) - tmp:init_insert_positions(self.snip_absolute_insert_position) - - tmp:make_args_absolute() - - tmp:set_dependents() - tmp:set_argnodes(self.parent.snippet.dependents_dict) - - -- sets own extmarks false,true - self:focus() - -- inserts nodes with extmarks false,false - local from, to = self.mark:pos_begin_end_raw() - tmp:put_initial(from) - -- adjust gravity in left side of snippet, such that it matches the current - -- gravity of self. - tmp:subtree_set_pos_rgrav(to, -1, true) - - -- set snip before update_restore, since update_restore involves - -- calling `focus`, and that needs `snip` to be set. - -- If it is not set, tmp is not reachable via get_nodes_between. - -- (TODO: This is pretty bad, have to rethink design sometime). - self.snip = tmp - - tmp:update_restore() - else - self:update() - end -end - -function DynamicNode:find_node(predicate) - if self.snip then - if predicate(self.snip) then - return self.snip - else - return self.snip:find_node(predicate) - end - end - return nil -end - -function DynamicNode:insert_to_node_absolute(position) - if #position == 0 then - return self.absolute_position - end - return self.snip and self.snip:insert_to_node_absolute(position) -end - -function DynamicNode:init_insert_positions(position_so_far) - Node.init_insert_positions(self, position_so_far) - self.snip_absolute_insert_position = - vim.deepcopy(self.absolute_insert_position) - -- nodes of current snippet should have a 0 before. - self.snip_absolute_insert_position[#self.snip_absolute_insert_position + 1] = - 0 -end - -function DynamicNode:init_positions(position_so_far) - Node.init_positions(self, position_so_far) - self.snip_absolute_position = vim.deepcopy(self.absolute_position) - -- Reach current snippet as snip_absolute_position..0. - self.snip_absolute_position[#self.snip_absolute_position + 1] = 0 -end - -DynamicNode.make_args_absolute = FunctionNode.make_args_absolute -DynamicNode.set_dependents = FunctionNode.set_dependents - -function DynamicNode:resolve_position(position) - -- position must be 0, there are no other options. - return self.snip -end - -function DynamicNode:subtree_set_pos_rgrav(pos, direction, rgrav) - self.mark:set_rgrav(-direction, rgrav) - if self.snip then - self.snip:subtree_set_pos_rgrav(pos, direction, rgrav) - end -end - -function DynamicNode:subtree_set_rgrav(rgrav) - self.mark:set_rgravs(rgrav, rgrav) - if self.snip then - self.snip:subtree_set_rgrav(rgrav) - end -end - -function DynamicNode:extmarks_valid() - if self.snip then - return node_util.generic_extmarks_valid(self, self.snip) - end - return true -end - -return { - D = D, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/functionNode.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/functionNode.lua deleted file mode 100644 index cb1a77ae..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/functionNode.lua +++ /dev/null @@ -1,155 +0,0 @@ -local Node = require("luasnip.nodes.node").Node -local FunctionNode = Node:new() -local util = require("luasnip.util.util") -local node_util = require("luasnip.nodes.util") -local types = require("luasnip.util.types") -local tNode = require("luasnip.nodes.textNode").textNode -local extend_decorator = require("luasnip.util.extend_decorator") -local key_indexer = require("luasnip.nodes.key_indexer") - -local function F(fn, args, opts) - opts = opts or {} - - return FunctionNode:new({ - fn = fn, - args = node_util.wrap_args(args), - type = types.functionNode, - mark = nil, - user_args = opts.user_args or {}, - }, opts) -end -extend_decorator.register(F, { arg_indx = 3 }) - -FunctionNode.input_enter = tNode.input_enter - -function FunctionNode:get_static_text() - -- static_text will already have been generated, if possible. - -- If it isn't generated, prevent errors by just setting it to empty text. - if not self.static_text then - self.static_text = { "" } - end - return self.static_text -end - --- function-text will not stand out in any way in docstring. -FunctionNode.get_docstring = FunctionNode.get_static_text - -function FunctionNode:update() - local args = self:get_args() - -- skip this update if - -- - not all nodes are available. - -- - the args haven't changed. - if not args or vim.deep_equal(args, self.last_args) then - return - end - - if not self.parent.snippet:extmarks_valid() then - error("Refusing to update inside a snippet with invalid extmarks") - end - - self.last_args = args - local text = - util.to_string_table(self.fn(args, self.parent, unpack(self.user_args))) - if vim.bo.expandtab then - util.expand_tabs(text, util.tab_width(), #self.parent.indentstr) - end - - -- don't expand tabs in parent.indentstr, use it as-is. - self:set_text(util.indent(text, self.parent.indentstr)) - self:update_dependents() -end - -local update_errorstring = [[ -Error while evaluating functionNode@%d for snippet '%s': -%s - -:h luasnip-docstring for more info]] -function FunctionNode:update_static() - local args = self:get_static_args() - -- skip this update if - -- - not all nodes are available. - -- - the args haven't changed. - if not args or vim.deep_equal(args, self.last_args) then - return - end - -- should be okay to set last_args even if `fn` potentially fails, future - -- updates will fail aswell, if not the `fn` also doesn't always work - -- correctly in normal expansion. - self.last_args = args - local ok, static_text = - pcall(self.fn, args, self.parent, unpack(self.user_args)) - if not ok then - print( - update_errorstring:format( - self.indx, - self.parent.snippet.name, - static_text - ) - ) - static_text = { "" } - end - self.static_text = - util.indent(util.to_string_table(static_text), self.parent.indentstr) -end - -function FunctionNode:update_restore() - -- only if args still match. - if self.static_text and vim.deep_equal(self:get_args(), self.last_args) then - self:set_text(self.static_text) - else - self:update() - end -end - --- FunctionNode's don't have static text, only set visibility. -function FunctionNode:put_initial(_) - self.visible = true -end - -function FunctionNode:indent(_) end - -function FunctionNode:expand_tabs(_) end - -function FunctionNode:make_args_absolute(position_so_far) - self.args_absolute = {} - node_util.make_args_absolute(self.args, position_so_far, self.args_absolute) -end - -function FunctionNode:set_dependents() - local dict = self.parent.snippet.dependents_dict - local append_list = - vim.list_extend({ "dependents" }, self.absolute_position) - append_list[#append_list + 1] = "dependent" - - for _, arg in ipairs(self.args_absolute) do - -- if arg is a luasnip-node, just insert it as the key. - -- important!! rawget, because indexing absolute_indexer with some key - -- appends the key. - -- Maybe this is stupid?? - if rawget(arg, "type") ~= nil then - dict:set(vim.list_extend({ arg }, append_list), self) - elseif arg.absolute_insert_position then - -- copy absolute_insert_position, list_extend mutates. - dict:set( - vim.list_extend( - vim.deepcopy(arg.absolute_insert_position), - append_list - ), - self - ) - elseif key_indexer.is_key(arg) then - dict:set(vim.list_extend({ "key", arg.key }, append_list), self) - end - end -end - -function FunctionNode:is_interactive() - -- the function node is only evaluated once if it has no argnodes -> it's - -- not interactive then. - return #self.args ~= 0 -end - -return { - F = F, - FunctionNode = FunctionNode, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/insertNode.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/insertNode.lua deleted file mode 100644 index b8b456fc..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/insertNode.lua +++ /dev/null @@ -1,330 +0,0 @@ -local Node = require("luasnip.nodes.node") -local InsertNode = Node.Node:new() -local ExitNode = InsertNode:new() -local util = require("luasnip.util.util") -local node_util = require("luasnip.nodes.util") -local types = require("luasnip.util.types") -local events = require("luasnip.util.events") -local extend_decorator = require("luasnip.util.extend_decorator") - -local function I(pos, static_text, opts) - static_text = util.to_string_table(static_text) - - if pos == 0 then - return ExitNode:new({ - pos = pos, - static_text = static_text, - mark = nil, - dependents = {}, - type = types.exitNode, - -- will only be needed for 0-node, -1-node isn't set with this. - ext_gravities_active = { false, false }, - }, opts) - else - return InsertNode:new({ - pos = pos, - static_text = static_text, - mark = nil, - dependents = {}, - type = types.insertNode, - inner_active = false, - }, opts) - end -end -extend_decorator.register(I, { arg_indx = 3 }) - -function ExitNode:input_enter(no_move, dry_run) - if dry_run then - return - end - - -- Don't enter node for -1-node, it isn't in the node-table. - if self.pos == 0 then - InsertNode.input_enter(self, no_move, dry_run) - else - -- -1-node: - -- set rgrav true on left side of snippet. Text inserted now pushes the - -- snippet, and is not contained in it. - local begin_pos = self.mark:pos_begin_raw() - self.parent:subtree_set_pos_rgrav(begin_pos, 1, true) - - if not no_move then - if vim.fn.mode() == "i" then - util.insert_move_on(begin_pos) - else - vim.api.nvim_feedkeys( - vim.api.nvim_replace_termcodes("", true, false, true), - "n", - true - ) - util.normal_move_on_insert(begin_pos) - end - end - - self:event(events.enter) - end -end - -function ExitNode:focus() - local lrgrav, rrgrav - local snippet = self.parent - -- if last of first node of the snippet, make inserted text move out of snippet. - if snippet.nodes[#snippet.nodes] == self then - lrgrav = false - rrgrav = false - elseif snippet.nodes[1] == self then - lrgrav = true - rrgrav = true - else - lrgrav = false - rrgrav = true - end - - Node.focus_node(self, lrgrav, rrgrav) -end - -function ExitNode:input_leave(no_move, dry_run) - if dry_run then - return - end - - if self.pos == 0 then - InsertNode.input_leave(self, no_move, dry_run) - else - self:event(events.leave) - end -end - -function ExitNode:_update_dependents() end -function ExitNode:update_dependents() end -function ExitNode:update_all_dependents() end - -function ExitNode:_update_dependents_static() end -function ExitNode:update_dependents_static() end -function ExitNode:update_all_dependents_static() end -function ExitNode:is_interactive() - return true -end - -function InsertNode:input_enter(no_move, dry_run) - if dry_run then - return - end - - self.visited = true - self.mark:update_opts(self.ext_opts.active) - - -- no_move only prevents moving the cursor, but the active node should - -- still be focused. - self:focus() - - if not no_move then - -- SELECT snippet text only when there is text to select (more oft than not there isnt). - local mark_begin_pos, mark_end_pos = self.mark:pos_begin_end_raw() - if not util.pos_equal(mark_begin_pos, mark_end_pos) then - util.any_select(mark_begin_pos, mark_end_pos) - else - -- if current and target mode is INSERT, there's no reason to leave it. - if vim.fn.mode() == "i" then - util.insert_move_on(mark_begin_pos) - else - -- mode might be VISUAL or something else, but always leads to normal. - vim.api.nvim_feedkeys( - vim.api.nvim_replace_termcodes("", true, false, true), - "n", - true - ) - util.normal_move_on_insert(mark_begin_pos) - end - end - end - - self:event(events.enter) -end - --- only necessary for insertNodes, inner_active (unlike `active`) does not occur --- in other nodes. --- Since insertNodes don't have `active`, we can use the dry_run.active-field --- for this. -function InsertNode:init_dry_run_inner_active(dry_run) - if dry_run and dry_run.active[self] == nil then - dry_run.active[self] = self.inner_active - end -end -function InsertNode:is_inner_active(dry_run) - return (not dry_run and self.inner_active) - or (dry_run and dry_run.active[self]) -end - -function InsertNode:jump_into(dir, no_move, dry_run) - self:init_dry_run_inner_active(dry_run) - - if self:is_inner_active(dry_run) then - if dir == 1 then - if self.next then - self:input_leave_children(dry_run) - self:input_leave(no_move, dry_run) - return self.next:jump_into(dir, no_move, dry_run) - else - return nil - end - else - if self.prev then - self:input_leave_children(dry_run) - self:input_leave(no_move, dry_run) - return self.prev:jump_into(dir, no_move, dry_run) - else - return nil - end - end - else - self:input_enter(no_move, dry_run) - return self - end -end - -function ExitNode:jump_from(dir, no_move, dry_run) - self:init_dry_run_inner_active(dry_run) - - local next_node = util.ternary(dir == 1, self.next, self.prev) - local next_inner_node = - util.ternary(dir == 1, self.inner_first, self.inner_last) - - if next_inner_node then - self:input_enter_children(dry_run) - return next_inner_node:jump_into(dir, no_move, dry_run) - else - if next_node then - local next_node_dry_run = { active = {} } - -- don't have to `init_dry_run_inner_active` since this node does - -- not have children active if jump_from is called. - - -- true: don't move - local target_node = - next_node:jump_into(dir, true, next_node_dry_run) - -- if there is no node that can serve as jump-target, just remain - -- here. - -- Regular insertNodes don't have to handle this, since there is - -- always an exitNode or another insertNode at their endpoints. - if not target_node then - return self - end - - self:input_leave(no_move, dry_run) - return next_node:jump_into(dir, no_move, dry_run) or self - else - return self - end - end -end - -function InsertNode:jump_from(dir, no_move, dry_run) - self:init_dry_run_inner_active(dry_run) - - local next_node = util.ternary(dir == 1, self.next, self.prev) - local next_inner_node = - util.ternary(dir == 1, self.inner_first, self.inner_last) - - if next_inner_node then - self:input_enter_children(dry_run) - return next_inner_node:jump_into(dir, no_move, dry_run) - else - if next_node then - self:input_leave(no_move, dry_run) - return next_node:jump_into(dir, no_move, dry_run) - end - end -end - -function InsertNode:input_enter_children(dry_run) - if dry_run then - dry_run.active[self] = true - else - self.inner_active = true - end -end -function InsertNode:input_leave_children(dry_run) - if dry_run then - dry_run.active[self] = false - else - self.inner_active = false - end -end - -function InsertNode:input_leave(_, dry_run) - if dry_run then - return - end - - self:event(events.leave) - - self:update_dependents() - self.mark:update_opts(self:get_passive_ext_opts()) -end - -function InsertNode:exit() - if self.inner_first then - self.inner_first:exit() - end - self.visible = false - self.inner_first = nil - self.inner_last = nil - self.inner_active = false - self.mark:clear() -end - -function InsertNode:get_docstring() - -- copy as to not in-place-modify static text. - return util.string_wrap(self.static_text, rawget(self, "pos")) -end - -function InsertNode:is_interactive() - return true -end - -function InsertNode:child_snippets() - local own_child_snippets = {} - for _, child_snippet in ipairs(self.parent.snippet.child_snippets) do - if child_snippet.parent_node == self then - table.insert(own_child_snippets, child_snippet) - end - end - return own_child_snippets -end - -function InsertNode:subtree_set_pos_rgrav(pos, direction, rgrav) - self.mark:set_rgrav(-direction, rgrav) - - local own_child_snippets = self:child_snippets() - - local child_from_indx - if direction == 1 then - child_from_indx = 1 - else - child_from_indx = #own_child_snippets - end - - node_util.nodelist_adjust_rgravs( - own_child_snippets, - child_from_indx, - pos, - direction, - rgrav, - -- don't assume that the child-snippets are all adjacent. - false - ) -end - -function InsertNode:subtree_set_rgrav(rgrav) - self.mark:set_rgravs(rgrav, rgrav) - - local own_child_snippets = self:child_snippets() - - for _, child_snippet in ipairs(own_child_snippets) do - child_snippet:subtree_set_rgrav(rgrav) - end -end - -return { - I = I, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/key_indexer.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/key_indexer.lua deleted file mode 100644 index 04e6f7f3..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/key_indexer.lua +++ /dev/null @@ -1,12 +0,0 @@ -local M = {} - -local key_mt = {} -function M.new_key(key) - return setmetatable({ key = key }, key_mt) -end - -function M.is_key(t) - return getmetatable(t) == key_mt -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/multiSnippet.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/multiSnippet.lua deleted file mode 100644 index 108206ea..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/multiSnippet.lua +++ /dev/null @@ -1,117 +0,0 @@ -local snip_mod = require("luasnip.nodes.snippet") -local node_util = require("luasnip.nodes.util") -local extend_decorator = require("luasnip.util.extend_decorator") - -local VirtualSnippet = {} -local VirtualSnippet_mt = { __index = VirtualSnippet } - -function VirtualSnippet:get_docstring() - return self.snippet:get_docstring() -end -function VirtualSnippet:copy() - local copy = self.snippet:copy() - copy.id = self.id - - return copy -end - --- VirtualSnippet has all the fields for executing these methods. -VirtualSnippet.matches = snip_mod.Snippet.matches -VirtualSnippet.invalidate = snip_mod.Snippet.invalidate - ----Create new virtual snippet, ie. an object which is capable of performning ----all the functions expected from a snippet which is yet to be expanded ----(`matches`,`get_docstring`,`invalidate`,`retrieve_all`,`copy`) ----@param context context as defined for snippet-constructor. Table, not nil. ----@param snippet The snippet this virtual snippet will return on `copy`, also not nil. ----@param opts opts as defined for snippet-constructor. Has to be a table, may be empty. -local function new_virtual_snippet(context, snippet, opts) - -- init fields necessary for matches, invalidate, adding the snippet. - local o = snip_mod.init_snippet_context(context, opts) - o.snippet = snippet - - setmetatable(o, VirtualSnippet_mt) - - return o -end - -local MultiSnippet = {} -local MultiSnippet_mt = { __index = MultiSnippet } - -function MultiSnippet:retrieve_all() - return self.v_snips -end - -local function multisnippet_from_snippet_obj(contexts, snippet, snippet_opts) - assert( - type(contexts) == "table", - "multisnippet: expected contexts to be a table." - ) - local common_context = node_util.wrap_context(contexts.common) or {} - - local v_snips = {} - for _, context in ipairs(contexts) do - local complete_context = vim.tbl_extend( - "keep", - node_util.wrap_context(context), - common_context - ) - table.insert( - v_snips, - new_virtual_snippet(complete_context, snippet, snippet_opts) - ) - end - - local o = { - v_snips = v_snips, - } - - setmetatable(o, MultiSnippet_mt) - - return o -end - -local function multisnippet_from_nodes(contexts, nodes, opts) - opts = opts or {} - local common_snip_opts = opts.common_opts or {} - - -- create snippet without `context`-fields! - -- compare to `S` (aka `s`, the default snippet-constructor) in - -- `nodes/snippet.lua`. - return multisnippet_from_snippet_obj( - contexts, - snip_mod._S( - snip_mod.init_snippet_opts(common_snip_opts), - nodes, - common_snip_opts - ), - common_snip_opts - ) -end - -local function extend_multisnippet_contexts(passed_arg, extend_arg) - -- extend passed arg with contexts passed in extend-call - vim.list_extend(passed_arg, extend_arg) - - -- extend ("keep") valid keyword-arguments. - passed_arg.common = vim.tbl_deep_extend( - "keep", - node_util.wrap_context(passed_arg.common) or {}, - node_util.wrap_context(extend_arg.common) or {} - ) - - return passed_arg -end -extend_decorator.register( - multisnippet_from_nodes, - -- first arg needs special handling (extend list of contexts (index i - -- becomes i+#passed_arg, not i again)) - { arg_indx = 1, extend = extend_multisnippet_contexts }, - -- opts can just be `vim.tbl_extend`ed. - { arg_indx = 3 } -) - -return { - new_multisnippet = multisnippet_from_nodes, - _raw_ms = multisnippet_from_snippet_obj, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/node.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/node.lua deleted file mode 100644 index ad41c923..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/node.lua +++ /dev/null @@ -1,643 +0,0 @@ -local session = require("luasnip.session") -local util = require("luasnip.util.util") -local node_util = require("luasnip.nodes.util") -local ext_util = require("luasnip.util.ext_opts") -local events = require("luasnip.util.events") -local key_indexer = require("luasnip.nodes.key_indexer") -local types = require("luasnip.util.types") - -local Node = {} - -function Node:new(o, opts) - o = o or {} - - -- visible is true if the node is visible on-screen, during normal - -- expansion, static_visible is needed for eg. get_static_text, where - -- argnodes in inactive choices will happily provide their static text, - -- which leads to inaccurate docstrings. - o.visible = false - o.static_visible = false - o.old_text = {} - o.visited = false - -- override existing keys, might be necessary due to double-init from - -- snippetProxy, but shouldn't hurt. - o = vim.tbl_extend("force", o, node_util.init_node_opts(opts or {})) - - setmetatable(o, self) - self.__index = self - - return o -end - -function Node:get_static_text() - -- return nil if not visible. - -- This will prevent updates if not all nodes are visible during - -- docstring/static_text-generation. (One example that would otherwise fail - -- is the following snippet: - -- - -- s("trig", { - -- i(1, "cccc"), - -- t" ", - -- c(2, { - -- t"aaaa", - -- i(nil, "bbbb") - -- }), - -- f(function(args) return args[1][1]..args[2][1] end, {ai[2][2], 1} ) - -- }) - -- - -- ) - -- By also allowing visible, and not only static_visible, the docstrings - -- generated during `get_current_choices` (ie. without having the whole - -- snippet `static_init`ed) get better. - if not self.visible and not self.static_visible then - return nil - end - return self.static_text -end - -function Node:get_docstring() - -- visibility only matters for get_static_text because that's called for - -- argnodes whereas get_docstring will only be called for actually - -- visible nodes. - return self.static_text -end - -function Node:put_initial(pos) - -- access static text directly, get_static_text() won't work due to - -- static_visible not being set. - util.put(self.static_text, pos) - self.visible = true -end - -function Node:input_enter(_, _) - self.visited = true - self.mark:update_opts(self.ext_opts.active) - - self:event(events.enter) -end - --- dry_run: if not nil, it has to be a table with the key `active` also a table. --- dry_run.active[node] stores whether the node is "active" in the dry run (we --- can't change the `active`-state in the actual node, so changes to the --- active-state are stored in the `dry_run`-table, which is passed to all nodes --- that participate in the jump) --- The changes to `active` have to be stored. Otherwise, `dry_run` can lead to --- endless loops in cases like: --- ```lua --- s({ trig = 'n' } , { i(1, "1"), sn(2, {t"asdf"}), i(3, "3") }) --- ``` --- --- Here, jumping from 1 will first set active on the snippetNode, then, since --- there are no interactive nodes inside it, and since active is set, we will --- jump to the `i(3)`. --- If active is not set during the dry_run, we will just keep jumping into the --- inner textNode. --- --- A similar problem occurs in nested expansions (insertNode.inner_active --- is not set). -function Node:jump_into(_, no_move, dry_run) - if not dry_run then - self:input_enter(no_move, dry_run) - end - return self -end - -function Node:jump_from(dir, no_move, dry_run) - self:input_leave(no_move, dry_run) - if dir == 1 then - if self.next then - return self.next:jump_into(dir, no_move, dry_run) - else - return nil - end - else - if self.prev then - return self.prev:jump_into(dir, no_move, dry_run) - else - return nil - end - end -end - -function Node:jumpable(dir) - if dir == 1 then - return self.next ~= nil - else - return self.prev ~= nil - end -end - -function Node:get_text() - if not self.visible then - return nil - end - local ok, text = pcall(function() - local from_pos, to_pos = self.mark:pos_begin_end_raw() - - -- end-exclusive indexing. - local lines = - vim.api.nvim_buf_get_lines(0, from_pos[1], to_pos[1] + 1, false) - - if #lines == 1 then - lines[1] = string.sub(lines[1], from_pos[2] + 1, to_pos[2]) - else - lines[1] = string.sub(lines[1], from_pos[2] + 1, #lines[1]) - - -- node-range is end-exclusive. - lines[#lines] = string.sub(lines[#lines], 1, to_pos[2]) - end - return lines - end) - -- if deleted. - return ok and text or { "" } -end - -function Node:set_old_text() - self.old_text = self:get_text() -end - -function Node:exit() - self.visible = false - self.mark:clear() -end - -function Node:get_passive_ext_opts() - if self.visited then - return self.ext_opts.visited - else - return self.ext_opts.unvisited - end -end - -function Node:input_leave(_, dry_run) - if dry_run then - return - end - self:event(events.leave) - - self.mark:update_opts(self:get_passive_ext_opts()) -end -function Node:input_leave_children() end -function Node:input_enter_children() end - -local function find_dependents(self, position_self, dict) - local nodes = {} - - -- this might also be called from a node which does not possess a position! - -- (for example, a functionNode may be depended upon via its key) - if position_self then - position_self[#position_self + 1] = "dependents" - vim.list_extend(nodes, dict:find_all(position_self, "dependent") or {}) - position_self[#position_self] = nil - end - - vim.list_extend( - nodes, - dict:find_all({ self, "dependents" }, "dependent") or {} - ) - - if self.key then - vim.list_extend( - nodes, - dict:find_all({ "key", self.key, "dependents" }, "dependent") or {} - ) - end - - return nodes -end - -function Node:_update_dependents() - local dependent_nodes = find_dependents( - self, - self.absolute_insert_position, - self.parent.snippet.dependents_dict - ) - if #dependent_nodes == 0 then - return - end - for _, node in ipairs(dependent_nodes) do - if node.visible then - node:update() - end - end -end - --- _update_dependents is the function to update the nodes' dependents, --- update_dependents is what will actually be called. --- This allows overriding update_dependents in a parent-node (eg. snippetNode) --- while still having access to the original function (for subsequent overrides). -Node.update_dependents = Node._update_dependents --- update_all_dependents is used to update all nodes' dependents in a --- snippet-tree. Necessary in eg. set_choice (especially since nodes may have --- dependencies outside the tree itself, so update_all_dependents should take --- care of those too.) -Node.update_all_dependents = Node._update_dependents - -function Node:_update_dependents_static() - local dependent_nodes = find_dependents( - self, - self.absolute_insert_position, - self.parent.snippet.dependents_dict - ) - if #dependent_nodes == 0 then - return - end - for _, node in ipairs(dependent_nodes) do - if node.static_visible then - node:update_static() - end - end -end - -Node.update_dependents_static = Node._update_dependents_static -Node.update_all_dependents_static = Node._update_dependents_static - -function Node:update() end - -function Node:update_static() end - -function Node:expand_tabs(tabwidth, indentstr) - util.expand_tabs(self.static_text, tabwidth, indentstr) -end - -function Node:indent(indentstr) - util.indent(self.static_text, indentstr) -end - -function Node:subsnip_init() end - -function Node:init_positions(position_so_far) - self.absolute_position = vim.deepcopy(position_so_far) -end - -function Node:init_insert_positions(position_so_far) - self.absolute_insert_position = vim.deepcopy(position_so_far) -end - -function Node:event(event) - local node_callback = self.node_callbacks[event] - if node_callback then - node_callback(self) - end - - -- try to get the callback from the parent. - if self.pos then - -- node needs position to get callback (nodes may not have position if - -- defined in a choiceNode, ie. c(1, { - -- i(nil, {"works!"}) - -- })) - -- works just fine. - local parent_callback = self.parent.callbacks[self.pos][event] - if parent_callback then - parent_callback(self) - end - end - - session.event_node = self - vim.api.nvim_exec_autocmds("User", { - pattern = "Luasnip" .. events.to_string(self.type, event), - modeline = false, - }) -end - -local function get_args(node, get_text_func_name) - local argnodes_text = {} - for _, arg in ipairs(node.args_absolute) do - local argnode - if key_indexer.is_key(arg) then - argnode = node.parent.snippet.dependents_dict:get({ - "key", - arg.key, - "node", - }) - else - -- since arg may be a node, it may not be initialized in the snippet - -- and therefore not have an absolute_insert_position. Check for that. - if not arg.absolute_insert_position then - -- the node is not (yet, maybe) visible. - return nil - end - local dict_key = arg.absolute_insert_position - -- will append to arg.absolute_insert_position, but it's restored - -- two lines down. - -- (dict:get shouldn't (yeah yeah, you never know, but this really - -- shouldn't) fail, so we don't worry with pcall) - table.insert(dict_key, "node") - argnode = node.parent.snippet.dependents_dict:get(dict_key) - dict_key[#dict_key] = nil - end - -- maybe the node is part of a dynamicNode and not yet generated. - if not argnode then - return nil - end - - local argnode_text = argnode[get_text_func_name](argnode) - -- can only occur with `get_text`. If one returns nil, the argnode - -- isn't visible or some other error occured. Either way, return nil - -- to signify that not all argnodes are available. - if not argnode_text then - return nil - end - table.insert(argnodes_text, argnode_text) - end - - return argnodes_text -end - -function Node:get_args() - return get_args(self, "get_text") -end -function Node:get_static_args() - return get_args(self, "get_static_text") -end - -function Node:get_jump_index() - return self.pos -end - -function Node:set_ext_opts(name) - -- differentiate, either visited or unvisited needs to be set. - if name == "passive" then - self.mark:update_opts(self:get_passive_ext_opts()) - else - self.mark:update_opts(self.ext_opts[name]) - end -end - --- for insert,functionNode. -function Node:store() - self.static_text = self:get_text() -end - -function Node:update_restore() end - --- find_node only needs to check children, self is checked by the parent. -function Node:find_node() - return nil -end - -Node.ext_gravities_active = { false, true } - -function Node:insert_to_node_absolute(position) - -- this node is a leaf, just return its position - return self.absolute_position -end - -function Node:set_dependents() end - -function Node:set_argnodes(dict) - if self.absolute_insert_position then - -- append+remove "node" from absolute_insert_position to quickly create - -- key for dict. - table.insert(self.absolute_insert_position, "node") - dict:set(self.absolute_insert_position, self) - self.absolute_insert_position[#self.absolute_insert_position] = nil - end - if self.key then - dict:set({ "key", self.key, "node" }, self) - end -end - -function Node:make_args_absolute() end - -function Node:resolve_position(position) - error( - string.format( - "invalid resolve_position(%d) on node at %s", - position, - vim.inspect(self.absolute_position) - ) - ) -end - -function Node:static_init() - self.static_visible = true -end - --- resolve_*node*_ext_opts because snippet(Node)s have child_ext_opts, which --- also have to be resolved. --- This function generates a nodes ext_opts (those actually used in highlighting). -function Node:resolve_node_ext_opts(base_prio, parent_ext_opts) - if self.merge_node_ext_opts then - self.ext_opts = ext_util.extend( - vim.deepcopy(self.node_ext_opts), - parent_ext_opts or self.parent.effective_child_ext_opts[self.type] - ) - else - self.ext_opts = self.node_ext_opts - end - - ext_util.set_abs_prio( - self.ext_opts, - (base_prio or self.parent.ext_opts.base_prio) - + session.config.ext_prio_increase - ) -end - -function Node:is_interactive() - -- safe default. - return true -end - --- initialize active-setting in dry_run-table for `self`. -function Node:init_dry_run_active(dry_run) - if dry_run and dry_run.active[self] == nil then - dry_run.active[self] = self.active - end -end --- determine whether this node is currently active. --- This is its own function (and not just a flat table-check) since we have to --- check the data in the dry_run-table or the node, depending on `dry_run`. -function Node:is_active(dry_run) - return (not dry_run and self.active) or (dry_run and dry_run.active[self]) -end - -function Node:get_buf_position(opts) - opts = opts or {} - local raw = opts.raw ~= nil and opts.raw or true - - if raw then - return self.mark:pos_begin_end_raw() - else - return self.mark:pos_begin_end() - end -end - --- only does something for insert- and snippetNode. -function Node:set_sibling_rgravs(_, _, _, _) end - --- when an insertNode receives text, its mark/region should contain all the --- text that is inserted. --- This can be achieved by setting the left and right "right-gravity"(rgrav) of --- the mark, which are responsible for controlling the direction an endpoint of --- the mark is moved when text is inserted. --- When a regular insertNode is focused/entered, we would like the left and --- right rgrav to be false and true, respectively. Example: --- this is an insertNodeAnd this is another insertNode --- mark1: l r --- mark2: l r --- if `this is an insertNode` should be focused, we have to set the rgrav of --- l1 false (because inserting text at the column of l1 should not shift l1 to --- the right). Similarly, the rgrav of r1 has to be set true, text inserted at --- its column SHOULD move it to the right. --- Complicating this whole thing: if like above there is an adjacent --- insertNode, its gravities have to be adjusted as well (if they are not, the --- insertNodes regions would overlap, which is obviously confusing). So, when --- adjusting some nodes rgravs, those of the siblings may have to be adjusted as well. --- Another example: --- aacc --- mark1: l r --- mark2: l --- r --- mark3: l r --- (the insertNode for mark2 is not visible at all, l2 and r2 are in the same --- column) --- This example highlights that not only the immediate sibling might need --- adjusting, but all siblings that share a mark-boundary with the node that --- should be focused. --- Even further complicating the matter: Snippets are trees, and failing to --- set the rgrav of snippet adjacent to (sharing an endpoint with) the node we --- want to focus, regardless of its position in the tree, will lead to extmarks --- covering the wrong regions. --- --- More complications: focusing a node does not always mean setting the rgravs --- such that text will end up inside the node! --- For example, in the case of a terminating i(0) (like s("trig", {i(1, --- "text"), t" ", i(0)})), we would like to NOT include the text entered into --- it in the snippet. Thus, the gravities of it and all its parents have to be --- set (in this case) false,false, if the i(0) were at the beginning of the --- snippet (weird??) they'd have to be true,true. --- --- --- Unfortunately, we cannot guarantee that two extmarks on the same position --- also have the same gravities, for exmample if the text inside a focused node --- is deleted, and then another unrelated node is focused, the two endpoints of --- the previously focused node will have opposing rgravs. --- Maybe this whole procedure could be sped up further if we can assume that --- identical endpoints imply identical rgravs. -local function focus_node(self, lrgrav, rrgrav) - -- find nodes on path from self to root. - local nodes_path = node_util.root_path(self) - - -- direction is the direction away from this node, towards the outside of - -- the tree-representation of the snippet. - -- This is dubbed "direction" because it is the direction we will search in - -- to find nodes on one endpoint of self. - for _, direction in ipairs({ -1, 1 }) do - local self_direction_endpoint = self.mark:get_endpoint(direction) - local direction_rgrav = util.ternary(direction == -1, lrgrav, rrgrav) - local effective_direction_rgrav = direction_rgrav - - -- adjust left rgrav of all nodes on path upwards to root/snippet: - -- (i st. self and the snippet are both handled) - for i = 1, #nodes_path do - local node = nodes_path[i] - local node_direction_endpoint = node.mark:get_endpoint(direction) - - if - not util.pos_equal( - node_direction_endpoint, - self_direction_endpoint - ) - then - -- stop adjusting rgravs once self no longer is on the boundary of - -- its parents, or if the rgrav is already set correctly. - break - end - - node.mark:set_rgrav(direction, effective_direction_rgrav) - - -- Once self's snippet is reached on the root-path, we will only - -- adjust nodes self should be completely contained inside. - -- Since the rgravs, however, may be set up otherwise (for example - -- when focusing on an $0 that is the last node of the snippet), we - -- have to adjust them now. - if node.snippet == node then - effective_direction_rgrav = direction == 1 - end - - -- can't use node.parent, since that might skip nodes (in the case of - -- dynamicNode, for example, the generated snippets parent is not the - -- dynamicNode, but its parent). - -- also: don't need to check for nil, because the - local node_above = nodes_path[i + 1] - if node_above then - node_above:set_sibling_rgravs( - node, - self_direction_endpoint, - direction, - effective_direction_rgrav - ) - end - end - self:subtree_set_pos_rgrav( - self_direction_endpoint, - -direction, - direction_rgrav - ) - end -end - -function Node:subtree_set_rgrav(rgrav) - self.mark:set_rgravs(rgrav, rgrav) -end - -function Node:subtree_set_pos_rgrav(_, direction, rgrav) - self.mark:set_rgrav(-direction, rgrav) -end - -function Node:focus() - focus_node(self, false, true) -end - -function Node:set_text(text) - self:focus() - - local node_from, node_to = self.mark:pos_begin_end_raw() - local ok = pcall( - vim.api.nvim_buf_set_text, - 0, - node_from[1], - node_from[2], - node_to[1], - node_to[2], - text - ) - -- we can assume that (part of) the snippet was deleted; remove it from - -- the jumplist. - if not ok then - error("[LuaSnip Failed]: " .. vim.inspect(text)) - end -end - --- since parents validate the adjacency, nodes where we don't know anything --- about the text inside them just have to assume they haven't been deleted :D -function Node:extmarks_valid() - return true -end - -function Node:linkable() - -- linkable if insert or exitNode. - return vim.tbl_contains( - { types.insertNode, types.exitNode }, - rawget(self, "type") - ) -end -function Node:interactive() - -- interactive if immediately inside choiceNode. - return vim.tbl_contains( - { types.insertNode, types.exitNode }, - rawget(self, "type") - ) or rawget(self, "choice") ~= nil -end -function Node:leaf() - return vim.tbl_contains( - { types.textNode, types.functionNode, types.insertNode, types.exitNode }, - rawget(self, "type") - ) -end - -return { - Node = Node, - focus_node = focus_node, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/restoreNode.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/restoreNode.lua deleted file mode 100644 index 48c8448a..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/restoreNode.lua +++ /dev/null @@ -1,307 +0,0 @@ --- restoreNode is implemented similarly to dynamicNode, only that it gets the snippetNode not from some function, but from self.snip.stored[key]. - -local Node = require("luasnip.nodes.node").Node -local wrap_nodes_in_snippetNode = - require("luasnip.nodes.snippet").wrap_nodes_in_snippetNode -local RestoreNode = Node:new() -local types = require("luasnip.util.types") -local events = require("luasnip.util.events") -local util = require("luasnip.util.util") -local node_util = require("luasnip.nodes.util") -local mark = require("luasnip.util.mark").mark -local extend_decorator = require("luasnip.util.extend_decorator") - -local function R(pos, key, nodes, opts) - -- don't create nested snippetNodes, unnecessary. - nodes = nodes and wrap_nodes_in_snippetNode(nodes) - - return RestoreNode:new({ - pos = pos, - key = key, - mark = nil, - snip = nodes, - type = types.restoreNode, - dependents = {}, - -- TODO: find out why it's necessary only for this node. - active = false, - }, opts) -end -extend_decorator.register(R, { arg_indx = 4 }) - -function RestoreNode:exit() - if not self.visible then - -- already exited. - return - end - - self.visible = false - self.mark:clear() - -- snip should exist if exit is called. - self.snip:store() - -- will be copied on restore, no need to copy here too. - self.parent.snippet.stored[self.key] = self.snip - self.snip:exit() - self.snip = nil - self.active = false -end - -function RestoreNode:input_enter(_, dry_run) - if dry_run then - dry_run.active[self] = true - return - end - - self.active = true - self.visited = true - self.mark:update_opts(self.ext_opts.active) - - self:event(events.enter) -end - -function RestoreNode:input_leave(_, dry_run) - if dry_run then - dry_run.active[self] = false - return - end - - self:event(events.leave) - - self:update_dependents() - self.active = false - - self.mark:update_opts(self:get_passive_ext_opts()) -end - --- set snippetNode for this key here. -function RestoreNode:subsnip_init() - -- don't overwrite potentially stored snippetNode. - -- due to metatable, there will always be a node set, but only those set - -- by it (should) have the is_default set to true. - if self.parent.snippet.stored[self.key].is_default and self.snip then - self.parent.snippet.stored[self.key] = self.snip - end -end - --- don't need these, will be done in put_initial and get_static/docstring. -function RestoreNode:indent(_) end - -function RestoreNode:expand_tabs(_) end - --- will be called when before expansion but after snip.parent was initialized. --- Get the actual snippetNode here. -function RestoreNode:put_initial(pos) - local tmp = self.parent.snippet.stored[self.key] - - -- act as if snip is directly inside parent. - tmp.parent = self.parent - tmp.indx = self.indx - - tmp.next = self - tmp.prev = self - - tmp.snippet = self.parent.snippet - - tmp.restore_node = self - tmp.update_dependents = function(node) - node:_update_dependents() - -- self is restoreNode. - node.restore_node:update_dependents() - end - - tmp:resolve_child_ext_opts() - tmp:resolve_node_ext_opts() - tmp:subsnip_init() - - tmp:init_positions(self.snip_absolute_position) - tmp:init_insert_positions(self.snip_absolute_insert_position) - - tmp:make_args_absolute() - - tmp:set_dependents() - tmp:set_argnodes(self.parent.snippet.dependents_dict) - - if vim.bo.expandtab then - tmp:expand_tabs(util.tab_width(), self.parent.indentstring) - end - - -- correctly set extmark for node. - -- does not modify ext_opts[node.type]. - local mark_opts = vim.tbl_extend("keep", { - right_gravity = false, - end_right_gravity = false, - }, tmp:get_passive_ext_opts()) - - local old_pos = vim.deepcopy(pos) - tmp:put_initial(pos) - tmp.mark = mark(old_pos, pos, mark_opts) - - -- no need to call update here, will be done by function calling this - -- function. - - self.snip = tmp - self.visible = true -end - --- the same as DynamicNode. -function RestoreNode:jump_into(dir, no_move, dry_run) - self:init_dry_run_active(dry_run) - - if self:is_active(dry_run) then - self:input_leave(no_move, dry_run) - - if dir == 1 then - return self.next:jump_into(dir, no_move, dry_run) - else - return self.prev:jump_into(dir, no_move, dry_run) - end - else - self:input_enter(no_move, dry_run) - - return self.snip:jump_into(dir, no_move, dry_run) - end -end - -function RestoreNode:set_ext_opts(name) - Node.set_ext_opts(self, name) - - self.snip:set_ext_opts(name) -end - -function RestoreNode:update() - self.snip:update() -end - -function RestoreNode:update_static() - -- *_static-methods can use the stored snippet, since they don't require - -- the snip to actually be inside the restoreNode. - self.parent.snippet.stored[self.key]:update_static() -end - -local function snip_init(self, snip) - snip.parent = self.parent - - snip.snippet = self.parent.snippet - -- pos should be nil if the restoreNode is inside a choiceNode. - snip.pos = rawget(self, "pos") - - snip:resolve_child_ext_opts() - snip:resolve_node_ext_opts() - snip:subsnip_init() - - snip:init_positions(self.snip_absolute_position) - snip:init_insert_positions(self.snip_absolute_insert_position) - - snip:make_args_absolute() - - snip:set_dependents() - snip:set_argnodes(self.parent.snippet.dependents_dict) - - snip:static_init() -end - -function RestoreNode:static_init() - Node.static_init(self) - self.snip = self.parent.snippet.stored[self.key] - snip_init(self, self.snip) -end - -function RestoreNode:get_static_text() - -- cache static_text, no need to recalculate function. - if not self.static_text then - self.static_text = - self.parent.snippet.stored[self.key]:get_static_text() - end - return self.static_text -end - -function RestoreNode:get_docstring() - if not self.docstring then - self.docstring = self.parent.snippet.stored[self.key]:get_docstring() - end - return self.docstring -end - -function RestoreNode:store() end - --- will be restored through other means. -function RestoreNode:update_restore() - self.snip:update_restore() -end - -function RestoreNode:find_node(predicate) - if self.snip then - if predicate(self.snip) then - return self.snip - else - return self.snip:find_node(predicate) - end - end - return nil -end - -function RestoreNode:insert_to_node_absolute(position) - if #position == 0 then - return self.absolute_position - end - -- nil if not yet available. - return self.snip and self.snip:insert_to_node_absolute(position) -end - -function RestoreNode:update_all_dependents() - self:_update_dependents() - self.snip:update_all_dependents() -end - -function RestoreNode:update_all_dependents_static() - self:_update_dependents_static() - self.parent.snippet.stored[self.key]:_update_dependents_static() -end - -function RestoreNode:init_insert_positions(position_so_far) - Node.init_insert_positions(self, position_so_far) - self.snip_absolute_insert_position = - vim.deepcopy(self.absolute_insert_position) - -- nodes of current snippet should have a 0 before. - self.snip_absolute_insert_position[#self.snip_absolute_insert_position + 1] = - 0 -end - -function RestoreNode:init_positions(position_so_far) - Node.init_positions(self, position_so_far) - self.snip_absolute_position = vim.deepcopy(self.absolute_position) - -- Reach current snippet as snip_absolute_position..0. - self.snip_absolute_position[#self.snip_absolute_position + 1] = 0 -end - -function RestoreNode:resolve_position(position) - -- position must be 0, there are no other options. - return self.snip -end - -function RestoreNode:is_interactive() - -- shouldn't be called, but revisit this once is_interactive is used in - -- places other than lsp-snippets. - return true -end - -function RestoreNode:subtree_set_pos_rgrav(pos, direction, rgrav) - self.mark:set_rgrav(-direction, rgrav) - if self.snip then - self.snip:subtree_set_pos_rgrav(pos, direction, rgrav) - end -end - -function RestoreNode:subtree_set_rgrav(rgrav) - self.mark:set_rgravs(rgrav, rgrav) - if self.snip then - self.snip:subtree_set_rgrav(rgrav) - end -end - -function RestoreNode:extmarks_valid() - return node_util.generic_extmarks_valid(self, self.snip) -end - -return { - R = R, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/snippet.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/snippet.lua deleted file mode 100644 index a0be2fb9..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/snippet.lua +++ /dev/null @@ -1,1572 +0,0 @@ -local node_mod = require("luasnip.nodes.node") -local iNode = require("luasnip.nodes.insertNode") -local tNode = require("luasnip.nodes.textNode") -local util = require("luasnip.util.util") -local ext_util = require("luasnip.util.ext_opts") -local node_util = require("luasnip.nodes.util") -local types = require("luasnip.util.types") -local events = require("luasnip.util.events") -local mark = require("luasnip.util.mark").mark -local Environ = require("luasnip.util.environ") -local session = require("luasnip.session") -local pattern_tokenizer = require("luasnip.util.pattern_tokenizer") -local dict = require("luasnip.util.dict") -local snippet_collection = require("luasnip.session.snippet_collection") -local extend_decorator = require("luasnip.util.extend_decorator") -local source = require("luasnip.session.snippet_collection.source") -local loader_util = require("luasnip.loaders.util") -local trig_engines = require("luasnip.nodes.util.trig_engines") - -local true_func = function() - return true -end - -local generate_resolve_expand_params_func = function(condition, user_resolve) - return function(self, line_to_cursor, match, captures) - if condition then - if not condition(line_to_cursor, match, captures) then - return nil - end - end - - local default_expand_params = { - trigger = match, - captures = captures, - } - - if user_resolve then - local res = user_resolve(self, line_to_cursor, match, captures) - if res == nil then - return nil - end - return vim.tbl_extend("force", default_expand_params, res) - else - return default_expand_params - end - end -end - -local callbacks_mt = { - __index = function(table, key) - rawset(table, key, {}) - return {} - end, -} - --- declare SN here, is needed in metatable. -local SN - -local stored_mt = { - __index = function(table, key) - -- default-node is just empty text. - local val = SN(nil, { iNode.I(1) }) - val.is_default = true - rawset(table, key, val) - return val - end, -} - -local Snippet = node_mod.Node:new() - -local Parent_indexer = {} - -function Parent_indexer:new(o) - setmetatable(o, self) - self.__index = self - return o -end - --- Returns referred node from parent (or parents' parent). -function Parent_indexer:resolve(snippet) - -- recurse if index is a parent_indexer - if getmetatable(self.indx) == Parent_indexer then - return self.indx:resolve(snippet.parent) - else - return snippet.parent.insert_nodes[self.indx] - end -end - -local function P(indx) - return Parent_indexer:new({ indx = indx }) -end - -function Snippet:init_nodes() - local insert_nodes = {} - for i, node in ipairs(self.nodes) do - node.parent = self - node.indx = i - if - node.type == types.insertNode - or node.type == types.exitNode - or node.type == types.snippetNode - or node.type == types.choiceNode - or node.type == types.dynamicNode - or node.type == types.restoreNode - then - if node.pos then - insert_nodes[node.pos] = node - end - end - - node.update_dependents = function(node) - node:_update_dependents() - node.parent:update_dependents() - end - end - - if insert_nodes[1] then - insert_nodes[1].prev = self - for i = 2, #insert_nodes do - insert_nodes[i].prev = insert_nodes[i - 1] - insert_nodes[i - 1].next = insert_nodes[i] - end - insert_nodes[#insert_nodes].next = self - - self.inner_first = insert_nodes[1] - self.inner_last = insert_nodes[#insert_nodes] - else - self.inner_first = self - self.inner_last = self - end - - self.insert_nodes = insert_nodes -end - -local function wrap_nodes_in_snippetNode(nodes) - if getmetatable(nodes) then - -- is a node, not a table. - if nodes.type ~= types.snippetNode then - -- is not a snippetNode. - - -- pos might have been nil, just set it correctly here. - nodes.pos = 1 - return SN(nil, { nodes }) - else - -- is a snippetNode, wrapping it twice is unnecessary. - return nodes - end - else - -- is a table of nodes. - return SN(nil, nodes) - end -end - -local function init_snippetNode_opts(opts) - local in_node = {} - - in_node.child_ext_opts = - ext_util.child_complete(vim.deepcopy(opts.child_ext_opts or {})) - - if opts.merge_child_ext_opts == nil then - in_node.merge_child_ext_opts = true - else - in_node.merge_child_ext_opts = opts.merge_child_ext_opts - end - - in_node.callbacks = opts.callbacks or {} - -- return empty table for non-specified callbacks. - setmetatable(in_node.callbacks, callbacks_mt) - - return in_node -end - -local function init_snippet_opts(opts) - local in_node = {} - - -- return sn(t("")) for so-far-undefined keys. - in_node.stored = setmetatable(opts.stored or {}, stored_mt) - - -- wrap non-snippetNode in snippetNode. - for key, nodes in pairs(in_node.stored) do - in_node.stored[key] = wrap_nodes_in_snippetNode(nodes) - end - - return vim.tbl_extend("error", in_node, init_snippetNode_opts(opts)) -end - --- context, opts non-nil tables. -local function init_snippet_context(context, opts) - local effective_context = {} - - -- trig is set by user, trigger is used internally. - -- not worth a breaking change, we just make it compatible here. - effective_context.trigger = context.trig - - effective_context.name = context.name or context.trig - - -- context.{desc,dscr} could be nil, string or table. - -- (defaults to trigger) - effective_context.description = - util.to_line_table(context.desc or context.dscr or context.trig) - -- (keep dscr to avoid breaking downstream usages) - effective_context.dscr = effective_context.description - - -- might be nil, but whitelisted in snippetProxy. - effective_context.priority = context.priority - - -- might be nil, but whitelisted in snippetProxy. - -- shall be a string, allowed values: "snippet", "autosnippet" - -- stylua: ignore - assert( - context.snippetType == nil - or context.snippetType == "snippet" - or context.snippetType == "autosnippet", - "snippetType has to be either 'snippet' or 'autosnippet' (or unset)" - ) - -- switch to plural forms so that we can use this for indexing - -- stylua: ignore - effective_context.snippetType = - context.snippetType == "autosnippet" and "autosnippets" - or context.snippetType == "snippet" and "snippets" - or nil - - -- may be nil. - effective_context.filetype = context.filetype - - -- maybe do this in a better way when we have more parameters, but this is - -- fine for now: - - -- not a necessary argument. - if context.docstring ~= nil then - effective_context.docstring = util.to_line_table(context.docstring) - end - - -- can't use `cond and ... or ...` since we have truthy values. - effective_context.wordTrig = - util.ternary(context.wordTrig ~= nil, context.wordTrig, true) - effective_context.hidden = - util.ternary(context.hidden ~= nil, context.hidden, false) - - effective_context.regTrig = - util.ternary(context.regTrig ~= nil, context.regTrig, false) - - effective_context.docTrig = context.docTrig - local engine - if type(context.trigEngine) == "function" then - -- if trigEngine is function, just use that. - engine = context.trigEngine - else - -- otherwise, it is nil or string, if it is string, that is the name, - -- otherwise use "pattern" if regTrig is set, and finally fall back to - -- "plain" if it is not. - local engine_name = util.ternary( - context.trigEngine ~= nil, - context.trigEngine, - util.ternary(context.regTrig ~= nil, "pattern", "plain") - ) - engine = trig_engines[engine_name] - end - -- make sure to pass through nil-trigEngineOpts, they will be recognized and - -- we will get a default-version of that function instead of generating a - -- curried (?) version of it (which would waste space I think). - effective_context.trig_matcher = - engine(effective_context.trigger, context.trigEngineOpts) - - effective_context.resolveExpandParams = generate_resolve_expand_params_func( - context.condition or opts.condition, - context.resolveExpandParams - ) - effective_context.show_condition = context.show_condition - or opts.show_condition - or true_func - - -- init invalidated here. - -- This is because invalidated is a key that can be populated without any - -- information on the actual snippet (it can be used by snippetProxy!) and - -- it should be also available to the snippet-representations in the - -- snippet-list, and not in the expanded snippet, as doing this in - -- `init_snippet_opts` would suggest. - effective_context.invalidated = false - - return effective_context -end - --- Create snippet without initializing opts+context. --- this might be called from snippetProxy. -local function _S(snip, nodes, opts) - nodes = util.wrap_nodes(nodes) - -- tbl_extend creates a new table! Important with Proxy, metatable of snip - -- will be changed later. - snip = Snippet:new( - vim.tbl_extend("error", snip, { - nodes = nodes, - insert_nodes = {}, - current_insert = 0, - mark = nil, - dependents = {}, - active = false, - type = types.snippet, - -- dependents_dict is responsible for associating - -- function/dynamicNodes ("dependents") with their argnodes. - -- There are a few important requirements that have to be - -- fulfilled: - -- Allow associating present dependent with non-present argnode - -- (and vice-versa). - -- This is required, because a node outside some dynamicNode - -- could depend on a node inside it, and since the content of a - -- dynamicNode changes, it is possible that the argnode will be - -- generated. - -- As soon as that happens, it should be possible to immediately - -- find the dependents that depend on the newly-generated argnode, - -- without searching the snippet. - -- - -- The dependents_dict enables all of this by storing every node - -- which is addressable by either `absolute_indexer` or - -- `key_indexer` (or even directly, just with its own - -- table, ie. `self`) under its path. - -- * `absolute_indexer`: the path is the sequence of jump_indices - -- which leads to this node, for example {1,3,1}. - -- * `key_indexer`: the path is {"key", }. - -- * `node`: the path is {node}. - -- With each type of node-reference (absolute_indexer, key, node), - -- the node which is referenced by it, is stored under path .. - -- {"node"} (if it exists inside the current snippet!!), while the - -- dependents are stored at path .. {"dependents"}. - -- The manner in which the dependents are stored is also - -- interesting: - -- They are not stored in eg a list, since we would then have to - -- deal with explicitly invalidating them (remove them from the - -- list to prevent its growing too large). No, the dependents are - -- stored under their own absolute position (not absolute _insert_ - -- position, functionNodes don't have a jump-index, and thus can't - -- be addressed using absolute insert position), which means that - -- - -- a) once a dependent is re-generated, for example by a - -- dynamicNode, it will not take up new space, but simply overwrite - -- the old one (which is very desirable!!) - -- b) we will still store some older, unnecessary dependents - -- - -- (imo) a outweighs b, which is why this design was chosen. - -- (non-visible nodes are ignored by tracking their visibility in - -- the snippet separately, it is then queried in eg. - -- `update_dependents`) - -- - -- Related functions: - -- * `dependent:set_dependents` to insert argnode+dependent in - -- `dependents_dict`, in the according to the above description. - -- * `set_argnodes` to insert the absolute_insert_position .. - -- {"node"} into dependents_dict. - -- * `get_args` to get the text of the argnodes to some dependent - -- node. - -- * `update_dependents` can be called to find all dependents, and - -- update the visible ones. - dependents_dict = dict.new(), - - -- list of snippets expanded within the region of this snippet. - -- sorted by their buffer-position, for quick searching. - child_snippets = {}, - }), - opts - ) - - -- is propagated to all subsnippets, used to quickly find the outer snippet - snip.snippet = snip - - -- if the snippet is expanded inside another snippet (can be recognized by - -- non-nil parent_node), the node of the snippet this one is inside has to - -- update its dependents. - function snip:_update_dependents() - if self.parent_node then - self.parent_node:update_dependents() - end - end - snip.update_dependents = snip._update_dependents - - snip:init_nodes() - - if not snip.insert_nodes[0] then - -- Generate implied i(0) - local i0 = iNode.I(0) - local i0_indx = #nodes + 1 - i0.parent = snip - i0.indx = i0_indx - snip.insert_nodes[0] = i0 - snip.nodes[i0_indx] = i0 - end - - return snip -end - -local function S(context, nodes, opts) - opts = opts or {} - - local snip = init_snippet_context(node_util.wrap_context(context), opts) - snip = vim.tbl_extend("error", snip, init_snippet_opts(opts)) - - snip = _S(snip, nodes, opts) - - if __luasnip_get_loaded_file_frame_debuginfo ~= nil then - -- this snippet is being lua-loaded, and the source should be recorded. - snip._source = - source.from_debuginfo(__luasnip_get_loaded_file_frame_debuginfo()) - end - - return snip -end -extend_decorator.register( - S, - { arg_indx = 1, extend = node_util.snippet_extend_context }, - { arg_indx = 3 } -) - -function SN(pos, nodes, opts) - opts = opts or {} - - local snip = Snippet:new( - vim.tbl_extend("error", { - pos = pos, - nodes = util.wrap_nodes(nodes), - insert_nodes = {}, - current_insert = 0, - mark = nil, - dependents = {}, - active = false, - type = types.snippetNode, - }, init_snippetNode_opts(opts)), - opts - ) - snip:init_nodes() - - return snip -end -extend_decorator.register(SN, { arg_indx = 3 }) - -local function ISN(pos, nodes, indent_text, opts) - local snip = SN(pos, nodes, opts) - - local function get_indent(parent_indent) - local indentstring = "" - if vim.bo.expandtab then - -- preserve content of $PARENT_INDENT, but expand tabs before/after it - for str in vim.gsplit(indent_text, "$PARENT_INDENT", true) do - -- append expanded text and parent_indent, we'll remove the superfluous one after the loop. - indentstring = indentstring - .. util.expand_tabs( - { str }, - util.tab_width(), - #indentstring + #parent_indent - )[1] - .. parent_indent - end - indentstring = indentstring:sub(1, -#parent_indent - 1) - else - indentstring = indent_text:gsub("$PARENT_INDENT", parent_indent) - end - - return indentstring - end - - function snip:indent(parent_indent) - Snippet.indent(self, get_indent(parent_indent)) - end - - -- expand_tabs also needs to be modified: the children of the isn get the - -- indent of the isn, so we'll have to calculate it now. - -- This is done with a dummy-indentstring of the correct length. - function snip:expand_tabs(tabwidth, indentstrlen) - Snippet.expand_tabs( - self, - tabwidth, - #get_indent(string.rep(" ", indentstrlen)) - ) - end - - return snip -end -extend_decorator.register(ISN, { arg_indx = 4 }) - -function Snippet:remove_from_jumplist() - if not self.visible then - -- snippet not visible => already removed. - -- Don't remove it twice. - return - end - - -- prev is i(-1)(startNode), prev of that is the outer/previous snippet. - -- pre is $0 or insertNode. - local pre = self.prev.prev - -- similar for next, self.next is the i(0). - -- nxt is snippet. - local nxt = self.next.next - - self:exit() - - local sibling_list = self.parent_node ~= nil - and self.parent_node.parent.snippet.child_snippets - or session.snippet_roots[vim.api.nvim_get_current_buf()] - local self_indx - for i, snip in ipairs(sibling_list) do - if snip == self then - self_indx = i - end - end - table.remove(sibling_list, self_indx) - - -- previous snippet jumps to this one => redirect to jump to next one. - if pre then - if pre.inner_first == self then - if pre == nxt then - pre.inner_first = nil - else - pre.inner_first = nxt - end - elseif pre.next == self then - pre.next = nxt - end - end - if nxt then - if nxt.inner_last == self.next then - if pre == nxt then - nxt.inner_last = nil - else - nxt.inner_last = pre - end - -- careful here!! nxt.prev is its start_node, nxt.prev.prev is this - -- snippet. - elseif nxt.prev.prev == self.next then - nxt.prev.prev = pre - end - end -end - -local function insert_into_jumplist( - snippet, - start_node, - current_node, - parent_node, - sibling_snippets, - own_indx -) - local prev_snippet = sibling_snippets[own_indx - 1] - -- have not yet inserted self!! - local next_snippet = sibling_snippets[own_indx] - - -- only consider sibling-snippets with the same parent-node as - -- previous/next snippet for linking-purposes. - -- They are siblings because they are expanded in the same snippet, not - -- because they have the same parent_node. - local prev, next - if prev_snippet ~= nil and prev_snippet.parent_node == parent_node then - prev = prev_snippet - end - if next_snippet ~= nil and next_snippet.parent_node == parent_node then - next = next_snippet - end - - -- whether roots should be linked together. - local link_roots = session.config.link_roots - - -- whether children of the same snippet should be linked to their parent - -- and eachother. - local link_children = session.config.link_children - - if parent_node then - if node_util.linkable_node(parent_node) then - -- snippetNode (which has to be empty to be viable here) and - -- insertNode can both deal with inserting a snippet inside them - -- (ie. hooking it up st. it can be visited after jumping back to - -- the snippet of parent). - -- in all cases - if link_children and prev ~= nil then - -- if we have a previous snippet we can link to, just do that. - prev.next.next = snippet - start_node.prev = prev.insert_nodes[0] - else - -- only jump from parent to child if link_children is set. - if link_children then - -- prev is nil, but we can link up using the parent. - parent_node.inner_first = snippet - end - -- make sure we can jump back to the parent. - start_node.prev = parent_node - end - - -- exact same reasoning here as in prev-case above, omitting comments. - if link_children and next ~= nil then - -- jump from next snippets start_node to $0. - next.prev.prev = snippet.insert_nodes[0] - -- jump from $0 to next snippet (skip its start_node) - snippet.insert_nodes[0].next = next - else - if link_children then - parent_node.inner_last = snippet.insert_nodes[0] - end - snippet.insert_nodes[0].next = parent_node - end - else - -- naively, even if the parent is linkable, there might be snippets - -- before/after that share the same parent, so we could - -- theoretically link up with them. - -- This, however, can cause cyclic jumps, for example if the - -- previous child-snippet contains the current node: we will jump - -- from the end of the new snippet into the previous child-snippet, - -- and from its last node into the new snippet. - -- Since cycles should be avoided (very weird if the jumps just go - -- in a circle), we have no choice but to fall back to this - -- old-style linkage. - - -- Don't jump from current_node to this snippet (I feel - -- like that should be good: one can still get back to ones - -- previous history, and we don't mess up whatever jumps - -- are set up around current_node) - start_node.prev = current_node - snippet.insert_nodes[0].next = current_node - end - -- don't link different root-nodes for unlinked_roots. - elseif link_roots then - -- inserted into top-level snippet-forest, just hook up with prev, next. - -- prev and next have to be snippets or nil, in this case. - if prev ~= nil then - prev.next.next = snippet - start_node.prev = prev.insert_nodes[0] - end - if next ~= nil then - snippet.insert_nodes[0].next = next - next.prev.prev = snippet.insert_nodes[0] - end - end - - table.insert(sibling_snippets, own_indx, snippet) -end - -function Snippet:trigger_expand(current_node, pos_id, env, indent_nodes) - local pos = vim.api.nvim_buf_get_extmark_by_id(0, session.ns_id, pos_id, {}) - - -- find tree-node the snippet should be inserted at (could be before another node). - local _, sibling_snippets, own_indx, parent_node = - node_util.snippettree_find_undamaged_node(pos, { - tree_respect_rgravs = false, - tree_preference = node_util.binarysearch_preference.outside, - snippet_mode = "linkable", - }) - local n_siblings_pre = #sibling_snippets - - if current_node then - if parent_node then - if node_util.linkable_node(parent_node) then - node_util.refocus(current_node, parent_node) - parent_node:input_enter_children() - else - -- enter extmarks of parent_node, but don't enter it - -- "logically", it will not be the parent of the snippet. - parent_node:focus() - -- enter current node, it will contain the new snippet. - current_node:input_enter_children() - end - else - -- if no parent_node, completely leave. - node_util.refocus(current_node, nil) - - -- in this branch, it may happen that the snippet we leave is - -- invalid and removed from the snippet-list during `refocus`. - -- This is not catastrophic, but we have to recognize it here, and - -- update the `own_indx` among the snippet-roots (one was deleted, - -- the computed index is no longer valid since there may have been - -- a shift down over `own_indx`) - if n_siblings_pre ~= #sibling_snippets then - -- only own_indx can change, since the text in the buffer is - -- unchanged, while the number of roots is. - _, _, own_indx, _ = - node_util.snippettree_find_undamaged_node(pos, { - tree_respect_rgravs = false, - tree_preference = node_util.binarysearch_preference.outside, - snippet_mode = "linkable", - }) - end - end - - -- There may be other snippets inside of this parent_node/on this level - -- of the snippet-tree whose extmarks have to be adjusted s.t. they - -- don't contain the text that will be inserted during put_initial. - -- Node's/snippet's extmarks that are outside of this parent_node/not - -- siblings of this node will be adjusted during the refocus above, if - -- applicable. - -- - -- The following adjustments may do too much, but there's no issue - -- with that, and we're on the safe side. - - -- set rgrav false for snippets/nodes where the right boundary - -- coincides with the position we insert at now... - for i = 1, own_indx - 1 do - sibling_snippets[i]:subtree_set_pos_rgrav(pos, -1, false) - end - -- set rgrav true for snippets/nodes where the left boundary - -- coincides with the position we insert at now... - for i = own_indx, #sibling_snippets do - sibling_snippets[i]:subtree_set_pos_rgrav(pos, 1, true) - end - end - - local pre_expand_res = self:event(events.pre_expand, { expand_pos = pos }) - or {} - -- update pos, event-callback might have moved the extmark. - pos = vim.api.nvim_buf_get_extmark_by_id(0, session.ns_id, pos_id, {}) - - Environ:override(env, pre_expand_res.env_override or {}) - - if indent_nodes then - local indentstring = util.line_chars_before(pos):match("^%s*") - -- expand tabs before indenting to keep indentstring unmodified - if vim.bo.expandtab then - self:expand_tabs(util.tab_width(), #indentstring) - end - self:indent(indentstring) - end - - -- (possibly) keep user-set opts. - if self.merge_child_ext_opts then - self.effective_child_ext_opts = ext_util.child_extend( - vim.deepcopy(self.child_ext_opts), - session.config.ext_opts - ) - else - self.effective_child_ext_opts = vim.deepcopy(self.child_ext_opts) - end - - local parent_ext_base_prio - -- if inside another snippet, increase priority accordingly. - -- parent_node is only set if this snippet is expanded inside another one. - if parent_node then - parent_ext_base_prio = parent_node.parent.ext_opts.base_prio - else - parent_ext_base_prio = session.config.ext_base_prio - end - - -- own highlight comes from self.child_ext_opts.snippet. - self:resolve_node_ext_opts( - parent_ext_base_prio, - self.effective_child_ext_opts[self.type] - ) - - self.env = env - self:subsnip_init() - - self:init_positions({}) - self:init_insert_positions({}) - - self:make_args_absolute() - - self:set_dependents() - self:set_argnodes(self.dependents_dict) - - -- at this point `stored` contains the snippetNodes that will actually - -- be used, indent them once here. - for _, node in pairs(self.stored) do - node:indent(self.indentstr) - end - - local start_node = iNode.I(0) - - local old_pos = vim.deepcopy(pos) - self:put_initial(pos) - - local mark_opts = vim.tbl_extend("keep", { - right_gravity = false, - end_right_gravity = false, - }, self:get_passive_ext_opts()) - self.mark = mark(old_pos, pos, mark_opts) - - self:update() - self:update_all_dependents() - - -- Marks should stay at the beginning of the snippet, only the first mark is needed. - start_node.mark = self.nodes[1].mark - start_node.pos = -1 - -- needed for querying node-path from snippet to this node. - start_node.absolute_position = { -1 } - start_node.parent = self - - -- hook up i0 and start_node, and then the snippet itself. - -- they are outside, not inside the snippet. - -- This should clearly be the case for start_node, but also for $0 since - -- jumping to $0 should make/mark the snippet non-active (for example via - -- extmarks) - start_node.next = self - self.prev = start_node - self.insert_nodes[0].prev = self - self.next = self.insert_nodes[0] - - -- parent_node is nil if the snippet is toplevel. - self.parent_node = parent_node - - insert_into_jumplist( - self, - start_node, - current_node, - parent_node, - sibling_snippets, - own_indx - ) - - return parent_node -end - --- returns copy of snip if it matches, nil if not. -function Snippet:matches(line_to_cursor) - local match, captures = self.trig_matcher(line_to_cursor, self.trigger) - - -- Trigger or regex didn't match. - if not match then - return nil - end - - local expand_params = - self:resolveExpandParams(line_to_cursor, match, captures) - if not expand_params then - return nil - end - - local from = #line_to_cursor - #match + 1 - - -- if wordTrig is set, the char before the trigger can't be \w or the - -- word has to start at the beginning of the line. - if - self.wordTrig - and not ( - from == 1 - or string.match( - string.sub(line_to_cursor, from - 1, from - 1), - "[%w_]" - ) - == nil - ) - then - return nil - end - - return expand_params -end - --- https://gist.github.com/tylerneylon/81333721109155b2d244 -local function copy3(obj, seen) - -- Handle non-tables and previously-seen tables. - if type(obj) ~= "table" then - return obj - end - if seen and seen[obj] then - return seen[obj] - end - - -- New table; mark it as seen an copy recursively. - local s = seen or {} - local res = {} - s[obj] = res - for k, v in next, obj do - res[copy3(k, s)] = copy3(v, s) - end - return setmetatable(res, getmetatable(obj)) -end - -function Snippet:copy() - return copy3(self) -end - -function Snippet:del_marks() - for _, node in ipairs(self.nodes) do - vim.api.nvim_buf_del_extmark(0, session.ns_id, node.mark.id) - end -end - -function Snippet:is_interactive(info) - for _, node in ipairs(self.nodes) do - -- return true if any node depends on another node or is an insertNode. - if node:is_interactive(info) then - return true - end - end - return false -end - -function Snippet:dump() - for i, node in ipairs(self.nodes) do - print(i) - print(node.mark.opts.right_gravity, node.mark.opts.end_right_gravity) - local from, to = node.mark:pos_begin_end() - print(from[1], from[2]) - print(to[1], to[2]) - end -end - -function Snippet:put_initial(pos) - for _, node in ipairs(self.nodes) do - -- save pos to compare to later. - local old_pos = vim.deepcopy(pos) - node:put_initial(pos) - - -- correctly set extmark for node. - -- does not modify ext_opts[node.type]. - local mark_opts = vim.tbl_extend("keep", { - right_gravity = false, - end_right_gravity = false, - }, node:get_passive_ext_opts()) - node.mark = mark(old_pos, pos, mark_opts) - end - self.visible = true -end - --- populate env,inden,captures,trigger(regex),... but don't put any text. --- the env may be passed in opts via opts.env, if none is passed a new one is --- generated. -function Snippet:fake_expand(opts) - if not opts then - opts = {} - end - -- set eg. env.TM_SELECTED_TEXT to $TM_SELECTED_TEXT - if opts.env then - self.env = opts.env - else - self.env = Environ.fake() - end - - self.captures = {} - setmetatable(self.captures, { - __index = function(_, key) - return "$CAPTURE" .. tostring(key) - end, - }) - if self.docTrig then - -- use docTrig as entire line up to cursor, this assumes that it - -- actually matches the trigger. - local _ - _, self.captures = self.trig_matcher(self.docTrig, self.trigger) - self.trigger = self.docTrig - else - self.trigger = "$TRIGGER" - end - self.ext_opts = vim.deepcopy(session.config.ext_opts) - - self:indent("") - - -- ext_opts don't matter here, just use convenient values. - self.effective_child_ext_opts = self.child_ext_opts - self.ext_opts = self.node_ext_opts - - self:subsnip_init() - - self:init_positions({}) - self:init_insert_positions({}) - - self:make_args_absolute() - - self:set_dependents() - self:set_argnodes(self.dependents_dict) - - self:static_init() - - -- no need for update_dependents_static, update_static alone will cause updates for all child-nodes. - self:update_static() -end - --- to work correctly, this may require that the snippets' env,indent,captures? are --- set. -function Snippet:get_static_text() - if self.static_text then - return self.static_text - -- copy+fake_expand the snippet here instead of in whatever code needs to know the docstring. - elseif not self.ext_opts then - -- not a snippetNode and not yet initialized - local snipcop = self:copy() - -- sets env, captures, etc. - snipcop:fake_expand() - local static_text = snipcop:get_static_text() - self.static_text = static_text - return static_text - end - - if not self.static_visible then - return nil - end - local text = { "" } - for _, node in ipairs(self.nodes) do - local node_text = node:get_static_text() - -- append first line to last line of text so far. - text[#text] = text[#text] .. node_text[1] - for i = 2, #node_text do - text[#text + 1] = node_text[i] - end - end - -- cache computed text, may be called multiple times for - -- function/dynamicNodes. - self.static_text = text - return text -end - -function Snippet:get_docstring() - if self.docstring then - return self.docstring - -- copy+fake_expand the snippet here instead of in whatever code needs to know the docstring. - elseif not self.ext_opts then - -- not a snippetNode and not yet initialized - local snipcop = self:copy() - -- sets env, captures, etc. - snipcop:fake_expand() - local docstring = snipcop:get_docstring() - self.docstring = docstring - return docstring - end - local docstring = { "" } - for _, node in ipairs(self.nodes) do - local node_text = node:get_docstring() - -- append first line to last line of text so far. - docstring[#docstring] = docstring[#docstring] .. node_text[1] - for i = 2, #node_text do - docstring[#docstring + 1] = node_text[i] - end - end - -- cache computed text, may be called multiple times for - -- function/dynamicNodes. - -- if not outer snippet, wrap it in ${}. - self.docstring = self.type == types.snippet and docstring - or util.string_wrap(docstring, rawget(self, "pos")) - return self.docstring -end - -function Snippet:update() - for _, node in ipairs(self.nodes) do - node:update() - end -end - -function Snippet:update_static() - for _, node in ipairs(self.nodes) do - node:update_static() - end -end - -function Snippet:update_restore() - for _, node in ipairs(self.nodes) do - node:update_restore() - end -end - -function Snippet:store() - for _, node in ipairs(self.nodes) do - node:store() - end -end - -function Snippet:indent(prefix) - self.indentstr = prefix - for _, node in ipairs(self.nodes) do - node:indent(prefix) - end -end - -function Snippet:expand_tabs(tabwidth, indenstringlen) - for _, node in ipairs(self.nodes) do - node:expand_tabs(tabwidth, indenstringlen) - end -end - -function Snippet:subsnip_init() - node_util.subsnip_init_children(self, self.nodes) -end - -Snippet.init_positions = node_util.init_child_positions_func( - "absolute_position", - "nodes", - "init_positions" -) -Snippet.init_insert_positions = node_util.init_child_positions_func( - "absolute_insert_position", - "insert_nodes", - "init_insert_positions" -) - -function Snippet:make_args_absolute() - for _, node in ipairs(self.nodes) do - node:make_args_absolute(self.absolute_insert_position) - end -end - -function Snippet:input_enter(_, dry_run) - if dry_run then - dry_run.active[self] = true - return - end - - self.visited = true - self.active = true - - if self.type == types.snippet then - -- set snippet-passive -> visited/unvisited for all children. - self:set_ext_opts("passive") - end - self.mark:update_opts(self.ext_opts.active) - - self:event(events.enter) -end - -function Snippet:input_leave(_, dry_run) - if dry_run then - dry_run.active[self] = false - return - end - - self:event(events.leave) - self:update_dependents() - - -- set own ext_opts to snippet-passive, there is no passive for snippets. - self.mark:update_opts(self.ext_opts.snippet_passive) - if self.type == types.snippet then - -- also override all nodes' ext_opt. - self:set_ext_opts("snippet_passive") - end - - self.active = false -end - -function Snippet:set_ext_opts(opt_name) - for _, node in ipairs(self.nodes) do - node:set_ext_opts(opt_name) - end -end - -function Snippet:jump_into(dir, no_move, dry_run) - self:init_dry_run_active(dry_run) - - -- if dry_run, ignore self.active - if self:is_active(dry_run) then - self:input_leave(no_move, dry_run) - - if dir == 1 then - return self.next:jump_into(dir, no_move, dry_run) - else - return self.prev:jump_into(dir, no_move, dry_run) - end - else - self:input_enter(no_move, dry_run) - - if dir == 1 then - return self.inner_first:jump_into(dir, no_move, dry_run) - else - return self.inner_last:jump_into(dir, no_move, dry_run) - end - end -end - --- Snippets inherit Node:jump_from, it shouldn't occur normally, but may be --- used in LSP-Placeholders. - -function Snippet:exit() - if self.type == types.snippet then - -- if exit is called, this will not be visited again. - -- Thus, also clean up the child-snippets, which will also not be - -- visited again, since they can only be visited through self. - for _, child in ipairs(self.child_snippets) do - child:exit() - end - end - - self.visible = false - for _, node in ipairs(self.nodes) do - node:exit() - end - self.mark:clear() - self.active = false -end - -function Snippet:text_only() - for _, node in ipairs(self.nodes) do - if node.type ~= types.textNode then - return false - end - end - return true -end - -function Snippet:event(event, event_args) - -- there are 3 sources of a callback, for a snippetNode: - -- self.callbacks[-1], self.node_callbacks, and parent.callbacks[self.pos]. - local m1_cb, cb, parent_cb - -- since we handle pre-expand callbacks here, we need to handle the - -- event_res, which may be returned by more than one callback. - -- In order to keep it simple, we just return any non-nil result. - local m1_cb_res, cb_res, parent_cb_res - - m1_cb = self.callbacks[-1][event] - if m1_cb then - m1_cb_res = m1_cb(self, event_args) - end - - cb = self.node_callbacks[event] - if cb then - cb_res = cb(self, event_args) - end - - if self.type == types.snippetNode and self.pos then - -- if snippetNode, also do callback for position in parent. - parent_cb = self.parent.callbacks[self.pos][event] - if parent_cb then - parent_cb_res = parent_cb(self) - end - end - - session.event_node = self - session.event_args = event_args - vim.api.nvim_exec_autocmds("User", { - pattern = "Luasnip" .. events.to_string(self.type, event), - modeline = false, - }) - - return vim.F.if_nil(cb_res, m1_cb_res, parent_cb_res) -end - -local function nodes_from_pattern(pattern) - local nodes = {} - local text_active = true - local iNode_indx = 1 - local tokens = pattern_tokenizer.tokenize(pattern) - for _, text in ipairs(tokens) do - if text_active then - nodes[#nodes + 1] = tNode.T(text) - else - nodes[#nodes + 1] = iNode.I(iNode_indx, text) - iNode_indx = iNode_indx + 1 - end - text_active = not text_active - end - -- This is done so the user ends up at the end of the snippet either way - -- and may use their regular expand-key to expand the snippet. - -- Autoexpanding doesn't quite work, if the snippet ends with an - -- interactive part and the user overrides whatever is put in there, the - -- jump to the i(0) may trigger an expansion, and the helper-snippet could - -- not easily be removed, as the snippet the user wants to actually use is - -- inside of it. - -- Because of that it is easier to let the user do the actual expanding, - -- but help them on the way to it (by providing an easy way to override the - -- "interactive" parts of the pattern-trigger). - -- - -- if even number of nodes, the last is an insertNode (nodes begins with - -- textNode and alternates between the two). - if #nodes % 2 == 0 then - nodes[#nodes] = iNode.I(0, tokens[#tokens]) - else - nodes[#nodes + 1] = iNode.I(0) - end - return nodes -end - --- only call on actual snippets, snippetNodes don't have trigger. -function Snippet:get_pattern_expand_helper() - if not self.expand_helper_snippet then - local nodes = nodes_from_pattern(self.trigger) - self.expand_helper_snippet = S(self.trigger, nodes, { - callbacks = { - [0] = { - [events.enter] = function(_) - vim.schedule(function() - -- Remove this helper snippet as soon as the i(0) - -- is reached. - require("luasnip").unlink_current() - end) - end, - }, - }, - }) - end - -- will be copied in actual expand. - return self.expand_helper_snippet -end - -function Snippet:find_node(predicate) - for _, node in ipairs(self.nodes) do - if predicate(node) then - return node - else - local node_in_child = node:find_node(predicate) - if node_in_child then - return node_in_child - end - end - end - return nil -end - -function Snippet:insert_to_node_absolute(position) - if #position == 0 then - return self.absolute_position - end - local insert_indx = util.pop_front(position) - return self.insert_nodes[insert_indx]:insert_to_node_absolute(position) -end - -function Snippet:set_dependents() - for _, node in ipairs(self.nodes) do - node:set_dependents() - end -end - -function Snippet:set_argnodes(dict) - node_mod.Node.set_argnodes(self, dict) - for _, node in ipairs(self.nodes) do - node:set_argnodes(dict) - end -end - -function Snippet:update_all_dependents() - -- call the version that only updates this node. - self:_update_dependents() - -- only for insertnodes, others will not have dependents. - for _, node in ipairs(self.insert_nodes) do - node:update_all_dependents() - end -end -function Snippet:update_all_dependents_static() - -- call the version that only updates this node. - self:_update_dependents_static() - -- only for insertnodes, others will not have dependents. - for _, node in ipairs(self.insert_nodes) do - node:update_all_dependents_static() - end -end - -function Snippet:resolve_position(position) - -- only snippets have -1-node. - if position == -1 and self.type == types.snippet then - return self.prev - end - - return self.nodes[position] -end - -function Snippet:static_init() - node_mod.Node.static_init(self) - for _, node in ipairs(self.nodes) do - node:static_init() - end -end - --- called only for snippetNodes! -function Snippet:resolve_child_ext_opts() - if self.merge_child_ext_opts then - self.effective_child_ext_opts = ext_util.child_extend( - vim.deepcopy(self.child_ext_opts), - self.parent.effective_child_ext_opts - ) - else - self.effective_child_ext_opts = vim.deepcopy(self.child_ext_opts) - end -end - -local function no_match() - return nil -end - -function Snippet:invalidate() - self.hidden = true - -- override matching-function. - self.matches = no_match - self.invalidated = true - snippet_collection.invalidated_count = snippet_collection.invalidated_count - + 1 -end - --- used in add_snippets to get variants of snippet. -function Snippet:retrieve_all() - return { self } -end - -function Snippet:get_keyed_node(key) - -- get key-node from dependents_dict. - return self.dependents_dict:get({ "key", key, "node" }) -end - --- adjust rgrav of nodes left (direction=-1) or right (direction=1) of node at --- child_indx. --- (direction is the direction into which is searched, from child_indx outward) --- assumption: direction-endpoint of node is on child_endpoint. (caller --- responsible) -function Snippet:set_sibling_rgravs(node, child_endpoint, direction, rgrav) - node_util.nodelist_adjust_rgravs( - self.nodes, - node.absolute_position[#node.absolute_position] + direction, - child_endpoint, - direction, - rgrav, - true - ) -end - --- called only if the "-direction"-endpoint has to be changed, but the --- "direction"-endpoint not. -function Snippet:subtree_set_pos_rgrav(pos, direction, rgrav) - self.mark:set_rgrav(-direction, rgrav) - - local child_from_indx - if direction == 1 then - child_from_indx = 1 - else - child_from_indx = #self.nodes - end - - node_util.nodelist_adjust_rgravs( - self.nodes, - child_from_indx, - pos, - direction, - rgrav, - true - ) -end --- changes rgrav of all nodes and all endpoints in this snippetNode to `rgrav`. -function Snippet:subtree_set_rgrav(rgrav) - self.mark:set_rgravs(rgrav, rgrav) - for _, node in ipairs(self.nodes) do - node:subtree_set_rgrav(rgrav) - end -end - --- for this to always return a node if pos is withing the snippet-boundaries, --- the snippet must have valid extmarks. --- Looks for a node that has a specific property (either linkable, or --- interactive), which can be indicated by setting mode to either of the two --- (as string). -function Snippet:node_at(pos, mode) - if #self.nodes == 0 then - -- special case: no children (can naturally occur with dynamicNode, - -- when its function could not be evaluated, or if a user passed an empty snippetNode). - return self - end - - -- collect nodes where pos is either in gravity-adjusted boundaries, .. - local gravity_matches = {} - -- .. or just inside the regular boundaries. - -- Both are needed, so we can fall back to matches if there is no gravity_match - -- with the desired mode ("linkable" or "interactive"), fall back to - -- extmark_matches if there is also no regular match with the desired mode, - -- and finally fall back to any match (still preferring extmark-match) if - -- there is no match with the desired mode at all. - -- Unfortunately, all this is necessary, since there are many cases where - -- we may return no linkable node, despite there apparently being one in - -- reach of the cursor. - local matches = {} - -- find_node visits all nodes in-order until the predicate returns true. - self:find_node(function(node) - if not node:leaf() then - -- not a leaf-node. - return false - end - - local node_mark = node.mark - local node_from, node_to = node_mark:pos_begin_end_raw() - -- if pos certainly beyond node, quickly continue. - -- This means a little more work for the nodes in range of pos, while - -- all nodes well before it are quickly skipped => should benefit - -- all cases where the runtime of this is noticeable, and which are not - -- unrealistic (lots of zero-width nodes). - if util.pos_cmp(pos, { node_to[1], node_to[2] + 1 }) > 0 then - return false - end - - -- generate gravity-adjusted endpoints. - local grav_adjusted_from = { node_from[1], node_from[2] } - local grav_adjusted_to = { node_to[1], node_to[2] } - if node_mark:get_rgrav(-1) then - grav_adjusted_from[2] = grav_adjusted_from[2] + 1 - end - if node_mark:get_rgrav(1) then - grav_adjusted_to[2] = grav_adjusted_to[2] + 1 - end - - local cmp_pos_to = util.pos_cmp(pos, node_to) - local cmp_pos_from = util.pos_cmp(pos, node_from) - local cmp_grav_from = util.pos_cmp(pos, grav_adjusted_from) - local cmp_grav_to = util.pos_cmp(pos, grav_adjusted_to) - - if cmp_pos_from < 0 then - -- abort once the first node is definitely beyond pos. - -- (extmark-gravity can't move column to the left). - return true - end - - -- pos between from,to <=> from <= pos < to is used when choosing which - -- extmark to insert text into, so we should adopt it here. - if cmp_grav_from >= 0 and cmp_grav_to < 0 then - table.insert(gravity_matches, node) - end - -- matches does not have to respect the extmark-conventions, just catch - -- all possible nodes. - if cmp_pos_from >= 0 and cmp_pos_to <= 0 then - table.insert(matches, node) - end - end) - - -- instead of stupid nesting ifs, and because we can't use goto since - -- non-luajit-users should also be able to run luasnip :((( - return (function() - for _, node in ipairs(gravity_matches) do - if node[mode](node) then - return node - end - end - for _, node in ipairs(matches) do - if node[mode](node) then - return node - end - end - -- no interactive node found, fall back to any match. - return gravity_matches[1] or matches[1] - end)() -end - --- return the node the snippet jumps to, or nil if there isn't one. -function Snippet:next_node() - -- self.next is $0, .next is either the surrounding node, or the next - -- snippet in the list, .prev is the i(-1) if the self.next.next is the - -- next snippet. - - if self.parent_node and self.next.next == self.parent_node then - return self.next.next - else - return (self.next.next and self.next.next.prev) - end -end - -function Snippet:extmarks_valid() - -- assumption: extmarks are contiguous, and all can be queried via pos_begin_end_raw. - local ok, current_from, self_to = - pcall(self.mark.pos_begin_end_raw, self.mark) - if not ok then - return false - end - - -- below code does not work correctly if the snippet(Node) does not have any children. - if #self.nodes == 0 then - return true - end - - for _, node in ipairs(self.nodes) do - local ok_, node_from, node_to = - pcall(node.mark.pos_begin_end_raw, node.mark) - -- this snippet is invalid if: - -- - we can't get the position of some node - -- - the positions aren't contiguous or don't completely fill the parent, or - -- - any child of this node violates these rules. - if - not ok_ - or util.pos_cmp(current_from, node_from) ~= 0 - or not node:extmarks_valid() - then - return false - end - current_from = node_to - end - if util.pos_cmp(current_from, self_to) ~= 0 then - return false - end - - return true -end - -return { - Snippet = Snippet, - S = S, - _S = _S, - SN = SN, - P = P, - ISN = ISN, - wrap_nodes_in_snippetNode = wrap_nodes_in_snippetNode, - init_snippet_context = init_snippet_context, - init_snippet_opts = init_snippet_opts, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/snippetProxy.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/snippetProxy.lua deleted file mode 100644 index 03e1c878..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/snippetProxy.lua +++ /dev/null @@ -1,125 +0,0 @@ --- the idea of this class is to lazily parse snippet (eg. only on expansion). --- --- This is achieved by returning a proxy that has enough information to tell --- whether the snippet should be expanded at a given point (eg. all fields --- necessary to perform Snippet:matches()), but doesn't actually --- have to parse the snippet, leaving up-front cost of loading a bunch of --- snippets at a minimum. - -local lsp_parse_fn = require("luasnip.util.parser").parse_snippet -local snip_mod = require("luasnip.nodes.snippet") -local node_util = require("luasnip.nodes.util") -local extend_decorator = require("luasnip.util.extend_decorator") - -local SnippetProxy = {} - --- add Snippet-functions SnippetProxy can perform using the available data. -SnippetProxy.matches = snip_mod.Snippet.matches -SnippetProxy.invalidate = snip_mod.Snippet.invalidate -SnippetProxy.retrieve_all = snip_mod.Snippet.retrieve_all - -function SnippetProxy:get_docstring() - return self.docstring -end - -function SnippetProxy:instantiate(parse_fn) - -- self already contains initialized context and opts, can just be passed - -- here, no problem. - -- Bonus: if some keys are set on the snippets in the table (from the - -- outside, for whatever reason), they are also present in the expanded - -- snippet. - -- - -- _S will copy self, so we can safely mutate (set metatables). - local snippet = snip_mod._S(self, parse_fn(nil, self._snippet_string)) - -- snippet will have snippetProxies `copy`, nil it in snippet so it calls - -- snippet-copy via metatable. - snippet.copy = nil - - self._snippet = snippet - -- directly call into snippet on missing keys. - setmetatable(self, { - __index = self._snippet, - }) - - -- return snippet so it can provide a missing key. - return snippet -end - --- some values of the snippet are nil by default, list them here so snippets --- aren't instantiated because of them. -local license_to_nil = - { priority = true, snippetType = true, _source = true, filetype = true } - --- context and opts are (almost) the same objects as in s(contex, nodes, opts), snippet is a string representing the snippet. --- opts can aditionally contain the key `parse_fn`, which will be used to parse --- the snippet. This is useful, since snipmate-snippets are parsed with a --- function than regular lsp-snippets. --- context can be nil, in that case the resulting object can't be inserted into --- the snippet-tables, but may be used after expansion (i.e. returned from --- snippet:copy) -local function new(context, snippet, opts) - opts = opts or {} - - -- default to regular lsp-parse-function. - local parse_fn = lsp_parse_fn - - if opts.parse_fn then - parse_fn = opts.parse_fn - end - -- "error": there should not be duplicate keys, don't silently overwrite/keep. - local sp = vim.tbl_extend( - "error", - {}, - context - and snip_mod.init_snippet_context( - node_util.wrap_context(context), - opts - ) - or {}, - snip_mod.init_snippet_opts(opts), - node_util.init_node_opts(opts) - ) - - sp._snippet_string = snippet - -- override docstring - sp.docstring = snippet - - setmetatable(sp, { - __index = function(t, k) - if license_to_nil[k] then - -- k might be nil, return it. - return nil - end - - if SnippetProxy[k] then - -- if it is possible to perform this operation without actually parsing the snippet, just do it. - return SnippetProxy[k] - end - local snip = SnippetProxy.instantiate(t, parse_fn) - if k == "_snippet" then - return snip - else - return snip[k] - end - end, - }) - - -- snippetProxy has to be able to return snippet on copy even after parsing, - -- when the metatable has been changed. Therefore: set copy in each instance - -- of snippetProxy. - function sp:copy() - local copy = self._snippet:copy() - copy.id = self.id - - return copy - end - - return sp -end -extend_decorator.register( - new, - { arg_indx = 1, extend = node_util.snippet_extend_context }, - { arg_indx = 3 } -) - -return new diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/textNode.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/textNode.lua deleted file mode 100644 index 88fad040..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/textNode.lua +++ /dev/null @@ -1,71 +0,0 @@ -local node_mod = require("luasnip.nodes.node") -local util = require("luasnip.util.util") -local types = require("luasnip.util.types") -local events = require("luasnip.util.events") -local extend_decorator = require("luasnip.util.extend_decorator") - -local TextNode = node_mod.Node:new() - -local function T(static_text, opts) - return TextNode:new({ - static_text = util.to_string_table(static_text), - mark = nil, - type = types.textNode, - }, opts) -end -extend_decorator.register(T, { arg_indx = 2 }) - -function TextNode:input_enter(no_move, dry_run) - if dry_run then - return - end - - self.mark:update_opts(self.ext_opts.active) - self.visited = true - - if not no_move then - local mark_begin_pos = self.mark:pos_begin_raw() - if vim.fn.mode() == "i" then - util.insert_move_on(mark_begin_pos) - else - vim.api.nvim_feedkeys( - vim.api.nvim_replace_termcodes("", true, false, true), - "n", - true - ) - util.normal_move_on_insert(mark_begin_pos) - end - end - - self:event(events.enter, no_move) -end - -function TextNode:update_all_dependents() end - -function TextNode:is_interactive() - -- a resounding false. - return false -end - -function TextNode:extmarks_valid() - local from, to = self.mark:pos_begin_end_raw() - if - util.pos_cmp(from, to) == 0 - and not ( - #self.static_text == 0 - or (#self.static_text == 1 and #self.static_text[1] == 0) - ) - then - -- assume the snippet is invalid if a textNode occupies zero space, - -- but has text which would occupy some. - -- This should allow some modifications, but as soon as a textNode is - -- deleted entirely, we sound the alarm :D - return false - end - return true -end - -return { - T = T, - textNode = TextNode, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/util.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/util.lua deleted file mode 100644 index 53d517b7..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/util.lua +++ /dev/null @@ -1,789 +0,0 @@ -local util = require("luasnip.util.util") -local ext_util = require("luasnip.util.ext_opts") -local types = require("luasnip.util.types") -local key_indexer = require("luasnip.nodes.key_indexer") -local session = require("luasnip.session") - -local function subsnip_init_children(parent, children) - for _, child in ipairs(children) do - if child.type == types.snippetNode then - child.snippet = parent.snippet - child:resolve_child_ext_opts() - end - child:resolve_node_ext_opts() - child:subsnip_init() - end -end - -local function init_child_positions_func( - key, - node_children_key, - child_func_name -) - -- maybe via load()? - return function(node, position_so_far) - node[key] = vim.deepcopy(position_so_far) - local pos_depth = #position_so_far + 1 - - for indx, child in ipairs(node[node_children_key]) do - position_so_far[pos_depth] = indx - child[child_func_name](child, position_so_far) - end - -- undo changes to position_so_far. - position_so_far[pos_depth] = nil - end -end - -local function make_args_absolute(args, parent_insert_position, target) - for i, arg in ipairs(args) do - if type(arg) == "number" then - -- the arg is a number, should be interpreted relative to direct - -- parent. - local t = vim.deepcopy(parent_insert_position) - table.insert(t, arg) - target[i] = { absolute_insert_position = t } - else - -- insert node, absolute_indexer, or key itself, node's - -- absolute_insert_position may be nil, check for that during - -- usage. - target[i] = arg - end - end -end - -local function wrap_args(args) - -- stylua: ignore - if type(args) ~= "table" or - (type(args) == "table" and args.absolute_insert_position) or - key_indexer.is_key(args) then - -- args is one single arg, wrap it. - return { args } - else - return args - end -end - --- includes child, does not include parent. -local function get_nodes_between(parent, child) - local nodes = {} - - -- special case for nodes without absolute_position (which is only - -- start_node). - if child.pos == -1 then - -- no nodes between, only child. - nodes[1] = child - return nodes - end - - local child_pos = child.absolute_position - - local indx = #parent.absolute_position + 1 - local prev = parent - while child_pos[indx] do - local next = prev:resolve_position(child_pos[indx]) - nodes[#nodes + 1] = next - prev = next - indx = indx + 1 - end - - return nodes -end - --- assumes that children of child are not even active. --- If they should also be left, do that separately. --- Does not leave the parent. -local function leave_nodes_between(parent, child, no_move) - local nodes = get_nodes_between(parent, child) - if #nodes == 0 then - return - end - - -- reverse order, leave child first. - for i = #nodes, 2, -1 do - -- this only happens for nodes where the parent will also be left - -- entirely (because we stop at nodes[2], and handle nodes[1] - -- separately) - nodes[i]:input_leave(no_move) - nodes[i - 1]:input_leave_children() - end - nodes[1]:input_leave(no_move) -end - -local function enter_nodes_between(parent, child, no_move) - local nodes = get_nodes_between(parent, child) - if #nodes == 0 then - return - end - - for i = 1, #nodes - 1 do - -- only enter children for nodes before the last (lowest) one. - nodes[i]:input_enter(no_move) - nodes[i]:input_enter_children() - end - nodes[#nodes]:input_enter(no_move) -end - -local function select_node(node) - local node_begin, node_end = node.mark:pos_begin_end_raw() - util.any_select(node_begin, node_end) -end - -local function print_dict(dict) - print(vim.inspect(dict, { - process = function(item, path) - if path[#path] == "node" or path[#path] == "dependent" then - return "node@" .. vim.inspect(item.absolute_position) - elseif path[#path] ~= vim.inspect.METATABLE then - return item - end - end, - })) -end - -local function init_node_opts(opts) - local in_node = {} - if not opts then - opts = {} - end - - -- copy once here, the opts might be reused. - in_node.node_ext_opts = - ext_util.complete(vim.deepcopy(opts.node_ext_opts or {})) - - if opts.merge_node_ext_opts == nil then - in_node.merge_node_ext_opts = true - else - in_node.merge_node_ext_opts = opts.merge_node_ext_opts - end - - in_node.key = opts.key - - in_node.node_callbacks = opts.node_callbacks or {} - - return in_node -end - -local function snippet_extend_context(arg, extend) - if type(arg) == "string" then - arg = { trig = arg } - end - - -- both are table or nil now. - return vim.tbl_extend("keep", arg or {}, extend or {}) -end - -local function wrap_context(context) - if type(context) == "string" then - return { trig = context } - else - return context - end -end - -local function linkable_node(node) - -- node.type has to be one of insertNode, exitNode. - return vim.tbl_contains( - { types.insertNode, types.exitNode }, - rawget(node, "type") - ) -end - --- mainly used internally, by binarysearch_pos. --- these are the nodes that are definitely not linkable, there are nodes like --- dynamicNode or snippetNode that might be linkable, depending on their --- content. Could look into that to make this more complete, but that does not --- feel appropriate (higher runtime), most cases should be served well by this --- heuristic. -local function non_linkable_node(node) - return vim.tbl_contains( - { types.textNode, types.functionNode }, - rawget(node, "type") - ) -end --- return whether a node is certainly (not) interactive. --- Coincindentially, the same nodes as (non-)linkable ones, but since there is a --- semantic difference, use separate names. -local interactive_node = linkable_node -local non_interactive_node = non_linkable_node - -local function prefer_nodes(prefer_func, reject_func) - return function(cmp_mid_to, cmp_mid_from, mid_node) - local reject_mid = reject_func(mid_node) - local prefer_mid = prefer_func(mid_node) - - -- if we can choose which node to continue in, prefer the one that - -- may be linkable/interactive. - if cmp_mid_to == 0 and reject_mid then - return true, false - elseif cmp_mid_from == 0 and reject_mid then - return false, true - elseif (cmp_mid_to == 0 or cmp_mid_from == 0) and prefer_mid then - return false, false - else - return cmp_mid_to >= 0, cmp_mid_from < 0 - end - end -end - --- functions for resolving conflicts, if `pos` is on the boundary of two nodes. --- Return whether to continue behind or before mid (in that order). --- At most one of those may be true, of course. -local binarysearch_preference = { - outside = function(cmp_mid_to, cmp_mid_from, _) - return cmp_mid_to >= 0, cmp_mid_from <= 0 - end, - inside = function(cmp_mid_to, cmp_mid_from, _) - return cmp_mid_to > 0, cmp_mid_from < 0 - end, - linkable = prefer_nodes(linkable_node, non_linkable_node), - interactive = prefer_nodes(interactive_node, non_interactive_node), -} --- `nodes` is a list of nodes ordered by their occurrence in the buffer. --- `pos` is a row-column-tuble, byte-columns, and we return the node the LEFT --- EDGE(/side) of `pos` is inside. --- This convention is chosen since a snippet inserted at `pos` will move the --- character at `pos` to the right. --- The exact meaning of "inside" can be influenced with `respect_rgravs` and --- `boundary_resolve_mode`: --- * if `respect_rgravs` is true, "inside" emulates the shifting-behaviour of --- extmarks: --- First of all, we compare the left edge of `pos` with the left/right edges --- of from/to, depending on rgrav. --- If the left edge is <= left/right edge of from, and < left/right edge of --- to, `pos` is inside the node. --- --- * if `respect_rgravs` is false, pos has to be fully inside a node to be --- considered inside it. If pos is on the left endpoint, it is considered to be --- left of the node, and likewise for the right endpoint. --- --- * `boundary_resolve_mode` changes how a position on the boundary of a node --- is treated: --- * for `"prefer_linkable/interactive"`, we assume that the nodes in `nodes` are --- contiguous, and prefer falling into the previous/next node if `pos` is on --- mid's boundary, and mid is not linkable/interactie. --- This way, we are more likely to return a node that can handle a new --- snippet/is interactive. --- * `"prefer_outside"` makes sense when the nodes are not contiguous, and we'd --- like to find a position between two nodes. --- This mode makes sense for finding the snippet a new snippet should be --- inserted in, since we'd like to prefer inserting before/after a snippet, if --- the position is ambiguous. --- --- In general: --- These options are useful for making this function more general: When --- searching in the contiguous nodes of a snippet, we'd like this routine to --- return any of them (obviously the one pos is inside/or on the border of, and --- we'd like to prefer returning a node that can be linked), but in no case --- fail. --- However! when searching the top-level snippets with the intention of finding --- the snippet/node a new snippet should be expanded inside, it seems better to --- shift an existing snippet to the right/left than expand the new snippet --- inside it (when the expand-point is on the boundary). -local function binarysearch_pos( - nodes, - pos, - respect_rgravs, - boundary_resolve_mode -) - local left = 1 - local right = #nodes - - -- actual search-routine from - -- https://github.com/Roblox/Wiki-Lua-Libraries/blob/master/StandardLibraries/BinarySearch.lua - if #nodes == 0 then - return nil, 1 - end - while true do - local mid = left + math.floor((right - left) / 2) - local mid_mark = nodes[mid].mark - local ok, mid_from, mid_to = pcall(mid_mark.pos_begin_end_raw, mid_mark) - - if not ok then - -- error while running this procedure! - -- return false (because I don't know how to do this with `error` - -- and the offending node). - -- (returning data instead of a message in `error` seems weird..) - return false, mid - end - - if respect_rgravs then - -- if rgrav is set on either endpoint, the node considers its - -- endpoint to be the right, not the left edge. - -- We only want to work with left edges but since the right edge is - -- the left edge of the next column, this is not an issue :) - -- TODO: does this fail with multibyte characters??? - if mid_mark:get_rgrav(-1) then - mid_from[2] = mid_from[2] + 1 - end - if mid_mark:get_rgrav(1) then - mid_to[2] = mid_to[2] + 1 - end - end - - local cmp_mid_to = util.pos_cmp(pos, mid_to) - local cmp_mid_from = util.pos_cmp(pos, mid_from) - - local cont_behind_mid, cont_before_mid = - boundary_resolve_mode(cmp_mid_to, cmp_mid_from, nodes[mid]) - - if cont_behind_mid then - -- make sure right-left becomes smaller. - left = mid + 1 - if left > right then - return nil, mid + 1 - end - elseif cont_before_mid then - -- continue search on left side - right = mid - 1 - if left > right then - return nil, mid - end - else - -- greater-equal than mid_from, smaller or equal to mid_to => left edge - -- of pos is inside nodes[mid] :) - return nodes[mid], mid - end - end -end - --- a and b have to be in the same snippet, return their first (as seen from --- them) common parent. -local function first_common_node(a, b) - local a_pos = a.absolute_position - local b_pos = b.absolute_position - - -- last as seen from root. - local i = 0 - local last_common = a.parent.snippet - -- invariant: last_common is parent of both a and b. - while (a_pos[i + 1] ~= nil) and a_pos[i + 1] == b_pos[i + 1] do - last_common = last_common:resolve_position(a_pos[i + 1]) - i = i + 1 - end - - return last_common -end - --- roots at depth 0, children of root at depth 1, their children at 2, ... -local function snippettree_depth(snippet) - local depth = 0 - while snippet.parent_node ~= nil do - snippet = snippet.parent_node.parent.snippet - depth = depth + 1 - end - return depth -end - --- find the first common snippet a and b have on their respective unique paths --- to the snippet-roots. --- if no common ancestor exists (ie. a and b are roots of their buffers' --- forest, or just in different trees), return nil. --- in both cases, the paths themselves are returned as well. --- The common ancestor is included in the paths, except if there is none. --- Instead of storing the snippets in the paths, they are represented by the --- node which contains the next-lower snippet in the path (or `from`/`to`, if it's --- the first node of the path) --- This is a bit complicated, but this representation contains more information --- (or, more easily accessible information) than storing snippets: the --- immediate parent of the child along the path cannot be easily retrieved if --- the snippet is stored, but the snippet can be easily retrieved if the child --- is stored (.parent.snippet). --- And, so far this is pretty specific to refocus, and thus modeled so there is --- very little additional work in that method. --- At most one of a,b may be nil. -local function first_common_snippet_ancestor_path(a, b) - local a_path = {} - local b_path = {} - - -- general idea: we find the depth of a and b, walk upward with the deeper - -- one until we find its first ancestor with the same depth as the less - -- deep snippet, and then follow both paths until they arrive at the same - -- snippet (or at the root of their respective trees). - -- if either is nil, we treat it like it's one of the roots (the code will - -- behave correctly this way, and return an empty path for the nil-node, - -- and the correct path for the non-nil one). - local a_depth = a ~= nil and snippettree_depth(a) or 0 - local b_depth = b ~= nil and snippettree_depth(b) or 0 - - -- bit subtle: both could be 0, but one could be nil. - -- deeper should not be nil! (this allows us to do the whole walk for the - -- non-nil node in the first for-loop, as opposed to needing some special - -- handling). - local deeper, deeper_path, other, other_path - if b == nil or (a ~= nil and a_depth > b_depth) then - deeper = a - other = b - deeper_path = a_path - other_path = b_path - else - -- we land here if `b ~= nil and (a == nil or a_depth >= b_depth)`, so - -- exactly what we want. - deeper = b - other = a - deeper_path = b_path - other_path = a_path - end - - for _ = 1, math.abs(a_depth - b_depth) do - table.insert(deeper_path, deeper.parent_node) - deeper = deeper.parent_node.parent.snippet - end - -- here: deeper and other are at the same depth. - -- If we walk upwards one step at a time, they will meet at the same - -- parent, or hit their respective roots. - - -- deeper can't be nil, if other is, we are done here and can return the - -- paths (and there is no shared node) - if other == nil then - return nil, a_path, b_path - end - -- beyond here, deeper and other are not nil. - - while deeper ~= other do - if deeper.parent_node == nil then - -- deeper is at depth 0 => other as well => both are roots. - return nil, a_path, b_path - end - - table.insert(deeper_path, deeper.parent_node) - table.insert(other_path, other.parent_node) - - -- walk one step towards root. - deeper = deeper.parent_node.parent.snippet - other = other.parent_node.parent.snippet - end - - -- either one will do here. - return deeper, a_path, b_path -end - --- removes focus from `from` and upwards up to the first common ancestor --- (node!) of `from` and `to`, and then focuses nodes between that ancestor and --- `to`. --- Requires that `from` is currently entered/focused, and that no snippet --- between `to` and its root is invalid. -local function refocus(from, to) - if from == nil and to == nil then - -- absolutely nothing to do, should not happen. - return - end - -- pass nil if from/to is nil. - -- if either is nil, first_common_node is nil, and the corresponding list empty. - local first_common_snippet, from_snip_path, to_snip_path = - first_common_snippet_ancestor_path( - from and from.parent.snippet, - to and to.parent.snippet - ) - - -- we want leave/enter_path to be s.t. leaving/entering all nodes between - -- each entry and its snippet (and the snippet itself) will leave/enter all - -- nodes between the first common snippet (or the root-snippet) and - -- from/to. - -- Then, the nodes between the first common node and the respective - -- entrypoints (also nodes) into the first common snippet will have to be - -- left/entered, which is handled by final_leave_/first_enter_/common_node. - - -- from, to are not yet in the paths. - table.insert(from_snip_path, 1, from) - table.insert(to_snip_path, 1, to) - - -- determine how far to leave: if there is a common snippet, only up to the - -- first common node of from and to, otherwise leave the one snippet, and - -- enter the other completely. - local final_leave_node, first_enter_node, common_node - if first_common_snippet then - -- there is a common snippet => there is a common node => we have to - -- set final_leave_node, first_enter_node, and common_node. - final_leave_node = from_snip_path[#from_snip_path] - first_enter_node = to_snip_path[#to_snip_path] - common_node = first_common_node(first_enter_node, final_leave_node) - - -- Also remove these last nodes from the lists, their snippet is not - -- supposed to be left entirely. - from_snip_path[#from_snip_path] = nil - to_snip_path[#to_snip_path] = nil - end - - -- now do leave/enter, set no_move on all operations. - -- if one of from/to was nil, there are no leave/enter-operations done for - -- it (from/to_snip_path is {}, final_leave/first_enter_* is nil). - - -- leave_children on all from-nodes except the original from. - if #from_snip_path > 0 then - local ok1, ok2 - if from.type == types.exitNode then - ok1 = pcall(from.input_leave, from, true) - ok2 = true - else - -- we know that the first node is from. - ok1 = pcall(leave_nodes_between, from.parent.snippet, from, true) - -- leave_nodes_between does not affect snippet, so that has to be left - -- here. - -- snippet does not have input_leave_children, so only input_leave - -- needs to be called. - ok2 = pcall( - from.parent.snippet.input_leave, - from.parent.snippet, - true - ) - end - if not ok1 or not ok2 then - from.parent.snippet:remove_from_jumplist() - end - end - for i = 2, #from_snip_path do - local node = from_snip_path[i] - local ok1, ok2, ok3 - ok1 = pcall(node.input_leave_children, node) - - if node.type == types.exitNode then - ok2 = pcall(node.input_leave, node, true) - ok3 = true - else - ok2 = pcall(leave_nodes_between, node.parent.snippet, node, true) - ok3 = pcall( - node.parent.snippet.input_leave, - node.parent.snippet, - true - ) - end - - if not ok1 or not ok2 or not ok3 then - from.parent.snippet:remove_from_jumplist() - end - end - - -- this leave, and the following enters should be safe: the path to `to` - -- was verified via extmarks_valid (precondition). - if common_node and final_leave_node then - -- if the final_leave_node is from, its children are not active (which - -- stems from the requirement that from is the currently active node), - -- and so don't have to be left. - if final_leave_node ~= from then - final_leave_node:input_leave_children() - end - leave_nodes_between(common_node, final_leave_node, true) - end - - if common_node and first_enter_node then - -- In general we assume that common_node is active when we are here. - -- This may not be the case if we are currently inside the i(0) or - -- i(-1), since the snippet might be the common node and in this case, - -- it is inactive. - -- This means that, if we want to enter a non-exitNode, we have to - -- explicitly activate the snippet for all jumps to behave correctly. - -- (if we enter a i(0)/i(-1), this is not necessary, of course). - if - final_leave_node.type == types.exitNode - and first_enter_node.type ~= types.exitNode - then - common_node:input_enter(true) - end - -- symmetrically, entering an i(0)/i(-1) requires leaving the snippet. - if - final_leave_node.type ~= types.exitNode - and first_enter_node.type == types.exitNode - then - common_node:input_leave(true) - end - - enter_nodes_between(common_node, first_enter_node, true) - - -- if the `first_enter_node` is already `to` (occurs if `to` is in the - -- common snippet of to and from), we should not enter its children. - -- (we only want to `input_enter` to.) - if first_enter_node ~= to then - first_enter_node:input_enter_children() - end - end - - -- same here, input_enter_children has to be called manually for the - -- to-nodes of the path we are entering (since enter_nodes_between does not - -- call it for the child-node). - - for i = #to_snip_path, 2, -1 do - local node = to_snip_path[i] - if node.type ~= types.exitNode then - node.parent.snippet:input_enter(true) - enter_nodes_between(node.parent.snippet, node, true) - else - node:input_enter(true) - end - node:input_enter_children() - end - if #to_snip_path > 0 then - if to.type ~= types.exitNode then - to.parent.snippet:input_enter(true) - else - to.parent.snippet:input_leave(true) - end - enter_nodes_between(to.parent.snippet, to, true) - end - - -- it may be that we only leave nodes in this process (happens if to is a - -- parent of from). - -- If that is the case, we will not explicitly focus on to, and it may be - -- that focus is even lost if it was focused previously (leave may trigger - -- update, update may change focus) - -- To prevent this, just call focus here, which is pretty close to a noop - -- if to is already focused. - if to then - to:focus() - end -end - -local function generic_extmarks_valid(node, child) - -- valid if - -- - extmark-extents match. - -- - current choice is valid - local ok1, self_from, self_to = - pcall(node.mark.pos_begin_end_raw, node.mark) - local ok2, child_from, child_to = - pcall(child.mark.pos_begin_end_raw, child.mark) - - if - not ok1 - or not ok2 - or util.pos_cmp(self_from, child_from) ~= 0 - or util.pos_cmp(self_to, child_to) ~= 0 - then - return false - end - return child:extmarks_valid() -end - --- returns: * the smallest known snippet `pos` is inside. --- * the list of other snippets inside the snippet of this smallest --- node --- * the index this snippet would be at if inserted into that list --- * the node of this snippet pos is on. -local function snippettree_find_undamaged_node(pos, opts) - local prev_parent, child_indx, found_parent - local prev_parent_children = - session.snippet_roots[vim.api.nvim_get_current_buf()] - - while true do - -- false: don't respect rgravs. - -- Prefer inserting the snippet outside an existing one. - found_parent, child_indx = binarysearch_pos( - prev_parent_children, - pos, - opts.tree_respect_rgravs, - opts.tree_preference - ) - if found_parent == false then - -- if the procedure returns false, there was an error getting the - -- position of a node (in this case, that node is a snippet). - -- The position of the offending snippet is returned in child_indx, - -- and we can remove it here. - prev_parent_children[child_indx]:remove_from_jumplist() - elseif found_parent ~= nil and not found_parent:extmarks_valid() then - -- found snippet damaged (the idea to sidestep the damaged snippet, - -- even if no error occurred _right now_, is to ensure that we can - -- input_enter all the nodes along the insertion-path correctly). - found_parent:remove_from_jumplist() - -- continue again with same parent, but one less snippet in its - -- children => shouldn't cause endless loop. - elseif found_parent == nil then - break - else - prev_parent = found_parent - -- can index prev_parent, since found_parent is not nil, and - -- assigned to prev_parent. - prev_parent_children = prev_parent.child_snippets - end - end - - local node - if prev_parent then - -- if found, find node to insert at, prefer receiving a linkable node. - node = prev_parent:node_at(pos, opts.snippet_mode) - end - - return prev_parent, prev_parent_children, child_indx, node -end - -local function root_path(node) - local path = {} - - while node do - local node_snippet = node.parent.snippet - local snippet_node_path = get_nodes_between(node_snippet, node) - -- get_nodes_between gives parent -> node, but we need - -- node -> parent => insert back to front. - for i = #snippet_node_path, 1, -1 do - table.insert(path, snippet_node_path[i]) - end - -- parent not in get_nodes_between. - table.insert(path, node_snippet) - - node = node_snippet.parent_node - end - - return path -end - --- adjust rgravs of siblings of the node with indx child_from_indx in nodes. -local function nodelist_adjust_rgravs( - nodes, - child_from_indx, - child_endpoint, - direction, - rgrav, - nodes_adjacent -) - -- only handle siblings, not the node with child_from_indx itself. - local i = child_from_indx - local node = nodes[i] - while node do - local direction_node_endpoint = node.mark:get_endpoint(direction) - if util.pos_equal(direction_node_endpoint, child_endpoint) then - -- both endpoints of node are on top of child_endpoint (we wouldn't - -- be in the loop with `node` if the -direction-endpoint didn't - -- match), so update rgravs of the entire subtree to match rgrav - node:subtree_set_rgrav(rgrav) - else - -- either assume that they are adjacent, or check. - if - nodes_adjacent - or util.pos_equal( - node.mark:get_endpoint(-direction), - child_endpoint - ) - then - -- only the -direction-endpoint matches child_endpoint, adjust its - -- position and break the loop (don't need to look at any other - -- siblings). - node:subtree_set_pos_rgrav(child_endpoint, direction, rgrav) - end - break - end - - i = i + direction - node = nodes[i] - end -end - -return { - subsnip_init_children = subsnip_init_children, - init_child_positions_func = init_child_positions_func, - make_args_absolute = make_args_absolute, - wrap_args = wrap_args, - wrap_context = wrap_context, - get_nodes_between = get_nodes_between, - leave_nodes_between = leave_nodes_between, - enter_nodes_between = enter_nodes_between, - select_node = select_node, - print_dict = print_dict, - init_node_opts = init_node_opts, - snippet_extend_context = snippet_extend_context, - linkable_node = linkable_node, - binarysearch_pos = binarysearch_pos, - binarysearch_preference = binarysearch_preference, - refocus = refocus, - generic_extmarks_valid = generic_extmarks_valid, - snippettree_find_undamaged_node = snippettree_find_undamaged_node, - interactive_node = interactive_node, - root_path = root_path, - nodelist_adjust_rgravs = nodelist_adjust_rgravs, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/util/trig_engines.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/util/trig_engines.lua deleted file mode 100644 index 30da7245..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/nodes/util/trig_engines.lua +++ /dev/null @@ -1,132 +0,0 @@ -local jsregexp_compile_safe = require("luasnip.util.jsregexp") - --- generate nil-opts-instances here, and save them. --- This is to prevent generating 100s of the exact same function. -local default_match_pattern, default_match_plain, default_match_vim - -local function apply_common_opts(line_to_cursor, opts) - if opts and opts.max_len then - return line_to_cursor:sub(#line_to_cursor - opts.max_len + 1) - else - return line_to_cursor - end -end - --- these functions get the line up to the cursor, the trigger, and then --- determine whether the trigger matches the current line. --- If the trigger does not match, the functions shall return nil, otherwise --- the matching substring and the list of captures (empty table if there aren't --- any). - -local function match_plain(_, opts) - if opts == nil then - return default_match_plain - end - - return function(line_to_cursor, trigger) - line_to_cursor = apply_common_opts(line_to_cursor, opts) - if - line_to_cursor:sub(#line_to_cursor - #trigger + 1, #line_to_cursor) - == trigger - then - -- no captures for plain trigger. - return trigger, {} - else - return nil - end - end -end -default_match_plain = match_plain(nil, {}) - -local function match_pattern(_, opts) - if opts == nil then - return default_match_pattern - end - - return function(line_to_cursor, trigger) - line_to_cursor = apply_common_opts(line_to_cursor, opts) - - -- look for match which ends at the cursor. - -- put all results into a list, there might be many capture-groups. - local find_res = { line_to_cursor:find(trigger .. "$") } - - if #find_res > 0 then - -- if there is a match, determine matching string, and the - -- capture-groups. - local captures = {} - -- find_res[1] is `from`, find_res[2] is `to` (which we already know - -- anyway). - local from = find_res[1] - local match = line_to_cursor:sub(from, #line_to_cursor) - -- collect capture-groups. - for i = 3, #find_res do - captures[i - 2] = find_res[i] - end - return match, captures - else - return nil - end - end -end -default_match_pattern = match_pattern(nil, {}) - -local ecma_engine -if jsregexp_compile_safe then - ecma_engine = function(trig, opts) - local trig_compiled, err_maybe = jsregexp_compile_safe(trig .. "$", "") - if not trig_compiled then - error(("Error while compiling regex: %s"):format(err_maybe)) - end - - return function(line_to_cursor, _) - line_to_cursor = apply_common_opts(line_to_cursor, opts) - - -- get first (very likely only, since we appended the "$") match. - local match = trig_compiled(line_to_cursor)[1] - if match then - -- return full match, and all groups. - return line_to_cursor:sub(match.begin_ind), match.groups - else - return nil - end - end - end -else - ecma_engine = function(x, opts) - return match_plain(x, opts) - end -end - -local function match_vim(_, opts) - if opts == nil then - return default_match_vim - end - - return function(line_to_cursor, trigger) - line_to_cursor = apply_common_opts(line_to_cursor, opts) - - local matchlist = vim.fn.matchlist(line_to_cursor, trigger .. "$") - if #matchlist > 0 then - local groups = {} - for i = 2, 10 do - -- PROBLEM: vim does not differentiate between an empty ("") - -- and a missing capture. - -- Since we need to differentiate between the two (Check `:h - -- luasnip-variables-lsp-variables`), we assume, here, that an - -- empty string is an unmatched group. - groups[i - 1] = matchlist[i] ~= "" and matchlist[i] or nil - end - return matchlist[1], groups - else - return nil - end - end -end -default_match_vim = match_vim(nil, {}) - -return { - plain = match_plain, - pattern = match_pattern, - ecma = ecma_engine, - vim = match_vim, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/session/enqueueable_operations.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/session/enqueueable_operations.lua deleted file mode 100644 index 7d56691c..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/session/enqueueable_operations.lua +++ /dev/null @@ -1,35 +0,0 @@ -local snippet_collection = require("luasnip.session.snippet_collection") - -local M = {} - -local refresh_enqueued = false -local next_refresh_fts = {} - -function M.refresh_notify(ft) - next_refresh_fts[ft] = true - - if not refresh_enqueued then - vim.schedule(function() - for enq_ft, _ in pairs(next_refresh_fts) do - snippet_collection.refresh_notify(enq_ft) - end - - next_refresh_fts = {} - refresh_enqueued = false - end) - - refresh_enqueued = true - end -end - -local clean_enqueued = false -function M.clean_invalidated() - if not clean_enqueued then - vim.schedule(function() - snippet_collection.clean_invalidated({ inv_limit = 100 }) - end) - end - clean_enqueued = true -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/session/init.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/session/init.lua deleted file mode 100644 index ad1d6dfa..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/session/init.lua +++ /dev/null @@ -1,52 +0,0 @@ --- used to store values like current nodes or the active node for autocommands. -local M = {} - -M.ft_redirect = {} -setmetatable(M.ft_redirect, { - __index = function(table, key) - -- no entry for this ft(key), set it to avoid calls on each expand for - -- this filetype. - local val = { key } - rawset(table, key, val) - return val - end, -}) - -M.current_nodes = {} --- roots of snippet-trees, per-buffer. --- snippet_roots[n] => list of snippet-roots in buffer n. -M.snippet_roots = setmetatable({}, { - -- create missing lists automatically. - __index = function(t, k) - local new_t = {} - rawset(t, k, new_t) - return new_t - end, -}) -M.ns_id = vim.api.nvim_create_namespace("Luasnip") -M.active_choice_nodes = {} - --- only here for overview. -M.latest_load_ft = nil - -M.last_expand_snip = nil -M.last_expand_opts = nil - --- jump_active is set while luasnip moves the cursor, prevents --- (for example) updating dependents or deleting a snippet via --- exit_out_of_region while jumping. --- init with false, it will be set by (eg.) ls.jump(). -M.jump_active = false - --- initial value, might be overwritten immediately. --- No danger of overwriting user-config, since this has to be loaded to allow --- overwriting. -M.config = require("luasnip.default_config") - -M.loaded_fts = {} - -function M.get_snip_env() - return M.config.snip_env -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/session/snippet_collection/init.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/session/snippet_collection/init.lua deleted file mode 100644 index 33f05c04..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/session/snippet_collection/init.lua +++ /dev/null @@ -1,328 +0,0 @@ -local source = require("luasnip.session.snippet_collection.source") -local u_table = require("luasnip.util.table") -local auto_creating_tables = - require("luasnip.util.auto_table").warn_depth_autotable -local session = require("luasnip.session") - --- store snippets by some key. --- also ordered by filetype, eg. --- { --- key = { --- ft1 = {...}, --- ft2 = {...} --- } --- } -local M = { - invalidated_count = 0, -} - -local by_key = {} - --- stores snippets/autosnippets by priority. -local by_prio = { - snippets = { - -- stores sorted keys, eg 1=1000, 2=1010, 3=1020,..., used for - -- quick iterating. - order = {}, - }, - autosnippets = { - order = {}, - }, -} - --- this isn't in util/util.lua due to circular dependencies. Would be cleaner --- to include it there, but it's alright to keep here for now. --- --- this is linear, binary search would certainly be nicer, but for our --- applications this should easily be enough. -local function insert_sorted_unique(t, k) - local tbl_len = #t - - local i = 1 - -- k does not yet exist in table, find first i so t[i] > k. - for _ = 1, tbl_len do - if t[i] > k then - break - end - i = i + 1 - end - - -- shift all t[j] with j > i back by one. - for j = tbl_len, i, -1 do - t[j + 1] = t[j] - end - - t[i] = k -end - -local by_prio_snippets_mt = { - __index = function(s, k) - -- make new tables as they are indexed - return auto_creating_tables(s, k, 3) - end, - __newindex = function(t, k, v) - -- update priority-order as well. - insert_sorted_unique(t.order, k) - rawset(t, k, v) - end, -} --- metatable for the by_prio table used when by_prio.type[prio] is reset --- create here so that it can be shared and only has to be created once -local prio_mt2 = { - __index = function(s, k) - -- make new tables as they are indexed - return auto_creating_tables(s, k, 2) - end, -} - -setmetatable(by_prio.snippets, by_prio_snippets_mt) -setmetatable(by_prio.autosnippets, by_prio_snippets_mt) - --- iterate priorities, high to low. -local function prio_iter(type) - local order = by_prio[type].order - local i = #order + 1 - - return function() - i = i - 1 - if i > 0 then - return by_prio[type][order[i]] - end - return nil - end -end - -local by_ft = { - snippets = {}, - autosnippets = {}, -} - -local by_ft_snippets_mt = { - __index = function(s, k) - return auto_creating_tables(s, k, 2) - end, -} -setmetatable(by_ft.snippets, by_ft_snippets_mt) -setmetatable(by_ft.autosnippets, by_ft_snippets_mt) - -local by_id = setmetatable({}, { - -- make by_id-table weak (v). - -- this means it won't be necessary to explicitly nil values (snippets) in - -- this table. - __mode = "v", -}) - --- ft: any filetype, optional. -function M.clear_snippets(ft) - if ft then - -- remove all ft-(auto)snippets for all priorities. - -- set to empty table so we won't need to rebuild/clear the order-table. - for _, prio in ipairs(by_prio.snippets.order) do - by_prio.snippets[prio][ft] = {} - end - for _, prio in ipairs(by_prio.autosnippets.order) do - by_prio.autosnippets[prio][ft] = {} - end - - by_ft.snippets[ft] = nil - by_ft.autosnippets[ft] = nil - - for key, _ in pairs(by_key) do - by_key[key][ft] = nil - end - else - -- remove all (auto)snippets for all priorities. - for _, prio in ipairs(by_prio.snippets.order) do - by_prio.snippets[prio] = {} - setmetatable(by_prio.snippets[prio], prio_mt2) - end - for _, prio in ipairs(by_prio.autosnippets.order) do - by_prio.autosnippets[prio] = {} - setmetatable(by_prio.autosnippets[prio], prio_mt2) - end - - by_key = {} - by_ft.snippets = {} - setmetatable(by_ft.snippets, by_ft_snippets_mt) - by_ft.autosnippets = {} - setmetatable(by_ft.autosnippets, by_ft_snippets_mt) - end -end - -function M.match_snippet(line, fts, type) - local expand_params - - for prio_by_ft in prio_iter(type) do - for _, ft in ipairs(fts) do - for _, snip in ipairs(prio_by_ft[ft] or {}) do - expand_params = snip:matches(line) - if expand_params then - -- return matching snippet and table with expand-parameters. - return snip, expand_params - end - end - end - end - - return nil -end - -local function without_invalidated(snippets_by_ft) - local new_snippets = {} - - for ft, ft_snippets in pairs(snippets_by_ft) do - new_snippets[ft] = {} - for _, snippet in ipairs(ft_snippets) do - if not snippet.invalidated then - table.insert(new_snippets[ft], snippet) - end - end - end - - return new_snippets -end - -function M.clean_invalidated(opts) - if opts.inv_limit then - if M.invalidated_count <= opts.inv_limit then - return - end - end - - -- remove invalidated snippets from all tables. - for _, type_snippets in pairs(by_prio) do - for key, prio_snippets in pairs(type_snippets) do - if key ~= "order" then - type_snippets[key] = without_invalidated(prio_snippets) - setmetatable(type_snippets[key], prio_mt2) - end - end - end - - for type, type_snippets in pairs(by_ft) do - by_ft[type] = without_invalidated(type_snippets) - setmetatable(by_ft[type], by_ft_snippets_mt) - end - - for key, key_snippets in pairs(by_key) do - by_key[key] = without_invalidated(key_snippets) - end - - M.invalidated_count = 0 -end - -local function invalidate_addables(addables_by_ft) - for _, addables in pairs(addables_by_ft) do - for _, addable in ipairs(addables) do - for _, expandable in ipairs(addable:retrieve_all()) do - expandable:invalidate() - end - end - end - M.clean_invalidated({ inv_limit = 100 }) -end - -local current_id = 0 --- snippets like {ft1={}, ft2={}}, opts should be properly --- initialized with default values. -function M.add_snippets(snippets, opts) - for ft, ft_snippets in pairs(snippets) do - for _, addable in ipairs(ft_snippets) do - for _, snip in ipairs(addable:retrieve_all()) do - local snip_prio = opts.override_priority - or (snip.priority and snip.priority) - or opts.default_priority - or 1000 - - -- if snippetType undefined by snippet, take default value from opts - local snip_type = snip.snippetType ~= nil and snip.snippetType - or opts.type - assert( - snip_type == "autosnippets" or snip_type == "snippets", - "snippetType must be either 'autosnippets' or 'snippets', was " - .. vim.inspect(snip_type) - ) - - local snip_ft = snip.filetype or ft - - snip.id = current_id - current_id = current_id + 1 - - -- do the insertion - table.insert(by_prio[snip_type][snip_prio][snip_ft], snip) - table.insert(by_ft[snip_type][snip_ft], snip) - by_id[snip.id] = snip - - -- set source if it is available. - if snip._source then - source.set(snip, snip._source) - end - end - end - end - - if opts.key then - if by_key[opts.key] then - invalidate_addables(by_key[opts.key]) - end - by_key[opts.key] = snippets - end -end - --- specialized copy functions to not loose performance on ifs when copying --- and to be able to specify when pairs or ipairs is used -local function copy_by_ft_type_ft(tab) - local r = {} - for k, v in ipairs(tab) do - r[k] = v - end - return r -end -local function copy_by_ft_type(tab) - local r = {} - for k, v in pairs(tab) do - r[k] = copy_by_ft_type_ft(v) - end - return r -end - --- ft may be nil, type not. -function M.get_snippets(ft, type) - if ft then - return copy_by_ft_type_ft(by_ft[type][ft]) - else - return copy_by_ft_type(by_ft[type]) - end -end - -function M.get_id_snippet(id) - return by_id[id] -end - -local function get_all_snippet_fts() - local ft_set = {} - for ft, _ in pairs(by_ft.snippets) do - ft_set[ft] = true - end - for ft, _ in pairs(by_ft.autosnippets) do - ft_set[ft] = true - end - - return u_table.set_to_list(ft_set) -end - --- modules that want to call refresh_notify probably also want to notify others --- of adding those snippets => put those functions into the same module. -function M.refresh_notify(ft_or_nil) - local fts = ft_or_nil and { ft_or_nil } or get_all_snippet_fts() - - for _, ft in ipairs(fts) do - session.latest_load_ft = ft - vim.api.nvim_exec_autocmds( - "User", - { pattern = "LuasnipSnippetsAdded", modeline = false } - ) - end -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/session/snippet_collection/source.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/session/snippet_collection/source.lua deleted file mode 100644 index 9f3319ef..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/session/snippet_collection/source.lua +++ /dev/null @@ -1,38 +0,0 @@ -local id_to_source = {} - -local M = {} - -function M.from_debuginfo(debuginfo) - assert(debuginfo.source, "debuginfo contains source") - assert( - debuginfo.source:match("^@"), - "debuginfo-source is a file: " .. debuginfo.source - ) - - return { - -- omit leading '@'. - file = debuginfo.source:sub(2), - line = debuginfo.currentline, - } -end - -function M.from_location(file, opts) - assert(file, "source needs file") - opts = opts or {} - - return { file = file, line = opts.line, line_end = opts.line_end } -end - -function M.set(snippet, source) - -- snippets only get their id after being added, make sure this is the - -- case. - assert(snippet.id, "snippet has an id") - - id_to_source[snippet.id] = source -end - -function M.get(snippet) - return id_to_source[snippet.id] -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/snippets.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/snippets.lua deleted file mode 100644 index e69de29b..00000000 diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/_builtin_vars.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/_builtin_vars.lua deleted file mode 100644 index 8287182f..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/_builtin_vars.lua +++ /dev/null @@ -1,208 +0,0 @@ -local util = require("luasnip.util.util") -local select_util = require("luasnip.util.select") -local time_util = require("luasnip.util.time") -local lazy_vars = {} - --- Variables defined in https://code.visualstudio.com/docs/editor/userdefinedsnippets#_variables - --- Inherited from TextMate -function lazy_vars.TM_FILENAME() - return vim.fn.expand("%:t") -end - -function lazy_vars.TM_FILENAME_BASE() - return vim.fn.expand("%:t:s?\\.[^\\.]\\+$??") -end - -function lazy_vars.TM_DIRECTORY() - return vim.fn.expand("%:p:h") -end - -function lazy_vars.TM_FILEPATH() - return vim.fn.expand("%:p") -end - --- Vscode only - -function lazy_vars.CLIPBOARD() -- The contents of your clipboard - return vim.fn.getreg('"', 1, true) -end - -local function buf_to_ws_part() - local LSP_WORSKPACE_PARTS = "LSP_WORSKPACE_PARTS" - local ok, ws_parts = pcall(vim.api.nvim_buf_get_var, 0, LSP_WORSKPACE_PARTS) - if not ok then - local file_path = vim.fn.expand("%:p") - - for _, ws in pairs(vim.lsp.buf.list_workspace_folders()) do - if file_path:find(ws, 1, true) == 1 then - ws_parts = { ws, file_path:sub(#ws + 2, -1) } - break - end - end - -- If it can't be extracted from lsp, then we use the file path - if not ok and not ws_parts then - ws_parts = { vim.fn.expand("%:p:h"), vim.fn.expand("%:p:t") } - end - vim.api.nvim_buf_set_var(0, LSP_WORSKPACE_PARTS, ws_parts) - end - return ws_parts -end - -function lazy_vars.RELATIVE_FILEPATH() -- The relative (to the opened workspace or folder) file path of the current document - return buf_to_ws_part()[2] -end - -function lazy_vars.WORKSPACE_FOLDER() -- The path of the opened workspace or folder - return buf_to_ws_part()[1] -end - -function lazy_vars.WORKSPACE_NAME() -- The name of the opened workspace or folder - local parts = vim.split(buf_to_ws_part()[1] or "", "[\\/]") - return parts[#parts] -end - --- DateTime Related -function lazy_vars.CURRENT_YEAR() - return os.date("%Y") -end - -function lazy_vars.CURRENT_YEAR_SHORT() - return os.date("%y") -end - -function lazy_vars.CURRENT_MONTH() - return os.date("%m") -end - -function lazy_vars.CURRENT_MONTH_NAME() - return os.date("%B") -end - -function lazy_vars.CURRENT_MONTH_NAME_SHORT() - return os.date("%b") -end - -function lazy_vars.CURRENT_DATE() - return os.date("%d") -end - -function lazy_vars.CURRENT_DAY_NAME() - return os.date("%A") -end - -function lazy_vars.CURRENT_DAY_NAME_SHORT() - return os.date("%a") -end - -function lazy_vars.CURRENT_HOUR() - return os.date("%H") -end - -function lazy_vars.CURRENT_MINUTE() - return os.date("%M") -end - -function lazy_vars.CURRENT_SECOND() - return os.date("%S") -end - -function lazy_vars.CURRENT_SECONDS_UNIX() - return tostring(os.time()) -end - -function lazy_vars.CURRENT_TIMEZONE_OFFSET() - return time_util - .get_timezone_offset(os.time()) - :gsub("([+-])(%d%d)(%d%d)$", "%1%2:%3") -end - --- For inserting random values - -math.randomseed(os.time()) - -function lazy_vars.RANDOM() - return string.format("%06d", math.random(999999)) -end - -function lazy_vars.RANDOM_HEX() - return string.format("%06x", math.random(16777216)) --16^6 -end - -function lazy_vars.UUID() - local random = math.random - local template = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx" - local out - local function subs(c) - local v = (((c == "x") and random(0, 15)) or random(8, 11)) - return string.format("%x", v) - end - - out = template:gsub("[xy]", subs) - return out -end - -function lazy_vars.LINE_COMMENT() - return util.buffer_comment_chars()[1] -end - -function lazy_vars.BLOCK_COMMENT_START() - return util.buffer_comment_chars()[2] -end - -function lazy_vars.BLOCK_COMMENT_END() - return util.buffer_comment_chars()[3] -end - --- These are the vars that have to be populated once the snippet starts to avoid any issue -local function eager_vars(info) - local vars = {} - local pos = info.pos - vars.TM_CURRENT_LINE = - vim.api.nvim_buf_get_lines(0, pos[1], pos[1] + 1, false)[1] - vars.TM_CURRENT_WORD = util.word_under_cursor(pos, vars.TM_CURRENT_LINE) - vars.TM_LINE_INDEX = tostring(pos[1]) - vars.TM_LINE_NUMBER = tostring(pos[1] + 1) - vars.LS_SELECT_RAW, vars.LS_SELECT_DEDENT, vars.TM_SELECTED_TEXT = - select_util.retrieve() - -- These are for backward compatibility, for now on all builtins that are not part of TM_ go in LS_ - vars.SELECT_RAW, vars.SELECT_DEDENT = - vars.LS_SELECT_RAW, vars.LS_SELECT_DEDENT - for i, cap in ipairs(info.captures) do - vars["LS_CAPTURE_" .. i] = cap - end - vars.LS_TRIGGER = info.trigger - return vars -end - -local builtin_ns = { SELECT = true, LS = true } - -for name, _ in pairs(lazy_vars) do - local parts = vim.split(name, "_") - if #parts > 1 then - builtin_ns[parts[1]] = true - end -end - -local _is_table = { - TM_SELECTED_TEXT = true, - SELECT_RAW = true, - SELECT_DEDENT = true, -} - -return { - is_table = function(key) - -- variables generated at runtime by treesitter-postfix. - if - key:match("LS_TSCAPTURE_.*") - or key == "LS_TSPOSTFIX_MATCH" - or key == "LS_TSPOSTFIX_DATA" - then - return true - end - return _is_table[key] or false - end, - vars = lazy_vars, - init = eager_vars, - builtin_ns = builtin_ns, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/auto_table.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/auto_table.lua deleted file mode 100644 index 3a9858c0..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/auto_table.lua +++ /dev/null @@ -1,54 +0,0 @@ --- depth specifies how many levels under this table should be allowed to index --- throug this metamethod --- set depth to 0 to disable checking --- Acknowledgment: This is (maybe more than) inspired by --- https://lua-users.org/wiki/AutomagicTables so special thanks to --- Thomas Wrensch and Rici Lake for sharing their ideas on this topic. -local function auto_creating_tables_warn_depth(self, key, depth) - local t = {} - assert(depth ~= 1, "don't index at that level") - setmetatable(t, { - -- creating a new function on each time (could be shared) isn't that - -- nice. Nonetheless this shouldn't be too bad, as these are only - -- created twice (auto+snippet) per ft and twice for each prio,ft - -- combination - __index = function(s, k) - return auto_creating_tables_warn_depth(s, k, depth - 1) - end, - }) - self[key] = t - return t -end - -local function auto_creating_tables(self, key, depth) - local t = {} - if depth ~= 1 then - setmetatable(t, { - __index = function(s, k) - return auto_creating_tables(s, k, depth - 1) - end, - }) - end - self[key] = t - return t -end - -local M = {} - -function M.autotable(max_depth, opts) - opts = opts or {} - local warn = vim.F.if_nil(opts.warn, false) - - local auto_table_func = warn and auto_creating_tables_warn_depth - or auto_creating_tables - - return setmetatable({}, { - __index = function(s, k) - return auto_table_func(s, k, max_depth - 1) - end, - }) -end - -M.warn_depth_autotable = auto_creating_tables_warn_depth - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/dict.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/dict.lua deleted file mode 100644 index 3ce60ab6..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/dict.lua +++ /dev/null @@ -1,63 +0,0 @@ -local Dictionary = {} - -local function new(o) - return setmetatable(o or {}, { - __index = Dictionary, - }) -end - -function Dictionary:set(path, value) - -- Insp(path) - -- print("val: ", value) - local current_table = self - for i = 1, #path - 1 do - local crt_key = path[i] - if not current_table[crt_key] then - current_table[crt_key] = {} - end - current_table = current_table[crt_key] - end - current_table[path[#path]] = value -end - -function Dictionary:get(path) - local current_table = self - for _, v in ipairs(path) do - if not current_table[v] then - return nil - end - current_table = current_table[v] - end - -- may not be a table. - return current_table -end - -function Dictionary:find_all(path, key) - local res = {} - local to_search = { self:get(path) } - if not to_search[1] then - return nil - end - - -- weird hybrid of depth- and breadth-first search for key, collect values in res. - local search_index = 1 - local search_size = 1 - while search_size > 0 do - for k, v in pairs(to_search[search_index]) do - if k == key then - res[#res + 1] = v - else - to_search[search_index + search_size] = v - search_size = search_size + 1 - end - end - search_index = search_index + 1 - search_size = search_size - 1 - end - - return res -end - -return { - new = new, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/directed_graph.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/directed_graph.lua deleted file mode 100644 index 4c906328..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/directed_graph.lua +++ /dev/null @@ -1,263 +0,0 @@ -local tbl_util = require("luasnip.util.table") -local autotable = require("luasnip.util.auto_table").autotable - -local DirectedGraph = {} - --- set __index directly in DirectedGraph, otherwise each DirectedGraph-object would have its' --- own metatable (one more table around), which would not be bad, but --- unnecessary nonetheless. -DirectedGraph.__index = DirectedGraph - -local Vertex = {} -Vertex.__index = Vertex - -local function new_graph() - return setmetatable({ - -- all vertices of this graph. - vertices = {}, - }, DirectedGraph) -end -local function new_vertex() - return setmetatable({ - -- vertices this vertex has an edge from/to. - -- map[vert -> bool] - incoming_edge_verts = {}, - outgoing_edge_verts = {}, - }, Vertex) -end - ----Add new vertex to the DirectedGraph ----@return table: the generated vertex, to be used in `set_edge`, for example. -function DirectedGraph:add_vertex() - local vert = new_vertex() - table.insert(self.vertices, vert) - return vert -end - ----Remove vertex and its edges from DirectedGraph. ----@param v table: the vertex. -function DirectedGraph:clear_vertex(v) - if not vim.tbl_contains(self.vertices, v) then - -- vertex does not belong to this graph. Maybe throw error/make - -- condition known? - return - end - -- remove outgoing.. - for outgoing_edge_vert, _ in pairs(v.outgoing_edge_verts) do - self:clear_edge(v, outgoing_edge_vert) - end - -- ..and incoming edges with v from the graph. - for incoming_edge_vert, _ in pairs(v.incoming_edge_verts) do - self:clear_edge(incoming_edge_vert, v) - end -end - ----Add edge from v1 to v2 ----@param v1 table: vertex in the graph. ----@param v2 table: vertex in the graph. -function DirectedGraph:set_edge(v1, v2) - if v1.outgoing_edge_verts[v2] then - -- the edge already exists. Don't return an error, for now. - return - end - -- link vertices. - v1.outgoing_edge_verts[v2] = true - v2.incoming_edge_verts[v1] = true -end - ----Remove edge from v1 to v2 ----@param v1 table: vertex in the graph. ----@param v2 table: vertex in the graph. -function DirectedGraph:clear_edge(v1, v2) - assert(v1.outgoing_edge_verts[v2], "nonexistent edge cannot be removed.") - -- unlink vertices. - v1.outgoing_edge_verts[v2] = nil - v2.incoming_edge_verts[v1] = nil -end - ----Find and return verts with indegree 0. ----@param graph table: graph. ----@return table of vertices. -local function source_verts(graph) - local indegree_0_verts = {} - for _, vert in ipairs(graph.vertices) do - if vim.tbl_count(vert.incoming_edge_verts) == 0 then - table.insert(indegree_0_verts, vert) - end - end - return indegree_0_verts -end - ----Copy graph. ----@param graph table: graph. ----@return table,table: copied graph and table for mapping copied node to ----original node(original_vert[some_vert_from_copy] -> corresponding original ----vert). -local function graph_copy(graph) - local copy = vim.deepcopy(graph) - local original_vert = {} - for i, copy_vert in ipairs(copy.vertices) do - original_vert[copy_vert] = graph.vertices[i] - end - return copy, original_vert -end - ----Generate a (it's not necessarily unique) topological sorting of this graphs ----vertices. ----https://en.wikipedia.org/wiki/Topological_sorting, this uses Kahn's Algorithm. ----@return table|nil: sorted vertices of this graph, nil if there is no ----topological sorting (eg. if the graph has a cycle). -function DirectedGraph:topological_sort() - local sorting = {} - - -- copy self so edges can be removed without affecting the real graph. - local graph, original_vert = graph_copy(self) - - -- find vertices without incoming edges. - -- invariant: at the end of each step, sources contains all vertices - -- without incoming edges. - local sources = source_verts(graph) - while #sources > 0 do - -- pop v from sources. - local v = sources[#sources] - sources[#sources] = nil - - -- v has no incoming edges, it can be next in the sorting. - -- important!! don't insert v, insert the corresponding vertex from the - -- original graph. The copied vertices are not known outside this - -- function (alternative: maybe return indices in graph.vertices?). - table.insert(sorting, original_vert[v]) - - -- find vertices which, if v is removed from graph, have no more incoming edges. - -- Those are sources after v is removed. - for outgoing_edge_vert, _ in pairs(v.outgoing_edge_verts) do - -- there is one edge, it has to be from v. - if vim.tbl_count(outgoing_edge_vert.incoming_edge_verts) == 1 then - table.insert(sources, outgoing_edge_vert) - end - end - - -- finally: remove v from graph and sources. - graph:clear_vertex(v) - end - - if #sorting ~= #self.vertices then - -- error: the sorting does not contain all vertices -> the graph has a cycle. - return nil - end - return sorting -end - --- return all vertices reachable from this one. -function DirectedGraph:connected_component(vert, edge_direction) - local outgoing_vertices_field = edge_direction == "Backward" - and "incoming_edge_verts" - or "outgoing_edge_verts" - - local visited = {} - local to_visit = { [vert] = true } - - -- get any value in table. - local next_vert, _ = next(to_visit, nil) - while next_vert do - to_visit[next_vert] = nil - visited[next_vert] = true - - for neighbor, _ in pairs(next_vert[outgoing_vertices_field]) do - if not visited[neighbor] then - to_visit[neighbor] = true - end - end - - next_vert, _ = next(to_visit, nil) - end - - return tbl_util.set_to_list(visited) -end - --- Very useful to have a graph where vertices are associated with some label. --- This just proxies DirectedGraph and swaps labels and vertices in --- parameters/return-values. -local LabeledDigraph = {} -LabeledDigraph.__index = LabeledDigraph - -local function new_labeled_graph() - return setmetatable({ - graph = new_graph(), - label_to_vert = {}, - vert_to_label = {}, - -- map label -> origin-vert -> dest-vert - label_to_verts = autotable(3, { warn = false }), - -- map edge (origin,dest) to set of labels. - verts_to_label = autotable(3, { warn = false }), - }, LabeledDigraph) -end - -function LabeledDigraph:set_vertex(label) - if self.label_to_vert[label] then - -- don't add same label again. - return - end - - local vert = self.graph:add_vertex() - self.label_to_vert[label] = vert - self.vert_to_label[vert] = label -end - -function LabeledDigraph:set_edge(lv1, lv2, edge_label) - -- ensure vertices exist. - self:set_vertex(lv1) - self:set_vertex(lv2) - - if self.verts_to_label[lv1][lv2][edge_label] then - -- edge exists, do nothing. - return - end - - -- determine before setting the lv1-lv2-edge. - local other_edge_exists = next(self.verts_to_label[lv1][lv2], nil) ~= nil - - -- store both associations; - self.verts_to_label[lv1][lv2][edge_label] = true - self.label_to_verts[edge_label][lv1][lv2] = true - - if other_edge_exists then - -- there already exists an entry for this edge, no need to add it to - -- the graph. - return - end - self.graph:set_edge(self.label_to_vert[lv1], self.label_to_vert[lv2]) -end - -function LabeledDigraph:clear_edge(lv1, lv2, ledge) - if not self.verts_to_label[lv1][lv2][ledge] then - -- edge does not exist, do nothing. - return - end - - self.verts_to_label[lv1][lv2][ledge] = nil - if next(self.verts_to_label[lv1][lv2]) == nil then - -- removed last edge between v1, v2 -> remove edge in graph. - self.graph:clear_edge(self.label_to_vert[lv1], self.label_to_vert[lv2]) - end -end -function LabeledDigraph:clear_edges(label) - for lv1, lv2 in pairs(self.label_to_verts[label]) do - self:clear_edge(lv1, lv2, label) - end - -- set to nil, not {}, so autotable can work its magic. - self.label_to_verts[label] = nil -end - -function LabeledDigraph:connected_component(lv, edge_direction) - self:set_vertex(lv) - - return vim.tbl_map(function(v) - return self.vert_to_label[v] - end, self.graph:connected_component(self.label_to_vert[lv], edge_direction)) -end - -return { - new = new_graph, - new_labeled = new_labeled_graph, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/environ.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/environ.lua deleted file mode 100644 index bd73d1a2..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/environ.lua +++ /dev/null @@ -1,188 +0,0 @@ -local builtin_namespace = require("luasnip.util._builtin_vars") - -local function tbl_to_lazy_env(tbl) - local function wrapper(varname) - local val_ = tbl[varname] - if type(val_) == "function" then - return val_() - end - return val_ - end - - return wrapper -end - -local namespaces = {} - --- Namespaces allow users to define their own environmet variables -local function _resolve_namespace_var(full_varname) - local parts = vim.split(full_varname, "_") - local nmsp = namespaces[parts[1]] - - local varname - -- Is safe to fallback to the buitin-unnamed namespace as the checks in _env_namespace - -- don't allow overriding those vars - if nmsp then - varname = full_varname:sub(#parts[1] + 2) - else - nmsp = namespaces[""] - varname = full_varname - end - return nmsp, varname -end - -local Environ = {} - -function Environ.is_table(var_fullname) - local nmsp, varname = _resolve_namespace_var(var_fullname) - ---@diagnostic disable-next-line: need-check-nil - return nmsp.is_table(varname) -end - -function Environ:new(info, o) - o = o or {} - setmetatable(o, self) - vim.list_extend(info, info.pos) -- For compatibility with old user defined namespaces - - for ns_name, ns in pairs(namespaces) do - local eager_vars = {} - if ns.init then - eager_vars = ns.init(info) - end - for _, eager in ipairs(ns.eager) do - if not eager_vars[eager] then - eager_vars[eager] = ns.vars(eager) - end - end - - local prefix = "" - if ns_name ~= "" then - prefix = ns_name .. "_" - end - - for name, val in pairs(eager_vars) do - name = prefix .. name - rawset(o, name, val) - end - end - return o -end - -local builtin_ns_names = vim.inspect(vim.tbl_keys(builtin_namespace.builtin_ns)) - -local function _env_namespace(name, opts) - assert( - opts and type(opts) == "table", - ("Your opts for '%s' has to be a table"):format(name) - ) - assert( - opts.init or opts.vars, - ("Your opts for '%s' needs init or vars"):format(name) - ) - - -- namespace.eager → ns.vars - assert( - not opts.eager or opts.vars, - ("Your opts for %s can't set a `eager` field without the `vars` one"):format( - name - ) - ) - - opts.eager = opts.eager or {} - local multiline_vars = opts.multiline_vars or false - - local type_of_it = type(multiline_vars) - - assert( - type_of_it == "table" - or type_of_it == "boolean" - or type_of_it == "function", - ("Your opts for %s can't have `multiline_vars` of type %s"):format( - name, - type_of_it - ) - ) - - -- If type is function we don't have to override it - if type_of_it == "table" then - local is_table_set = {} - - for _, key in ipairs(multiline_vars) do - is_table_set[key] = true - end - - opts.is_table = function(key) - return is_table_set[key] or false - end - elseif type_of_it == "boolean" then - opts.is_table = function(_) - return multiline_vars - end - else -- is a function - opts.is_table = multiline_vars - end - - if opts.vars and type(opts.vars) == "table" then - opts.vars = tbl_to_lazy_env(opts.vars) - end - - namespaces[name] = opts -end - -_env_namespace("", builtin_namespace) - --- The exposed api checks for the names to avoid accidental overrides -function Environ.env_namespace(name, opts) - assert( - name:match("^[a-zA-Z][a-zA-Z0-9]*$"), - ("You can't create a namespace with name '%s' it has to contain only and at least a non alpha-numeric character"):format( - name - ) - ) - assert( - not builtin_namespace.builtin_ns[name], - ("You can't create a namespace with name '%s' because is one one of %s"):format( - name, - builtin_ns_names - ) - ) - - _env_namespace(name, opts) -end - -function Environ:__index(key) - local nmsp, varname = _resolve_namespace_var(key) - ---@diagnostic disable-next-line: need-check-nil - local val = nmsp.vars(varname) - - rawset(self, key, val) - - return val -end - -function Environ:override(env, new_env) - for k, v in pairs(new_env) do - env[k] = v - end -end - -local fake_env = { - __index = function(tbl, key) - local var - if Environ.is_table(key) then - var = { "$" .. key } - else - var = "$" .. key - end - rawset(tbl, key, var) - return var - end, -} - -function Environ.fake() - local o = {} - setmetatable(o, fake_env) - return o -end - -return Environ diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/events.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/events.lua deleted file mode 100644 index a7ba52d4..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/events.lua +++ /dev/null @@ -1,18 +0,0 @@ -local node_names = require("luasnip.util.types").names_pascal_case - -return { - enter = 1, - leave = 2, - change_choice = 3, - pre_expand = 4, - to_string = function(node_type, event_id) - if event_id == 3 then - return "ChangeChoice" - elseif event_id == 4 then - return "PreExpand" - else - return node_names[node_type] - .. (event_id == 1 and "Enter" or "Leave") - end - end, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/ext_opts.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/ext_opts.lua deleted file mode 100644 index 109bd6fb..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/ext_opts.lua +++ /dev/null @@ -1,159 +0,0 @@ --- eventually turn ext_opts into proper objects, mainly for --- default-construction eg. assured `complete`. --- --- child_*-functions perform the same operation as theiry non-child --- counterparts, but on a collection (eg. --- `{[types.insertNode={...}, [types.textNode]= {...}]}`) of ext_opts. - -local types = require("luasnip.util.types") - --- vim.tbl_extend always creates a new table, but doesn't accept nil, so we --- always pass this empty table, which will (has to!) stay empty. -local shared_empty_table = {} - -local states = { - "active", - "passive", - "snippet_passive", - "visited", - "unvisited", -} - --- opts: child_ext_opts, have to have hl_group set for all combinations of --- node-type and active,passive,snippet_passive,visited,unvisited. -local function clear_invalid(opts) - --stylua: ignore start - for _, node_type in pairs(types.node_types) do - for _, state in ipairs(states) do - local state_hl_group = opts[node_type][state].hl_group - - opts[node_type][state].hl_group = - vim.fn.hlexists(state_hl_group) == 1 and state_hl_group - or nil - end - end - --stylua: ignore end -end - -local function _complete_ext_opts(ext_opts) - if not ext_opts then - ext_opts = {} - end - ext_opts.snippet_passive = ext_opts.snippet_passive or {} - ext_opts.passive = vim.tbl_extend( - "keep", - ext_opts.passive or shared_empty_table, - ext_opts.snippet_passive or shared_empty_table - ) - -- both unvisited and visited inherit from passive. - ext_opts.unvisited = vim.tbl_extend( - "keep", - ext_opts.unvisited or shared_empty_table, - ext_opts.passive or shared_empty_table - ) - ext_opts.visited = vim.tbl_extend( - "keep", - ext_opts.visited or shared_empty_table, - ext_opts.passive or shared_empty_table - ) - -- active inherits from visited. - ext_opts.active = vim.tbl_extend( - "keep", - ext_opts.active or shared_empty_table, - ext_opts.visited or shared_empty_table - ) - - for _, state in ipairs(states) do - --stylua: ignore start - if ext_opts[state].hl_group and not - ext_opts[state].priority then - ext_opts[state].priority = 0 - end - --stylua: ignore end - end - - return ext_opts -end - --- active inherits unset values from passive, which in turn inherits from --- snippet_passive. --- Also make sure that all keys have a table, and are not nil! -local function child_complete(ext_opts) - for _, node_type in pairs(types.node_types) do - ext_opts[node_type] = _complete_ext_opts(ext_opts[node_type]) - end - ext_opts.base_prio = 0 - - return ext_opts -end - -local function complete(ext_opts) - _complete_ext_opts(ext_opts) - ext_opts.base_prio = 0 - - return ext_opts -end - --- in-place adds opts of b to a, doesn't override. --- a/b: completed ext_opts, not nil. -local function extend(opts_a, opts_b) - for _, state in ipairs(states) do - opts_a[state] = vim.tbl_extend("keep", opts_a[state], opts_b[state]) - end - - return opts_a -end - --- in-place adds opts of b to a, doesn't override. --- a/b: completed child_ext_opts, not nil. -local function child_extend(opts_a, opts_b) - for _, node_type in ipairs(types.node_types) do - extend(opts_a[node_type], opts_b[node_type]) - end - - return opts_a -end - -local function increase_prio(opts, inc) - -- increase only if there is a priority. - for _, state in ipairs(states) do - opts[state].priority = opts[state].priority - and (opts[state].priority + inc) - end -end - --- ext_opts-priorities are defined relative to some base-priority. --- As nvim_api_buf_set_extmark takes absolute values only, we have to --- set the absolute priorities, which can vary depending on nesting-level --- of a given snippet, during runtime, by increasing the relative priorities by --- either the conf.base_prio or the base-prio used in the previous nesting-level. -local function set_abs_prio(opts, new_base_prio) - -- undo previous increase. - -- base_prio is initialized with 0. - local prio_offset = new_base_prio - opts.base_prio - opts.base_prio = new_base_prio - increase_prio(opts, prio_offset) - - return opts -end - -local function child_set_abs_prio(opts, new_base_prio) - -- undo previous increase. - -- base_prio is initialized with 0. - local prio_offset = new_base_prio - opts.base_prio - opts.base_prio = new_base_prio - for _, node_type in ipairs(types.node_types) do - increase_prio(opts[node_type], prio_offset) - end - return opts -end - -return { - clear_invalid = clear_invalid, - complete = complete, - child_complete = child_complete, - extend = extend, - child_extend = child_extend, - set_abs_prio = set_abs_prio, - child_set_abs_prio = child_set_abs_prio, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/extend_decorator.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/extend_decorator.lua deleted file mode 100644 index f0723819..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/extend_decorator.lua +++ /dev/null @@ -1,82 +0,0 @@ -local M = {} - --- map fn -> {arg_indx = int, extend = fn}[] -local function_properties = setmetatable({}, { __mode = "k" }) - -local function default_extend(arg, extend) - return vim.tbl_extend("keep", arg or {}, extend or {}) -end - ----Create a new decorated version of `fn`. ----@param fn The function to create a decorator for. ----@vararg The values to extend with. These should match the descriptions passed ----in `register`: ----```lua ----local function somefn(arg1, arg2, opts1, opts2) ----... ----end ----register(somefn, {arg_indx=4}, {arg_indx=3}) ----apply(somefn, ---- {key = "opts2 is extended with this"}, ---- {key = "and opts1 with this"}) ----``` ----@return function: The decorated function. -function M.apply(fn, ...) - local extend_properties = function_properties[fn] - assert( - extend_properties, - "Cannot extend this function, it was not registered! Check :h luasnip-extend_decorator for more infos." - ) - - local extend_values = { ... } - - local decorated_fn = function(...) - local direct_args = { ... } - - -- override values of direct argument. - for i, ep in ipairs(extend_properties) do - local arg_indx = ep.arg_indx - - -- still allow overriding with directly-passed keys. - direct_args[arg_indx] = - ep.extend(direct_args[arg_indx], extend_values[i]) - end - - -- important: http://www.lua.org/manual/5.3/manual.html#3.4 - -- Passing arguments after the results from `unpack` would mess all this - -- up. - return fn(unpack(direct_args)) - end - - -- we know how to extend the decorated function! - function_properties[decorated_fn] = extend_properties - - return decorated_fn -end - ----Prepare a function for usage with extend_decorator. ----To create a decorated function which extends `opts`-style tables passed to it, we need to know ---- 1. which parameter-position the opts are in and ---- 2. how to extend them. ----@param fn function: the function that should be registered. ----@vararg tables. Each describes how to extend one parameter to `fn`. ----The tables accept the following keys: ---- - arg_indx, number (required): the position of the parameter to override. ---- - extend, fn(arg, extend_value) -> effective_arg (optional): this function ---- is used to extend the args passed to the decorated function. ---- It defaults to a function which just extends the the arg-table with the ---- extend-table. ---- This extend-behaviour is adaptable to accomodate `s`, where the first ---- argument may be string or table. -function M.register(fn, ...) - local fn_eps = { ... } - - -- make sure ep.extend is set. - for _, ep in ipairs(fn_eps) do - ep.extend = ep.extend or default_extend - end - - function_properties[fn] = fn_eps -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/functions.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/functions.lua deleted file mode 100644 index 3fc1ad7d..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/functions.lua +++ /dev/null @@ -1,49 +0,0 @@ -local sn = require("luasnip.nodes.snippet").SN -local t = require("luasnip.nodes.textNode").T - -return { - var = function(_, _, node, text) - local v = node.parent.snippet.env[text] - if type(v) == "table" then - -- Avoid issues with empty vars - if #v > 0 then - return v - else - return { "" } - end - else - return { v } - end - end, - better_var = function(varname) - return function(_, parent) - local v = parent.snippet.env[varname] - if type(v) == "table" then - -- Avoid issues with empty vars - if #v > 0 then - return v - else - return { "" } - end - else - return { v } - end - end - end, - eval_vim_dynamic = function(vimstring) - return function() - -- 'echo'd string is returned to lua. - return sn(nil, { - t( - vim.split( - vim.api.nvim_exec("echo " .. vimstring, true), - "\n" - ) - ), - }) - end - end, - copy = function(args) - return args[1] - end, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/jsonc.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/jsonc.lua deleted file mode 100644 index d72dad5a..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/jsonc.lua +++ /dev/null @@ -1,469 +0,0 @@ --- Taken from https://github.com/actboy168/json.lua - --- MIT License --- --- Copyright (c) 2020 actboy168 --- --- Permission is hereby granted, free of charge, to any person obtaining a copy --- of this software and associated documentation files (the "Software"), to deal --- in the Software without restriction, including without limitation the rights --- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --- copies of the Software, and to permit persons to whom the Software is --- furnished to do so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in all --- copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --- SOFTWARE. - -local type = type -local next = next -local error = error -local tonumber = tonumber -local string_char = string.char -local string_byte = string.byte -local string_find = string.find -local string_match = string.match -local string_gsub = string.gsub -local string_sub = string.sub -local string_format = string.format - -local utf8_char - -if _VERSION == "Lua 5.1" or _VERSION == "Lua 5.2" then - local math_floor = math.floor - function utf8_char(c) - if c <= 0x7f then - return string_char(c) - elseif c <= 0x7ff then - return string_char(math_floor(c / 64) + 192, c % 64 + 128) - elseif c <= 0xffff then - return string_char( - math_floor(c / 4096) + 224, - math_floor(c % 4096 / 64) + 128, - c % 64 + 128 - ) - elseif c <= 0x10ffff then - return string_char( - math_floor(c / 262144) + 240, - math_floor(c % 262144 / 4096) + 128, - math_floor(c % 4096 / 64) + 128, - c % 64 + 128 - ) - end - error(string_format("invalid UTF-8 code '%x'", c)) - end -else - utf8_char = utf8.char -end - -local encode_escape_map = { - ['"'] = '\\"', - ["\\"] = "\\\\", - ["/"] = "\\/", - ["\b"] = "\\b", - ["\f"] = "\\f", - ["\n"] = "\\n", - ["\r"] = "\\r", - ["\t"] = "\\t", -} - -local decode_escape_set = {} -local decode_escape_map = {} -for k, v in next, encode_escape_map do - decode_escape_map[v] = k - decode_escape_set[string_byte(v, 2)] = true -end - -local statusBuf -local statusPos -local statusTop -local statusAry = {} -local statusRef = {} - -local function find_line() - local line = 1 - local pos = 1 - while true do - local f, _, nl1, nl2 = string_find(statusBuf, "([\n\r])([\n\r]?)", pos) - if not f then - return line, statusPos - pos + 1 - end - local newpos = f + ((nl1 == nl2 or nl2 == "") and 1 or 2) - if newpos > statusPos then - return line, statusPos - pos + 1 - end - pos = newpos - line = line + 1 - end -end - -local function decode_error(msg) - error(string_format("ERROR: %s at line %d col %d", msg, find_line()), 2) -end - -local function get_word() - return string_match(statusBuf, "^[^ \t\r\n%]},]*", statusPos) -end - -local function skip_comment(b) - if - b ~= 47 --[[ '/' ]] - then - return - end - local c = string_byte(statusBuf, statusPos + 1) - if - c == 42 --[[ '*' ]] - then - -- block comment - local pos = string_find(statusBuf, "*/", statusPos) - if pos then - statusPos = pos + 2 - else - statusPos = #statusBuf + 1 - end - return true - elseif - c == 47 --[[ '/' ]] - then - -- line comment - local pos = string_find(statusBuf, "[\r\n]", statusPos) - if pos then - statusPos = pos - else - statusPos = #statusBuf + 1 - end - return true - end -end - -local function next_byte() - local pos = string_find(statusBuf, "[^ \t\r\n]", statusPos) - if pos then - statusPos = pos - local b = string_byte(statusBuf, pos) - if not skip_comment(b) then - return b - end - return next_byte() - end - return -1 -end - -local function decode_unicode_surrogate(s1, s2) - return utf8_char( - 0x10000 - + (tonumber(s1, 16) - 0xd800) * 0x400 - + (tonumber(s2, 16) - 0xdc00) - ) -end - -local function decode_unicode_escape(s) - return utf8_char(tonumber(s, 16)) -end - -local function decode_string() - local has_unicode_escape = false - local has_escape = false - local i = statusPos + 1 - while true do - i = string_find(statusBuf, '[%z\1-\31\\"]', i) - if not i then - decode_error("expected closing quote for string") - end - local x = string_byte(statusBuf, i) - if x < 32 then - statusPos = i - decode_error("control character in string") - end - if - x == 34 --[[ '"' ]] - then - local s = string_sub(statusBuf, statusPos + 1, i - 1) - if has_unicode_escape then - s = string_gsub( - string_gsub( - s, - "\\u([dD][89aAbB]%x%x)\\u([dD][c-fC-F]%x%x)", - decode_unicode_surrogate - ), - "\\u(%x%x%x%x)", - decode_unicode_escape - ) - end - if has_escape then - s = string_gsub(s, "\\.", decode_escape_map) - end - statusPos = i + 1 - return s - end - --assert(x == 92 --[[ "\\" ]]) - local nx = string_byte(statusBuf, i + 1) - if - nx == 117 --[[ "u" ]] - then - if not string_match(statusBuf, "^%x%x%x%x", i + 2) then - statusPos = i - decode_error("invalid unicode escape in string") - end - has_unicode_escape = true - i = i + 6 - else - if not decode_escape_set[nx] then - statusPos = i - decode_error( - "invalid escape char '" - .. (nx and string_char(nx) or "") - .. "' in string" - ) - end - has_escape = true - i = i + 2 - end - end -end - -local function decode_number() - local num, c = - string_match(statusBuf, "^([0-9]+%.?[0-9]*)([eE]?)", statusPos) - if - not num or string_byte(num, -1) == 0x2E --[[ "." ]] - then - decode_error("invalid number '" .. get_word() .. "'") - end - if c ~= "" then - num = string_match( - statusBuf, - "^([^eE]*[eE][-+]?[0-9]+)[ \t\r\n%]},/]", - statusPos - ) - if not num then - decode_error("invalid number '" .. get_word() .. "'") - end - end - statusPos = statusPos + #num - return tonumber(num) -end - -local function decode_number_zero() - local num, c = string_match(statusBuf, "^(.%.?[0-9]*)([eE]?)", statusPos) - if - not num - or string_byte(num, -1) == 0x2E --[[ "." ]] - or string_match(statusBuf, "^.[0-9]+", statusPos) - then - decode_error("invalid number '" .. get_word() .. "'") - end - if c ~= "" then - num = string_match( - statusBuf, - "^([^eE]*[eE][-+]?[0-9]+)[ \t\r\n%]},/]", - statusPos - ) - if not num then - decode_error("invalid number '" .. get_word() .. "'") - end - end - statusPos = statusPos + #num - return tonumber(num) -end - -local function decode_number_negative() - statusPos = statusPos + 1 - local c = string_byte(statusBuf, statusPos) - if c then - if c == 0x30 then - return -decode_number_zero() - elseif c > 0x30 and c < 0x3A then - return -decode_number() - end - end - decode_error("invalid number '" .. get_word() .. "'") -end - -local function decode_true() - if string_sub(statusBuf, statusPos, statusPos + 3) ~= "true" then - decode_error("invalid literal '" .. get_word() .. "'") - end - statusPos = statusPos + 4 - return true -end - -local function decode_false() - if string_sub(statusBuf, statusPos, statusPos + 4) ~= "false" then - decode_error("invalid literal '" .. get_word() .. "'") - end - statusPos = statusPos + 5 - return false -end - -local function decode_null() - if string_sub(statusBuf, statusPos, statusPos + 3) ~= "null" then - decode_error("invalid literal '" .. get_word() .. "'") - end - statusPos = statusPos + 4 - return vim.NIL -end - -local function decode_array() - statusPos = statusPos + 1 - local res = {} - local chr = next_byte() - if - chr == 93 --[[ ']' ]] - then - statusPos = statusPos + 1 - return res - end - statusTop = statusTop + 1 - statusAry[statusTop] = true - statusRef[statusTop] = res - return res -end - -local function decode_object() - statusPos = statusPos + 1 - local res = {} - local chr = next_byte() - if - chr == 125 --[[ ']' ]] - then - statusPos = statusPos + 1 - return vim.empty_dict() - end - statusTop = statusTop + 1 - statusAry[statusTop] = false - statusRef[statusTop] = res - return res -end - -local decode_uncompleted_map = { - [string_byte('"')] = decode_string, - [string_byte("0")] = decode_number_zero, - [string_byte("1")] = decode_number, - [string_byte("2")] = decode_number, - [string_byte("3")] = decode_number, - [string_byte("4")] = decode_number, - [string_byte("5")] = decode_number, - [string_byte("6")] = decode_number, - [string_byte("7")] = decode_number, - [string_byte("8")] = decode_number, - [string_byte("9")] = decode_number, - [string_byte("-")] = decode_number_negative, - [string_byte("t")] = decode_true, - [string_byte("f")] = decode_false, - [string_byte("n")] = decode_null, - [string_byte("[")] = decode_array, - [string_byte("{")] = decode_object, -} -local function unexpected_character() - decode_error( - "unexpected character '" - .. string_sub(statusBuf, statusPos, statusPos) - .. "'" - ) -end -local function unexpected_eol() - decode_error("unexpected character ''") -end - -local decode_map = {} -for i = 0, 255 do - decode_map[i] = decode_uncompleted_map[i] or unexpected_character -end -decode_map[-1] = unexpected_eol - -local function decode() - return decode_map[next_byte()]() -end - -local function decode_item() - local top = statusTop - local ref = statusRef[top] - if statusAry[top] then - ref[#ref + 1] = decode() - else - local key = decode_string() - if - next_byte() ~= 58 --[[ ':' ]] - then - decode_error("expected ':'") - end - statusPos = statusPos + 1 - ref[key] = decode() - end - if top == statusTop then - repeat - local chr = next_byte() - statusPos = statusPos + 1 - if - chr == 44 --[[ "," ]] - then - local c = next_byte() - if statusAry[statusTop] then - if - c ~= 93 --[[ "]" ]] - then - return - end - else - if - c ~= 125 --[[ "}" ]] - then - return - end - end - statusPos = statusPos + 1 - else - if statusAry[statusTop] then - if - chr ~= 93 --[[ "]" ]] - then - decode_error("expected ']' or ','") - end - else - if - chr ~= 125 --[[ "}" ]] - then - decode_error("expected '}' or ','") - end - end - end - statusTop = statusTop - 1 - until statusTop == 0 - end -end - -local M = {} - -function M.decode(str) - if type(str) ~= "string" then - error("expected argument of type string, got " .. type(str)) - end - if str == "" then - error("attempted to decode an empty string") - end - statusBuf = str - statusPos = 1 - statusTop = 0 - if next_byte() == -1 then - return vim.NIL - end - local res = decode() - while statusTop > 0 do - decode_item() - end - if string_find(statusBuf, "[^ \t\r\n]", statusPos) then - decode_error("trailing garbage") - end - return res -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/jsregexp.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/jsregexp.lua deleted file mode 100644 index 54be37ec..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/jsregexp.lua +++ /dev/null @@ -1,41 +0,0 @@ -local Path = require("luasnip.util.path") - --- neovim-loader does not handle module-names with dots correctly, so for --- jsregexp-0.0.6, the call to require("jsregexp.core") in jsregexp.lua errors --- even if the library is in rtp. --- Resolve path to jsregexp.so manually, and loadlib it in preload (and remove --- preload after requires are done and have failed/worked). - --- omit "@". -local this_file = debug.getinfo(1).source:sub(2) -local repo_dir = vim.fn.fnamemodify(this_file, ":h:h:h:h") -local jsregexp_core_path = Path.join(repo_dir, "deps", "luasnip-jsregexp.so") - --- rather gracefully, if the path does not exist, or loadlib can't do its job --- for some other reason, the preload will be set to nil, ie not be set. --- --- This means we don't hinder a regularly installed 0.0.6-jsregexp-library, --- since its `require("jsregexp.core")` will be unaffected. -package.preload["jsregexp.core"] = - package.loadlib(jsregexp_core_path, "luaopen_jsregexp_core") - --- jsregexp: first try loading the version installed by luasnip, then global ones. -local jsregexp_ok, jsregexp = pcall(require, "luasnip-jsregexp") -if not jsregexp_ok then - jsregexp_ok, jsregexp = pcall(require, "jsregexp") -end - --- don't want to affect other requires. -package.preload["jsregexp.core"] = nil - -if not jsregexp_ok then - return false -end - --- detect version, and return compile-function. --- 0.0.6-compile_safe and 0.0.5-compile behave the same, ie. nil, err on error. -if jsregexp.compile_safe then - return jsregexp.compile_safe -else - return jsregexp.compile -end diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/lazy_table.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/lazy_table.lua deleted file mode 100644 index 6c5e4821..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/lazy_table.lua +++ /dev/null @@ -1,13 +0,0 @@ -return function(lazy_t, lazy_defs) - return setmetatable(lazy_t, { - __index = function(t, k) - local v = lazy_defs[k] - if v then - local v_resolved = v() - rawset(t, k, v_resolved) - return v_resolved - end - return nil - end, - }) -end diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/log.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/log.lua deleted file mode 100644 index ad4045da..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/log.lua +++ /dev/null @@ -1,123 +0,0 @@ -local util = require("luasnip.util.util") - --- older neovim-versions (even 0.7.2) do not have stdpath("log"). -local logpath_ok, logpath = pcall(vim.fn.stdpath, "log") -if not logpath_ok then - logpath = vim.fn.stdpath("cache") -end - --- just to be sure this dir exists. --- 448 = 0700 -vim.loop.fs_mkdir(logpath, 448) - -local log_location = logpath .. "/luasnip.log" -local log_old_location = logpath .. "/luasnip.log.old" - -local luasnip_log_fd = vim.loop.fs_open( - log_location, - -- only append. - "a", - -- 420 = 0644 - 420 -) - -local function log_line_append(msg) - msg = msg:gsub("\n", "\n | ") - vim.loop.fs_write(luasnip_log_fd, msg .. "\n") -end - -if not luasnip_log_fd then - -- print a warning - print( - ("LuaSnip: could not open log at %s. Not logging for this session."):format( - log_location - ) - ) - -- make log_line_append do nothing. - log_line_append = util.nop -else - -- if log_fd found, check if log should be rotated. - local logsize = vim.loop.fs_fstat(luasnip_log_fd).size - if logsize > 10 * 2 ^ 20 then - -- logsize > 10MiB: - -- move log -> old log, start new log. - vim.loop.fs_rename(log_location, log_old_location) - luasnip_log_fd = vim.loop.fs_open( - log_location, - -- only append. - "a", - -- 420 = 0644 - 420 - ) - end -end - -local M = {} - -local log = { - error = function(msg) - log_line_append("ERROR | " .. msg) - end, - warn = function(msg) - log_line_append("WARN | " .. msg) - end, - info = function(msg) - log_line_append("INFO | " .. msg) - end, - debug = function(msg) - log_line_append("DEBUG | " .. msg) - end, -} - --- functions copied directly by deepcopy. --- will be initialized later on, by set_loglevel. -local effective_log - --- levels sorted by importance, descending. -local loglevels = { "error", "warn", "info", "debug" } - --- special key none disable all logging. -function M.set_loglevel(target_level) - local target_level_indx = util.indx_of(loglevels, target_level) - if target_level == "none" then - target_level_indx = 0 - end - - assert(target_level_indx ~= nil, "invalid level!") - - -- reset effective loglevels, set those with importance higher than - -- target_level, disable (nop) those with lower. - effective_log = {} - for i = 1, target_level_indx do - effective_log[loglevels[i]] = log[loglevels[i]] - end - for i = target_level_indx + 1, #loglevels do - effective_log[loglevels[i]] = util.nop - end -end - -function M.new(module_name) - local module_log = {} - for name, _ in pairs(log) do - module_log[name] = function(msg, ...) - -- don't immediately get the referenced function, we'd like to - -- allow changing the loglevel on-the-fly. - effective_log[name](module_name .. ": " .. msg:format(...)) - end - end - return module_log -end - -function M.open() - vim.cmd(("tabnew %s"):format(log_location)) -end - --- to verify log is working. -function M.ping() - log_line_append(("PONG | pong! (%s)"):format(os.date())) -end - --- set default-loglevel. -M.set_loglevel("warn") - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/mark.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/mark.lua deleted file mode 100644 index daf9b074..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/mark.lua +++ /dev/null @@ -1,208 +0,0 @@ -local session = require("luasnip.session") - -local Mark = {} - -function Mark:new(o) - o = o or {} - setmetatable(o, self) - self.__index = self - return o -end - --- opts just like in nvim_buf_set_extmark. -local function mark(pos_begin, pos_end, opts) - return Mark:new({ - id = vim.api.nvim_buf_set_extmark( - 0, - session.ns_id, - pos_begin[1], - pos_begin[2], - -- override end_* in opts. - vim.tbl_extend( - "force", - opts, - { end_line = pos_end[1], end_col = pos_end[2] } - ) - ), - -- store opts here, can't be queried using nvim_buf_get_extmark_by_id. - opts = opts, - }) -end - -local function bytecol_to_utfcol(pos) - local line = vim.api.nvim_buf_get_lines(0, pos[1], pos[1] + 1, false) - -- line[1]: get_lines returns table. - -- use utf16-index. - local utf16_indx, _ = vim.str_utfindex(line[1] or "", pos[2]) - return { pos[1], utf16_indx } -end - -function Mark:pos_begin_end() - local mark_info = vim.api.nvim_buf_get_extmark_by_id( - 0, - session.ns_id, - self.id, - { details = true } - ) - - return bytecol_to_utfcol({ mark_info[1], mark_info[2] }), - bytecol_to_utfcol({ mark_info[3].end_row, mark_info[3].end_col }) -end - -function Mark:pos_begin() - local mark_info = vim.api.nvim_buf_get_extmark_by_id( - 0, - session.ns_id, - self.id, - { details = false } - ) - - return bytecol_to_utfcol({ mark_info[1], mark_info[2] }) -end - -function Mark:pos_end() - local mark_info = vim.api.nvim_buf_get_extmark_by_id( - 0, - session.ns_id, - self.id, - { details = true } - ) - - return bytecol_to_utfcol({ mark_info[3].end_row, mark_info[3].end_col }) -end - -function Mark:pos_begin_end_raw() - local mark_info = vim.api.nvim_buf_get_extmark_by_id( - 0, - session.ns_id, - self.id, - { details = true } - ) - return { mark_info[1], mark_info[2] }, { - mark_info[3].end_row, - mark_info[3].end_col, - } -end - -function Mark:pos_begin_raw() - local mark_info = vim.api.nvim_buf_get_extmark_by_id( - 0, - session.ns_id, - self.id, - { details = false } - ) - return { mark_info[1], mark_info[2] } -end - -function Mark:copy_pos_gravs(opts) - local pos_beg, pos_end = self:pos_begin_end_raw() - opts.right_gravity = self.opts.right_gravity - opts.end_right_gravity = self.opts.end_right_gravity - return mark(pos_beg, pos_end, opts) -end - --- opts just like in nvim_buf_set_extmark. --- opts as first arg bcs. pos are pretty likely to stay the same. -function Mark:update(opts, pos_begin, pos_end) - -- if one is changed, the other is likely as well. - if not pos_begin then - pos_begin = old_pos_begin - if not pos_end then - pos_end = old_pos_end - end - end - -- override with new. - self.opts = vim.tbl_extend("force", self.opts, opts) - vim.api.nvim_buf_set_extmark( - 0, - session.ns_id, - pos_begin[1], - pos_begin[2], - vim.tbl_extend( - "force", - self.opts, - { id = self.id, end_line = pos_end[1], end_col = pos_end[2] } - ) - ) -end - -function Mark:set_opts(opts) - local pos_begin, pos_end = self:pos_begin_end_raw() - vim.api.nvim_buf_del_extmark(0, session.ns_id, self.id) - - self.opts = opts - -- set new extmark, current behaviour for updating seems inconsistent, - -- eg. gravs are reset, deco is kept. - self.id = vim.api.nvim_buf_set_extmark( - 0, - session.ns_id, - pos_begin[1], - pos_begin[2], - vim.tbl_extend( - "force", - opts, - { end_line = pos_end[1], end_col = pos_end[2] } - ) - ) -end - -function Mark:set_rgravs(rgrav_left, rgrav_right) - -- don't update if nothing would change. - if - self.opts.right_gravity ~= rgrav_left - or self.opts.end_right_gravity ~= rgrav_right - then - self.opts.right_gravity = rgrav_left - self.opts.end_right_gravity = rgrav_right - self:set_opts(self.opts) - end -end - -function Mark:get_rgrav(which) - if which == -1 then - return self.opts.right_gravity - else - return self.opts.end_right_gravity - end -end - -function Mark:set_rgrav(which, rgrav) - if which == -1 then - if self.opts.right_gravity == rgrav then - return - end - self.opts.right_gravity = rgrav - else - if self.opts.end_right_gravity == rgrav then - return - end - self.opts.end_right_gravity = rgrav - end - self:set_opts(self.opts) -end - -function Mark:get_endpoint(which) - -- simpler for now, look into perf here later. - local l, r = self:pos_begin_end_raw() - if which == -1 then - return l - else - return r - end -end - --- change all opts except rgravs. -function Mark:update_opts(opts) - local opts_cp = vim.deepcopy(opts) - opts_cp.right_gravity = self.opts.right_gravity - opts_cp.end_right_gravity = self.opts.end_right_gravity - self:set_opts(opts_cp) -end - -function Mark:clear() - vim.api.nvim_buf_del_extmark(0, session.ns_id, self.id) -end - -return { - mark = mark, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/parser/ast_parser.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/parser/ast_parser.lua deleted file mode 100644 index 20f056a3..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/parser/ast_parser.lua +++ /dev/null @@ -1,350 +0,0 @@ -local ast_utils = require("luasnip.util.parser.ast_utils") -local Ast = require("luasnip.util.parser.neovim_ast") -local tNode = require("luasnip.nodes.textNode") -local iNode = require("luasnip.nodes.insertNode") -local fNode = require("luasnip.nodes.functionNode") -local cNode = require("luasnip.nodes.choiceNode") -local dNode = require("luasnip.nodes.dynamicNode") -local sNode = require("luasnip.nodes.snippet") -local functions = require("luasnip.util.functions") -local Environ = require("luasnip.util.environ") -local session = require("luasnip.session") -local util = require("luasnip.util.util") - -local M = {} - -local _split = function(s) - return vim.split(s, "\n", { plain = true }) -end - -local types = ast_utils.types - -local to_node - -local function fix_node_indices(nodes) - local used_nodes = {} - for _, node in ipairs(nodes) do - if node.pos and node.pos > 0 then - used_nodes[node.pos] = node - end - end - - for _, v, i in util.key_sorted_pairs(used_nodes) do - v.pos = i - end - return nodes -end - -local function ast2luasnip_nodes(ast_nodes) - local nodes = {} - for i, ast_node in ipairs(ast_nodes) do - nodes[i] = ast_node.parsed - end - - return fix_node_indices(nodes) -end - -local function var_func(ast) - local varname = ast.name - - local transform_func - if ast.transform then - transform_func = ast_utils.apply_transform(ast.transform) - else - transform_func = util.id - end - - return function(_, parent, _, variable_default) - local v = parent.snippet.env[varname] - local lines - if type(v) == "table" then - -- Avoid issues with empty vars - if #v > 0 then - lines = v - else - lines = { "" } - end - else - lines = { v } - end - - -- quicker than checking `lines` in some way. - if not v then - -- the variable is not defined: - -- insert the variable's name as a placeholder. - return sNode.SN(nil, { iNode.I(1, varname) }) - end - if #lines == 0 or (#lines == 1 and #lines[1] == 0) then - -- The variable is empty. - - -- default passed as user_arg, rationale described in - -- types.VARIABLE-to_node_func. - if variable_default then - return variable_default - else - -- lines might still just be {} (#lines == 0). - lines = { "" } - end - end - - -- v exists and has no default, return the (maybe modified) lines. - return sNode.SN(nil, { tNode.T(transform_func(lines)) }) - end -end - -local function copy_func(tabstop) - local transform_func - if tabstop.transform then - transform_func = ast_utils.apply_transform(tabstop.transform) - else - transform_func = util.id - end - return function(args) - return transform_func(args[1]) - end -end - -local function placeholder_func(_, parent, _, placeholder_snip) - local env = parent.snippet.env - -- is_interactive needs env to determine interactiveness. - -- env is passed through to all following is_interactive calls. - if not placeholder_snip:is_interactive(env) then - -- this placeholder only contains text or (transformed) - -- variables, so an insertNode can be generated from its - -- contents. - -- create new snippet that only contains the parsed snippetNode, so we - -- can `fake_expand` and `get_static_text()` it. - local snippet = sNode.S("", placeholder_snip) - - -- get active env from snippet. - snippet:fake_expand({ env = env }) - local iText = snippet:get_static_text() - - -- no need to un-escape iText, that was already done. - return sNode.SN(nil, iNode.I(1, iText)) - end - - return sNode.SN( - nil, - session.config.parser_nested_assembler(1, placeholder_snip) - ) -end - ----If this tabstop-node (CHOICE, TABSTOP or PLACEHOLDER) is a copy of another, ----set that up and return, otherwise return false. ----@param ast table: ast-node. ----@return boolean: whether the node is now parsed. -local function tabstop_node_copy_inst(ast) - local existing_tabstop_ast_node = ast.copies - if existing_tabstop_ast_node then - -- this tabstop is a mirror of an already-parsed tabstop/placeholder. - ast.parsed = - fNode.F(copy_func(ast), { existing_tabstop_ast_node.parsed }) - return true - end - return false -end --- these actually create nodes from any AST. -local to_node_funcs = { - -- careful! this parses the snippet into a list of nodes, not a full snippet! - -- The table can then be passed to the regular snippet-constructors. - [types.SNIPPET] = function(ast, _) - ast.parsed = ast2luasnip_nodes(ast.children) - end, - [types.TEXT] = function(ast, _) - local text = _split(ast.esc) - ast.parsed = tNode.T(text) - end, - [types.CHOICE] = function(ast) - -- even choices may be copies. - if tabstop_node_copy_inst(ast) then - return - end - - local choices = {} - for i, choice in ipairs(ast.items) do - choices[i] = tNode.T(_split(choice)) - end - - ast.parsed = cNode.C(ast.tabstop, choices) - end, - [types.TABSTOP] = function(ast) - if tabstop_node_copy_inst(ast) then - return - end - -- tabstops don't have placeholder-text. - ast.parsed = iNode.I(ast.tabstop) - end, - [types.PLACEHOLDER] = function(ast, state) - if tabstop_node_copy_inst(ast) then - return - end - - local node - if #ast.children == 1 and ast.children[1].type == types.TEXT then - -- we cannot place a dynamicNode as $0. - -- But all valid ${0:some nodes here} contain just text inside - -- them, so this works :) - node = iNode.I(ast.tabstop, _split(ast.children[1].esc)) - else - local snip = sNode.SN(1, ast2luasnip_nodes(ast.children)) - node = dNode.D(ast.tabstop, placeholder_func, {}, { - -- pass snip here, again to preserve references to other tables. - user_args = { snip }, - }) - end - - ast.parsed = node - end, - [types.VARIABLE] = function(ast, state) - local var = ast.name - - local default - if ast.children then - default = sNode.SN(nil, ast2luasnip_nodes(ast.children)) - end - - local fn - local is_interactive_fn - if state.var_functions[var] then - fn, is_interactive_fn = unpack(state.var_functions[var]) - else - fn = var_func(ast) - -- override the regular `is_interactive` to accurately determine - -- whether the snippet produced by the dynamicNode is interactive - -- or not. This is important when a variable is wrapped inside a - -- placeholder: ${1:$TM_SELECTED_TEXT} - -- With variable-environments we cannot tell at parse-time whether - -- the dynamicNode will be just text, an insertNode or some other - -- nodes(the default), so that has to happen at runtime now. - is_interactive_fn = function(_, env) - local var_value = env[var] - - if not var_value then - -- inserts insertNode. - return true - end - - -- just wrap it for more uniformity. - if type(var_value) == "string" then - var_value = { var_value } - end - - if - (#var_value == 1 and #var_value[1] == 0) - or #var_value == 0 - then - -- var is empty, default is inserted. - -- if no default, it's not interactive (an empty string is inserted). - return default and default:is_interactive() - end - - -- variable is just inserted, not interactive. - return false - end - end - - local d = dNode.D(ast.potential_tabstop, fn, {}, { - -- TRICKY!!!! - -- Problem: if the default is passed to the dynamicNode-function via lambda-capture, the - -- copy-routine, which will run on expansion, cannot associate these - -- nodes inside the passed nodes with the ones that are inside the - -- snippet. - -- For example, if `default` contains a functionNode which relies on - -- an insertNode within the snippet, it has the insertNode as an - -- argnode stored inside it. During copy, the copied insertNode (eg - -- a pointer to it) has to be inserted at this position as well, - -- otherwise there might be bugs (the snippet thinks the argnode is - -- present, but it isn't). - -- - -- This means that these nodes may not be passed as a simple - -- lambda-capture (!!). - -- I don't really like this, it can lead to very subtle errors (not - -- in this instance, but needing to do this in general). - -- - -- TODO: think about ways to avoid this. OTOH, this is almost okay, - -- just needs to be documented a bit. - -- - -- `default` is potentially nil. - user_args = { default }, - }) - d.is_interactive = is_interactive_fn - - -- if the variable is preceded by \n, the indent is applied to - -- all lines of the variable (important for eg. TM_SELECTED_TEXT). - if ast.previous_text ~= nil and #ast.previous_text > 1 then - local last_line_indent = - ast.previous_text[#ast.previous_text]:match("^%s+$") - if last_line_indent then - -- TM_SELECTED_TEXT contains the indent of the selected - -- snippets, which leads to correct indentation if the - -- snippet is expanded at the position the text was removed - -- from. - -- This seems pretty stupid, but TM_SELECTED_TEXT is - -- desigend to be compatible with vscode. - -- Use SELECT_DEDENT insted. - -- stylua: ignore - local indentstring = var ~= "TM_SELECTED_TEXT" - and "$PARENT_INDENT" .. last_line_indent - or last_line_indent - - -- adjust current d's jump-position.. - d.pos = 1 - -- ..so it has the correct position when wrapped inside a - -- snippetNode. - d = sNode.ISN(ast.potential_tabstop, { d }, indentstring) - end - end - - ast.parsed = d - end, -} - ---- Converts any ast into luasnip-nodes. ---- Snippets return a table of nodes, those can be used like the return-value of `fmt`. ----@param ast table: AST, as generated by `require("vim.lsp._snippet").parse` ----@param state table: ---- - `var_functions`: table, string -> {dNode-fn, is_interactive_fn} ---- For now, only used when parsing snipmate-snippets. ----@return table: node corresponding to `ast`. -function to_node(ast, state) - if not Ast.is_node(ast) then - -- ast is not an ast (probably a luasnip-node), return it as-is. - return ast - end - return to_node_funcs[ast.type](ast, state) -end - ---- Converts any ast into usable nodes. ----@param ast table: AST, as generated by `require("vim.lsp._snippet").parse` ----@param state table: ---- - `var_functions`: table, string -> {dNode-fn, is_interactive_fn} ---- For now, only used when parsing snipmate-snippets. ----@return table: list of luasnip-nodes. -function M.to_luasnip_nodes(ast, state) - state = state or {} - state.var_functions = state.var_functions or {} - - ast_utils.give_vars_potential_tabstop(ast) - - -- fix disallowed $0 in snippet. - -- TODO(logging): report changes here. - ast_utils.fix_zero(ast) - - -- Variables need the text just in front of them to determine whether to - -- indent all lines of the Variable. - ast_utils.give_vars_previous_text(ast) - - local ast_nodes_topsort = ast_utils.parse_order(ast) - assert( - ast_nodes_topsort, - "cannot represent snippet: contains circular dependencies" - ) - for _, node in ipairs(ast_nodes_topsort) do - to_node(node, state) - end - - return ast.parsed -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/parser/ast_utils.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/parser/ast_utils.lua deleted file mode 100644 index 42e614ec..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/parser/ast_utils.lua +++ /dev/null @@ -1,461 +0,0 @@ -local Ast = require("luasnip.util.parser.neovim_ast") -local types = Ast.node_type -local util = require("luasnip.util.util") -local Str = require("luasnip.util.str") -local log = require("luasnip.util.log").new("parser") -local jsregexp_compile_safe = require("luasnip.util.jsregexp") - -local directed_graph = require("luasnip.util.directed_graph") - -local M = {} - ----Walks ast pre-order, from left to right, applying predicate fn. ----The walk is aborted as soon as fn matches (eg. returns true). ----The walk does not recurse into Transform or choice, eg. it only covers nodes ----that can be jumped (in)to. ----@param ast table: the tree. ----@param fn function: the predicate. ----@return boolean: whether the predicate matched. -local function predicate_ltr_nodes(ast, fn) - if fn(ast) then - return true - end - for _, node in ipairs(ast.children or {}) do - if predicate_ltr_nodes(node, fn) then - return true - end - end - - return false -end - --- tested in vscode: --- in "${1|b,c|} ${1:aa}" ${1:aa} is the copy, --- in "${1:aa}, ${1|b,c|}" ${1|b,c} is the copy => with these two the position --- determines which is the real tabstop => they have the same priority. --- in "$1 ${1:aa}", $1 is the copy, so it has to have a lower priority. -local function type_real_tabstop_prio(node) - local _type_real_tabstop_prio = { - [types.TABSTOP] = 1, - [types.PLACEHOLDER] = 2, - [types.CHOICE] = 2, - } - if node.transform then - return 0 - end - return _type_real_tabstop_prio[node.type] -end - ----The name of this function is horrible, but I can't come up with something ----more succinct. ----The idea here is to find which of two nodes is "smaller" in a ----"real-tabstop"-ordering relation on all the nodes of a snippet. ----REQUIREMENT!!! The nodes have to be passed in the order they appear in in ----the snippet, eg. prev_node has to appear earlier in the text (or be a parent ----of) current_node. ----@param prev_node table: the ast node earlier in the text. ----@param current_node table: the other ast node. ----@return boolean: true if prev_node is less than (according to the ----"real-tabstop"-ordering described above and in the docstring of ----`add_dependents`), false otherwise. -local function real_tabstop_order_less(prev_node, current_node) - local prio_prev = type_real_tabstop_prio(prev_node) - local prio_current = type_real_tabstop_prio(current_node) - -- if type-prio is the same, the one that appeared earlier is the real tabstop. - return prio_prev == prio_current and false or prio_prev < prio_current -end - ----Find the real (eg. the one that is not a copy) $0. ----@param ast table: ast ----@return number, number, boolean: first, the type of the node with position 0, then ---- the child of `ast` containing it and last whether the real $0 is copied. -local function real_zero_node(ast) - local real_zero = nil - local real_zero_indx = nil - local is_copied = false - - local _search_zero - _search_zero = function(node) - local had_zero = false - -- find placeholder/tabstop/choice with position 0 - if node.tabstop == 0 then - if not real_zero then - real_zero = node - had_zero = true - else - if real_tabstop_order_less(real_zero, node) then - -- node has a higher prio than the current real_zero. - real_zero = node - had_zero = true - end - -- we already encountered a zero-node, since i(0) cannot be - -- copied this has to be reported to the caller. - is_copied = true - end - end - for indx, child in ipairs(node.children or {}) do - local zn, _ = _search_zero(child) - -- due to recursion, this will be called last in the loop of the - -- outermost snippet. - -- real_zero_indx will be the position of the child of snippet, in - -- which the real $0 is located. - if zn then - real_zero_indx = indx - had_zero = true - end - end - - return had_zero - end - _search_zero(ast) - - return real_zero, real_zero_indx, is_copied -end - -local function count_tabstop(ast, tabstop_indx) - local count = 0 - - predicate_ltr_nodes(ast, function(node) - if node.tabstop == tabstop_indx then - count = count + 1 - end - -- only stop once all nodes were looked at. - return false - end) - - return count -end - -local function text_only_placeholder(placeholder) - local only_text = true - - predicate_ltr_nodes(placeholder, function(node) - if node == placeholder then - -- ignore placeholder. - return false - end - if node.type ~= types.TEXT then - only_text = false - -- we found non-text, no need to search more. - return true - end - end) - - return only_text -end - -local function max_position(ast) - local max = 0 - predicate_ltr_nodes(ast, function(node) - local new_max = node.tabstop or 0 - if new_max > max then - max = new_max - end - -- don't stop early. - return false - end) - - return max -end - -local function replace_position(ast, p1, p2) - predicate_ltr_nodes(ast, function(node) - if node.tabstop == p1 then - node.tabstop = p2 - end - -- look at all nodes. - return false - end) -end - -function M.fix_zero(ast) - local zn, ast_child_with_0_indx, is_copied = real_zero_node(ast) - -- if zn exists, is a tabstop, an immediate child of `ast`, and does not - -- have to be copied, the snippet can be accurately represented by luasnip. - -- (also if zn just does not exist, ofc). - -- - -- If the snippet can't be represented as-is, the ast needs to be modified - -- as described below. - if - not zn - or ( - zn - and not is_copied - and (zn.type == types.TABSTOP or (zn.type == types.PLACEHOLDER and text_only_placeholder( - zn - ))) - and ast.children[ast_child_with_0_indx] == zn - ) - then - return - end - - -- bad, a choice or placeholder is at position 0. - -- replace all ${0:...} with ${n+1:...} (n highest position) - -- max_position is at least 0, all's good. - local max_pos = max_position(ast) - replace_position(ast, 0, max_pos + 1) - - -- insert $0 as a direct child to snippet, just behind the original $0/the - -- node containing it. - table.insert(ast.children, ast_child_with_0_indx + 1, Ast.tabstop(0)) -end - ----This function identifies which tabstops/placeholder/choices are copies, and ----which are "real tabstops"(/choices/placeholders). The real tabstops are ----extended with a list of their dependents (tabstop.dependents), the copies ----with their real tabstop (copy.copies) ---- ----Rules for which node of any two nodes with the same tabstop-index is the ----real tabstop: ---- - if one is a tabstop and the other a placeholder/choice, the ---- placeholder/choice is the real tabstop. ---- - if they are both tabstop or both placeholder/choice, the one which ---- appears earlier in the snippet is the real tabstop. ---- (in "${1: ${1:lel}}" the outer ${1:...} appears earlier). ---- ----@param ast table: the AST. -function M.add_dependents(ast) - -- all nodes that have a tabstop. - -- map tabstop-index (number) -> node. - local tabstops = {} - - -- nodes which copy some tabstop. - -- map tabstop-index (number) -> node[] (since there could be multiple copies of that one snippet). - local copies = {} - - predicate_ltr_nodes(ast, function(node) - if not node.tabstop then - -- not a tabstop-node -> continue. - return false - end - - if not tabstops[node.tabstop] then - tabstops[node.tabstop] = node - -- continue, we want to find all dependencies. - return false - end - if not copies[node.tabstop] then - copies[node.tabstop] = {} - end - if real_tabstop_order_less(tabstops[node.tabstop], node) then - table.insert(copies[node.tabstop], tabstops[node.tabstop]) - tabstops[node.tabstop] = node - else - table.insert(copies[node.tabstop], node) - end - -- continue. - return false - end) - - -- associate real tabstop with its copies (by storing the copies in the real tabstop). - for i, real_tabstop in pairs(tabstops) do - real_tabstop.dependents = {} - for _, copy in ipairs(copies[i] or {}) do - table.insert(real_tabstop.dependents, copy) - copy.copies = real_tabstop - end - end -end - -local function apply_modifier(text, modifier) - local mod_fn = Str.vscode_string_modifiers[modifier] - if mod_fn then - return mod_fn(text) - else - -- this can't really be reached, since only correct and available - -- modifiers are parsed successfully - -- (https://github.com/L3MON4D3/LuaSnip/blob/5fbebf6409f86bc4b7b699c2c80745e1ed190c16/lua/luasnip/util/parser/neovim_parser.lua#L239-L245). - log.warn( - "Tried to apply unknown modifier `%s` while parsing snippet, recovering by applying identity instead.", - modifier - ) - return text - end -end - -local function apply_transform_format(nodes, captures) - local transformed = "" - for _, node in ipairs(nodes) do - if node.type == types.TEXT then - transformed = transformed .. node.esc - else - local capture = captures[node.capture_index] - -- capture exists if it ..exists.. and is nonempty. - if capture and #capture > 0 then - if node.if_text then - transformed = transformed .. node.if_text - elseif node.modifier then - transformed = transformed - .. apply_modifier(capture, node.modifier) - else - transformed = transformed .. capture - end - else - if node.else_text then - transformed = transformed .. node.else_text - end - end - end - end - - return transformed -end - -function M.apply_transform(transform) - if jsregexp_compile_safe then - local reg_compiled, err = - jsregexp_compile_safe(transform.pattern, transform.option) - - if reg_compiled then - -- can be passed to functionNode! - return function(lines) - -- luasnip expects+passes lines as list, but regex needs one string. - lines = table.concat(lines, "\n") - local matches = reg_compiled(lines) - - local transformed = "" - -- index one past the end of previous match. - -- This is used to append unmatched characters to `transformed`, so - -- it's initialized such that the first append is from 1. - local prev_match_end = 0 - for _, match in ipairs(matches) do - -- begin_ind and end_ind are inclusive. - transformed = transformed - .. lines:sub(prev_match_end + 1, match.begin_ind - 1) - .. apply_transform_format( - transform.format, - match.groups - ) - - -- end-inclusive - prev_match_end = match.end_ind - end - transformed = transformed - .. lines:sub(prev_match_end + 1, #lines) - - return vim.split(transformed, "\n") - end - else - log.error( - "Failed parsing regex `%s` with options `%s`: %s", - transform.pattern, - transform.option, - err - ) - -- fall through to returning identity. - end - end - - -- without jsregexp, or without a valid regex, we cannot properly transform - -- whatever is supposed to be transformed here. - -- Just return a function that returns the to-be-transformed string - -- unmodified. - return util.id -end - ----Variables need the text which is in front of them to determine whether they ----have to be indented ("asdf\n\t$TM_SELECTED_TEXT": vscode indents all lines ----of TM_SELECTED_TEXT). ---- ----The text is accessible as ast_node.previous_text, a string[]. ----@param ast table: the AST. -function M.give_vars_previous_text(ast) - local last_text = { "" } - -- important: predicate_ltr_nodes visits the node in the order they appear, - -- textually, in the snippet. - -- This is necessary to actually ensure the variables actually get the text just in front of them. - predicate_ltr_nodes(ast, function(node) - if node.children then - -- continue if this node is not a leaf. - -- Since predicate_ltr_nodes runs fn first for the placeholder, and - -- then for its' children, `last_text` would be reset wrongfully - -- (example: "asdf\n\t${1:$TM_SELECTED_TEXT}". Here the placeholder - -- is encountered before the variable -> no indentation). - -- - -- ignoring non-leaf-nodes makes it so that only the nodes which - -- actually contribute text (placeholders are "invisible" in that - -- they don't add text themselves, they do it through their - -- children) are considered. - return false - end - if node.type == types.TEXT then - last_text = vim.split(node.esc, "\n") - elseif node.type == types.VARIABLE then - node.previous_text = last_text - else - -- reset last_text when a different node is encountered. - last_text = { "" } - end - -- continue.. - return false - end) -end - ----Variables are turned into placeholders if the Variable is undefined or not set. ----Since in luasnip, variables can be added at runtime, the decision whether a ----variable is just some text, inserts its default, or its variable-name has to ----be deferred to runtime. ----So, each variable is a dynamicNode, and needs a tabstop. ----In vscode the variables are visited ---- 1) after all other tabstops/placeholders/choices and ---- 2) in the order they appear in the snippet-body. ----We mimic this behaviour. ----@param ast table: The AST. -function M.give_vars_potential_tabstop(ast) - local last_tabstop = max_position(ast) - - predicate_ltr_nodes(ast, function(node) - if node.type == types.VARIABLE then - last_tabstop = last_tabstop + 1 - node.potential_tabstop = last_tabstop - end - end) -end - -function M.parse_order(ast) - M.add_dependents(ast) - -- build Directed Graph from ast-nodes. - -- vertices are ast-nodes, edges define has-to-be-parsed-before-relations - -- (a child of some placeholder would have an edge to it, real tabstops - -- have edges to their copies). - local g = directed_graph.new() - -- map node -> vertex. - local to_vert = {} - - -- add one vertex for each node + create map node->vert. - predicate_ltr_nodes(ast, function(node) - to_vert[node] = g:add_vertex() - end) - - predicate_ltr_nodes(ast, function(node) - if node.dependents then - -- if the node has dependents, it has to be parsed before they are. - for _, dep in ipairs(node.dependents) do - g:set_edge(to_vert[node], to_vert[dep]) - end - end - if node.children then - -- if the node has children, they have to be parsed before it can - -- be parsed. - for _, child in ipairs(node.children) do - g:set_edge(to_vert[child], to_vert[node]) - end - end - end) - - local topsort = g:topological_sort() - if not topsort then - -- ast (with additional dependencies) contains circle. - return nil - end - - local to_node = util.reverse_lookup(to_vert) - return vim.tbl_map(function(vertex) - return to_node[vertex] - end, topsort) -end - -M.types = types - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/parser/init.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/parser/init.lua deleted file mode 100644 index 31320faa..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/parser/init.lua +++ /dev/null @@ -1,141 +0,0 @@ -local sNode = require("luasnip.nodes.snippet") -local ast_parser = require("luasnip.util.parser.ast_parser") -local parse = require("luasnip.util.parser.neovim_parser").parse -local Ast = require("luasnip.util.parser.neovim_ast") -local Str = require("luasnip.util.str") -local functions = require("luasnip.util.functions") -local util = require("luasnip.util.util") -local extend_decorator = require("luasnip.util.extend_decorator") - -local M = {} - ----Parse snippet represented by `body`. ----@param context (table|string|number|nil): ---- - table|string: treated like the first argument to `ls.snippet`, ---- returns a snippet. ---- - number: Returns a snippetNode, `context` is its' jump-position. ---- - nil: Returns a flat list of luasnip-nodes, to be used however. ----@param body string: the representation of the snippet. ----@param opts table|nil: optional parameters. Valid keys: ---- - `trim_empty`: boolean, remove empty lines from the snippet. ---- - `dedent`: boolean, remove common indent from the snippet's lines. ---- - `variables`: map[string-> (fn()->string)], variables to be used only in this ---- snippet. ----@return table: the snippet, in the representation dictated by the value of ----`context`. -function M.parse_snippet(context, body, opts) - opts = opts or {} - if opts.dedent == nil then - opts.dedent = true - end - if opts.trim_empty == nil then - opts.trim_empty = true - end - - body = Str.sanitize(body) - - local lines = vim.split(body, "\n") - Str.process_multiline(lines, opts) - body = table.concat(lines, "\n") - - local ast - if body == "" then - ast = Ast.snippet({ - Ast.text(""), - }) - else - ast = parse(body) - end - - local nodes = ast_parser.to_luasnip_nodes(ast, { - var_functions = opts.variables, - }) - - if type(context) == "number" then - return sNode.SN(context, nodes) - end - if type(context) == "nil" then - return nodes - end - - if type(context) == "string" then - context = { trig = context } - end - context.docstring = body - - return sNode.S(context, nodes) -end -local function context_extend(arg, extend) - local argtype = type(arg) - if argtype == "string" then - arg = { trig = arg } - end - - if argtype == "table" then - return vim.tbl_extend("keep", arg, extend or {}) - end - - -- fall back to unchanged arg. - -- log this, probably. - return arg -end -extend_decorator.register( - M.parse_snippet, - { arg_indx = 1, extend = context_extend }, - { arg_indx = 3 } -) - -local function backticks_to_variable(body) - local var_map = {} - local variable_indx = 1 - local var_string = "" - - local processed_to = 1 - for from, to in Str.unescaped_pairs(body, "`", "`") do - local varname = "LUASNIP_SNIPMATE_VAR" .. variable_indx - var_string = var_string - -- since the first unescaped ` is at from, there is no unescaped ` - -- in body:sub(old_to, from-1). We can therefore gsub occurences of - -- \`, without worrying about potentially changing something like - -- \\` (or \\\\`) into \` (\\\`). - .. body:sub(processed_to, from - 1):gsub("\\`", "`") - -- `$varname` is unsafe, might lead to something like "my - -- snip$LUASNIP_SNIPMATE_VAR1pet", where the variable is - -- interpreted as "LUASNIP_SNIPMATE_VAR1pet". - -- This cannot happen with curly braces. - .. "${" - .. varname - .. "}" - - -- don't include backticks in vimscript. - var_map[varname] = - functions.eval_vim_dynamic(body:sub(from + 1, to - 1)) - processed_to = to + 1 - variable_indx = variable_indx + 1 - end - - -- append remaining characters. - var_string = var_string .. body:sub(processed_to, -1):gsub("\\`", "`") - - return var_map, var_string -end - -function M.parse_snipmate(context, body, opts) - local new_vars - new_vars, body = backticks_to_variable(body) - - opts = opts or {} - opts.variables = {} - for name, fn in pairs(new_vars) do - -- created dynamicNode is not interactive. - opts.variables[name] = { fn, util.no } - end - return M.parse_snippet(context, body, opts) -end -extend_decorator.register( - M.parse_snipmate, - { arg_indx = 1, extend = context_extend }, - { arg_indx = 3 } -) - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/parser/neovim_ast.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/parser/neovim_ast.lua deleted file mode 100644 index 5fcd6251..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/parser/neovim_ast.lua +++ /dev/null @@ -1,207 +0,0 @@ --- ripped out of neovim. - -local M = {} - -local node_type = { - SNIPPET = 0, - TABSTOP = 1, - PLACEHOLDER = 2, - VARIABLE = 3, - CHOICE = 4, - TRANSFORM = 5, - FORMAT = 6, - TEXT = 7, -} - -M.node_type = node_type - -local Node = {} -function Node:__tostring() - local insert_text = {} - if self.type == node_type.SNIPPET then - for _, c in ipairs(self.children) do - table.insert(insert_text, tostring(c)) - end - elseif self.type == node_type.CHOICE then - table.insert(insert_text, self.items[1]) - elseif self.type == node_type.PLACEHOLDER then - for _, c in ipairs(self.children or {}) do - table.insert(insert_text, tostring(c)) - end - elseif self.type == node_type.TEXT then - table.insert(insert_text, self.esc) - end - return table.concat(insert_text, "") -end - ---- @private -local function new(t) - return setmetatable(t, Node) -end - ----Determine whether {t} is an AST-node. ----@param t table ----@return boolean -local function is_node(t) - return getmetatable(t) == Node -end - -M.is_node = is_node - ----Create a new snippet. ----@param children (ast-node[]) Contents of the snippet. ----@return table |lsp-parser-snippet| -function M.snippet(children) - return new({ - type = node_type.SNIPPET, - children = children, - }) -end - ----Create a new tabstop. ----@param tabstop (number) Position of this tabstop. ----@param transform (table|nil) optional transform applied to the tabstop. ----@return table |lsp-parser-tabstop| -function M.tabstop(tabstop, transform) - return new({ - type = node_type.TABSTOP, - tabstop = tabstop, - transform = transform, - }) -end - ----Create a new placeholder. ----@param tabstop (number) Position of the placeholder. ----@param children (ast-node[]) Content of the placeholder. ----@return table |lsp-parser-placeholder| -function M.placeholder(tabstop, children) - return new({ - type = node_type.PLACEHOLDER, - tabstop = tabstop, - children = children, - }) -end - ----Create a new variable. ----@param name (string) Name. ----@param replacement (node[] | transform | nil) ---- - (node[]) Inserted when the variable is empty. ---- - (transform) Applied to the variable's value. ----@return table |lsp-parser-variable| -function M.variable(name, replacement) - local transform, children - -- transform is an ast-node, children a flat list of nodes. - if is_node(replacement) then - transform = replacement - else - children = replacement - end - - return new({ - type = node_type.VARIABLE, - name = name, - transform = transform, - children = children, - }) -end - ----Create a new choice. ----@param tabstop (number) Position of the choice. ----@param items (string[]) Choices. ----@return table |lsp-parser-choice| -function M.choice(tabstop, items) - return new({ - type = node_type.CHOICE, - tabstop = tabstop, - items = items, - }) -end - ----Create a new transform. ----@param pattern (string) Regex applied to the variable/tabstop this transform ---- is supplied to. ----@param format (table of Format|Text) Replacement for the regex. ----@param option (string|nil) Regex-options, default "". ----@return table |lsp-parser-transform| -function M.transform(pattern, format, option) - return new({ - type = node_type.TRANSFORM, - pattern = pattern, - format = format, - option = option or "", - }) -end - ----Create a new format which either inserts the capture at {capture_index}, ----applies a modifier to the capture or inserts {if_text} if the capture is ----nonempty, and {else_text} otherwise. ----@param capture_index (number) Capture this format is applied to. ----@param capture_transform (string | table | nil) ---- - (string): {capture_transform} is a modifier. ---- - (table): {capture_transform} can contain either of ---- - {if_text} (string) Inserted for nonempty ---- capture. ---- - {else_text} (string) Inserted for empty or ---- undefined capture. ----@return table |lsp-parser-format| -function M.format(capture_index, capture_transform) - local if_text, else_text, modifier - if type(capture_transform) == "table" then - if_text = capture_transform.if_text - else_text = capture_transform.else_text - elseif type(capture_transform) == "string" then - modifier = capture_transform - end - - return new({ - type = node_type.FORMAT, - capture_index = capture_index, - modifier = modifier, - if_text = if_text, - else_text = else_text, - }) -end - ----Create new text. ----@param esc (string) Escaped text. ----@param raw (string|nil, default {esc}) Unescaped text. ---- ----@return table |lsp-parser-text| -function M.text(esc, raw) - return new({ - type = node_type.TEXT, - esc = esc, - raw = raw or esc, - }) -end - -function M.merge_adjacent_text(ast) - if ast.children then - -- build new table of children. - local new_children = {} - -- last_child shall always point to the last entry in new_children. - local last_child - - for _, child in ipairs(ast.children) do - -- first, recurse into children. - -- When we do this is not important, since it does not change the TEXT-nodes, here is just comfortable. - M.merge_adjacent_text(child) - - if - child.type == node_type.TEXT - and last_child - and last_child.type == node_type.TEXT - then - last_child.raw = last_child.raw .. child.raw - last_child.esc = last_child.esc .. child.esc - else - table.insert(new_children, child) - last_child = child - end - end - - ast.children = new_children - end -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/parser/neovim_parser.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/parser/neovim_parser.lua deleted file mode 100644 index 5848c83f..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/parser/neovim_parser.lua +++ /dev/null @@ -1,479 +0,0 @@ --- ripped out of neovim. - -local P = {} - -local ast = require("luasnip.util.parser.neovim_ast") - ----Take characters until the target characters (The escape sequence is '\' + char) ----@param targets string[] The character list for stop consuming text. ----@param specials string[] If the character isn't contained in targets/specials, '\' will be left. ----@private -function P.take_until(targets, specials) - targets = targets or {} - specials = specials or {} - - return function(input, pos) - local new_pos = pos - local raw = {} - local esc = {} - while new_pos <= #input do - local c = string.sub(input, new_pos, new_pos) - if c == "\\" then - table.insert(raw, "\\") - new_pos = new_pos + 1 - c = string.sub(input, new_pos, new_pos) - if - not vim.tbl_contains(targets, c) - and not vim.tbl_contains(specials, c) - then - table.insert(esc, "\\") - end - table.insert(raw, c) - table.insert(esc, c) - new_pos = new_pos + 1 - else - if vim.tbl_contains(targets, c) then - break - end - table.insert(raw, c) - table.insert(esc, c) - new_pos = new_pos + 1 - end - end - - if new_pos == pos then - return P.unmatch(pos) - end - - return { - parsed = true, - value = { - raw = table.concat(raw, ""), - esc = table.concat(esc, ""), - }, - pos = new_pos, - } - end -end - ----@private -function P.unmatch(pos) - return { - parsed = false, - value = nil, - pos = pos, - } -end - ----@private -function P.map(parser, map) - return function(input, pos) - local result = parser(input, pos) - if result.parsed then - return { - parsed = true, - value = map(result.value), - pos = result.pos, - } - end - return P.unmatch(pos) - end -end - ----@private -function P.lazy(factory) - return function(input, pos) - return factory()(input, pos) - end -end - ----@private -function P.token(token) - return function(input, pos) - local maybe_token = string.sub(input, pos, pos + #token - 1) - if token == maybe_token then - return { - parsed = true, - value = maybe_token, - pos = pos + #token, - } - end - return P.unmatch(pos) - end -end - ----@private -function P.pattern(p) - return function(input, pos) - local maybe_match = string.match(string.sub(input, pos), "^" .. p) - if maybe_match then - return { - parsed = true, - value = maybe_match, - pos = pos + #maybe_match, - } - end - return P.unmatch(pos) - end -end - ----@private -function P.many(parser) - return function(input, pos) - local values = {} - local new_pos = pos - while new_pos <= #input do - local result = parser(input, new_pos) - if not result.parsed then - break - end - table.insert(values, result.value) - new_pos = result.pos - end - if #values > 0 then - return { - parsed = true, - value = values, - pos = new_pos, - } - end - return P.unmatch(pos) - end -end - ----@private -function P.any(...) - local parsers = { ... } - return function(input, pos) - for _, parser in ipairs(parsers) do - local result = parser(input, pos) - if result.parsed then - return result - end - end - return P.unmatch(pos) - end -end - ----@private -function P.opt(parser) - return function(input, pos) - local result = parser(input, pos) - return { - parsed = true, - value = result.value, - pos = result.pos, - } - end -end - ----@private -function P.seq(...) - local parsers = { ... } - return function(input, pos) - local values = {} - local new_pos = pos - for i, parser in ipairs(parsers) do - local result = parser(input, new_pos) - if result.parsed then - values[i] = result.value - new_pos = result.pos - else - return P.unmatch(pos) - end - end - return { - parsed = true, - value = values, - pos = new_pos, - } - end -end - ----see https://code.visualstudio.com/docs/editor/userdefinedsnippets#_grammar - -local S = {} -S.dollar = P.token("$") -S.open = P.token("{") -S.close = P.token("}") -S.colon = P.token(":") -S.slash = P.token("/") -S.comma = P.token(",") -S.pipe = P.token("|") -S.plus = P.token("+") -S.minus = P.token("-") -S.question = P.token("?") -S.int = P.map(P.pattern("[0-9]+"), function(value) - return tonumber(value, 10) -end) -S.var = P.pattern("[%a_][%w_]+") -S.text = function(targets, specials) - return P.map(P.take_until(targets, specials), function(value) - return ast.text(value.esc, value.raw) - end) -end -S.patterntext = function(pattern) - return P.map(P.pattern(pattern), function(value) - return ast.text(value, value) - end) -end -S.text_or_empty = function(targets, specials) - return P.map( - P.any(P.take_until(targets, specials), P.token("")), - function(value) - -- if it is empty, we have to return a valid S.text-object. - if value == "" then - return ast.text("", "") - else - return ast.text(value.esc, value.raw) - end - end - ) -end - -S.toplevel = P.lazy(function() - return P.any(S.placeholder, S.tabstop, S.variable, S.choice) -end) - -S.format = P.any( - P.map(P.seq(S.dollar, S.int), function(values) - return ast.format(values[2]) - end), - P.map(P.seq(S.dollar, S.open, S.int, S.close), function(values) - return ast.format(values[3]) - end), - P.map( - P.seq( - S.dollar, - S.open, - S.int, - S.colon, - S.slash, - P.any( - P.token("upcase"), - P.token("downcase"), - P.token("capitalize"), - P.token("camelcase"), - P.token("pascalcase") - ), - S.close - ), - function(values) - return ast.format(values[3], values[6]) - end - ), - P.map( - P.seq( - S.dollar, - S.open, - S.int, - S.colon, - P.seq( - S.question, - P.opt(P.take_until({ ":" }, { "\\" })), - S.colon, - P.opt(P.take_until({ "}" }, { "\\" })) - ), - S.close - ), - function(values) - return ast.format(values[3], { - if_text = values[5][2] and values[5][2].esc or "", - else_text = values[5][4] and values[5][4].esc or "", - }) - end - ), - P.map( - P.seq( - S.dollar, - S.open, - S.int, - S.colon, - P.seq(S.plus, P.opt(P.take_until({ "}" }, { "\\" }))), - S.close - ), - function(values) - return ast.format(values[3], { - if_text = values[5][2] and values[5][2].esc or "", - }) - end - ), - P.map( - P.seq( - S.dollar, - S.open, - S.int, - S.colon, - S.minus, - P.opt(P.take_until({ "}" }, { "\\" })), - S.close - ), - function(values) - return ast.format(values[3], { - else_text = values[6] and values[6].esc or "", - }) - end - ), - P.map( - P.seq( - S.dollar, - S.open, - S.int, - S.colon, - P.opt(P.take_until({ "}" }, { "\\" })), - S.close - ), - function(values) - return ast.format(values[3], { - else_text = values[5] and values[5].esc or "", - }) - end - ) -) - -S.transform = P.map( - P.seq( - S.slash, - P.take_until({ "/" }, { "\\" }), - S.slash, - P.many( - P.any( - S.format, - S.text({ "$", "/" }, { "\\" }), - S.patterntext("[^/]") - ) - ), - S.slash, - P.opt(P.pattern("[ig]+")) - ), - function(values) - return ast.transform(values[2].raw, values[4], values[6]) - end -) - -S.tabstop = P.any( - P.map(P.seq(S.dollar, S.int), function(values) - return ast.tabstop(values[2]) - end), - P.map(P.seq(S.dollar, S.open, S.int, S.close), function(values) - return ast.tabstop(values[3]) - end), - P.map(P.seq(S.dollar, S.open, S.int, S.transform, S.close), function(values) - return ast.tabstop(values[3], values[4]) - end) -) - -S.placeholder = P.any( - P.map( - P.seq( - S.dollar, - S.open, - S.int, - S.colon, - P.opt( - P.many( - P.any( - S.toplevel, - S.text({ "$", "}" }, { "\\" }), - S.patterntext("[^}]") - ) - ) - ), - S.close - ), - function(values) - -- no children -> manually create empty text. - return ast.placeholder(values[3], values[5] or { ast.text("") }) - end - ) -) - -S.choice = P.map( - P.seq( - S.dollar, - S.open, - S.int, - S.pipe, - P.opt( - P.many( - P.map( - P.seq(S.text_or_empty({ ",", "|" }), S.comma), - function(values) - return values[1].esc - end - ) - ) - ), - P.map(P.any(S.text_or_empty({ ",", "|" }), S.empty), function(values) - return values.esc - end), - S.pipe, - S.close - ), - function(values) - local choices = values[5] or {} - table.insert(choices, values[6]) - return ast.choice(values[3], choices) - end -) - -S.variable = P.any( - P.map(P.seq(S.dollar, S.var), function(values) - return ast.variable(values[2]) - end), - P.map(P.seq(S.dollar, S.open, S.var, S.close), function(values) - return ast.variable(values[3]) - end), - P.map(P.seq(S.dollar, S.open, S.var, S.transform, S.close), function(values) - return ast.variable(values[3], values[4]) - end), - P.map( - P.seq( - S.dollar, - S.open, - S.var, - S.colon, - P.many( - P.any( - S.toplevel, - S.text({ "$", "}" }, { "\\" }), - S.patterntext("[^}]") - ) - ), - S.close - ), - function(values) - return ast.variable(values[3], values[5]) - end - ) -) - -S.snippet = P.map( - P.many( - P.any(S.toplevel, S.text({ "$" }, { "}", "\\" }), S.patterntext(".")) - ), - function(values) - -- Insp(values) - return ast.snippet(values) - end -) - -local M = {} - ----Build the AST for {input}. ----@param input string A snippet as defined in ---- https://code.visualstudio.com/docs/editor/userdefinedsnippets#_grammar ----@return (Snippet) -function M.parse(input) - local result = S.snippet(input, 1) - if not result.parsed then - error("snippet parsing failed.") - end - - ast.merge_adjacent_text(result.value) - return result.value -end - -M.ast = ast - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/path.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/path.lua deleted file mode 100644 index 83141098..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/path.lua +++ /dev/null @@ -1,266 +0,0 @@ -local Path = {} - -local uv = vim.loop - -local sep = (function() - if jit then - local os = jit.os:lower() - if vim.tbl_contains({ "linux", "osx", "bsd" }, os) then - return "/" - else - return "\\" - end - end - return package.config:sub(1, 1) -end)() - -local root_pattern = (function() - return uv.os_uname().sysname:find("Windows") and "%w%:" or "%/" -end)() - -function Path.join(...) - return table.concat({ ... }, sep) -end - -function Path.exists(filepath) - return uv.fs_stat(filepath) and true or false -end - -function Path.async_read_file(path, callback) - uv.fs_open(path, "r", tonumber("0666", 8), function(err, fd) - assert(not err, err) - uv.fs_fstat(fd, function(err, stat) - assert(not err, err) - uv.fs_read(fd, stat.size, 0, function(err, buffer) - assert(not err, err) - uv.fs_close(fd, function(err) - assert(not err, err) - callback(buffer) - end) - end) - end) - end) -end - ----@param path string ----@return string buffer @content of file -function Path.read_file(path) - -- permissions: rrr - local fd = assert(uv.fs_open(path, "r", tonumber("0444", 8))) - local stat = assert(uv.fs_fstat(fd)) - -- read from offset 0. - local buf = assert(uv.fs_read(fd, stat.size, 0)) - uv.fs_close(fd) - - return buf -end - -local MYCONFIG_ROOT - -if vim.env.MYVIMRC then - MYCONFIG_ROOT = vim.fn.fnamemodify(vim.env.MYVIMRC, ":p:h") -else - MYCONFIG_ROOT = vim.fn.getcwd() -end - --- sometimes we don't want to resolve symlinks, but handle ~/ and ./ -function Path.expand_keep_symlink(filepath) - -- omit second return-value of :gsub - local res = filepath - :gsub("^~", vim.env.HOME) - :gsub("^[.][/\\]", MYCONFIG_ROOT .. sep) - return res -end -function Path.expand(filepath) - return uv.fs_realpath(Path.expand_keep_symlink(filepath)) -end - --- do our best at normalizing a non-existing path. -function Path.normalize_nonexisting(filepath, cwd) - cwd = cwd or vim.fn.getcwd() - - local normalized = filepath - -- replace multiple slashes by one. - :gsub(sep .. sep .. "+", sep) - -- remove trailing slash. - :gsub(sep .. "$", "") - -- remove ./ from path. - :gsub("%." .. sep, "") - - -- if not yet absolute, prepend path to current directory. - if not normalized:match("^" .. root_pattern .. "") then - normalized = Path.join(cwd, normalized) - end - - return normalized -end - -function Path.expand_nonexisting(filepath, cwd) - filepath - -- replace ~ with home-directory. - :gsub("^~", vim.env.HOME) - -- replace ./ or .\ with config-directory (likely ~/.config/nvim) - :gsub( - "^[.][/\\]", - MYCONFIG_ROOT .. sep - ) - - return Path.normalize_nonexisting(filepath, cwd) -end - --- do our best at expanding a path that may or may not exist (ie. check if it --- exists, if so do regular expand, and guess expanded path otherwise) --- Not the clearest name :/ -function Path.expand_maybe_nonexisting(filepath, cwd) - local real_expanded = Path.expand(filepath) - if not real_expanded then - real_expanded = Path.expand_nonexisting(filepath, cwd) - end - return real_expanded -end - -function Path.normalize_maybe_nonexisting(filepath, cwd) - local real_normalized = Path.normalize(filepath) - if not real_normalized then - real_normalized = Path.normalize_nonexisting(filepath, cwd) - end - return real_normalized -end - ----Return files and directories in path as a list ----@param root string ----@return string[] files, string[] directories -function Path.scandir(root) - local files, dirs = {}, {} - local fs = uv.fs_scandir(root) - if fs then - local name, type = "", "" - while name do - name, type = uv.fs_scandir_next(fs) - local path = Path.join(root, name) - -- On networked filesystems, it can happen that we get - -- a name, but no type. In this case, we must query the - -- type manually via fs_stat(). See issue: - -- https://github.com/luvit/luv/issues/660 - if name and not type then - local stat = uv.fs_stat(path) - type = stat and stat.type - end - if type == "file" then - table.insert(files, path) - elseif type == "directory" then - table.insert(dirs, path) - elseif type == "link" then - local followed_path = uv.fs_realpath(path) - if followed_path then - local stat = uv.fs_stat(followed_path) - if stat.type == "file" then - table.insert(files, path) - elseif stat.type == "directory" then - table.insert(dirs, path) - end - end - end - end - end - return files, dirs -end - ----Get basename ----@param filepath string ----@param ext boolean if true, separate the file extension ----@return string, string? ----Example: ---- Path.basename("~/.config/nvim/init.lua") -> init.lua ---- Path.basename("~/.config/nvim/init.lua", true) -> init, lua -function Path.basename(filepath, ext) - local base = filepath - if base:find(sep) then - base = base:match(("%s([^%s]+)$"):format(sep, sep)) - end - if ext then - return base:match("(.*)%.(.+)") - else - return base - end -end - -function Path.extension(fname) - return fname:match("%.([^%.]+)$") -end - -function Path.components(path) - return vim.split(path, sep, { plain = true, trimempty = true }) -end - ----Get parent of a path, without trailing separator ----if path is a directory or does not have a parent, returns nil ----Example: ---- On platforms that use "\\" backslash as path separator, e.g., Windows: ---- Path.parent("C:/project_root/file.txt") -- returns "C:/project_root" ---- Path.parent([[C:\project_root\file.txt]]) -- returns [[C:\project_root]] ---- ---- -- the followings return `nil`s ---- Path.parent("C:/") ---- Path.parent([[C:\]]) ---- Path.parent([[C:\project_root\]]) ---- ---- -- WARN: although it's unlikely that we will reach the driver's root ---- -- level, Path.parent("C:\file.txt") returns "C:", and please be ---- -- cautious when passing the parent path to some vim functions because ---- -- some vim functions on Windows treat "C:" as a file instead: ---- -- vim.fn.fnamemodify("C:", ":p") -- returns $CWD .. sep .. "C:" ---- -- To get the desired result, use vim.fn.fnamemodify("C:" .. sep, ":p") ---- ---- On platforms that use "/" forward slash as path separator, e.g., linux: ---- Path.parent("/project_root/file.txt") returns "/project_root" ---- Path.parent("/file.txt") returns "" ---- ---- -- the followings return `nil`s ---- Path.parent("/") ---- Path.parent("/project_root/") ---- ---- -- backslash in a valid filename character in linux: ---- Path.parent([[/project_root/\valid\file\name.txt]]) returns "/project_root" -Path.parent = (function() - ---@alias PathSeparator "/" | "\\" - ---@param os_sep PathSeparator - ---@return fun(string): string | nil - local function generate_parent(os_sep) - if os_sep == "/" then - ---@param path string - ---@return string | nil - return function(path) - local last_component = path:match("[/]+[^/]+$") - if not last_component then - return nil - end - - return path:sub(1, #path - #last_component) - end - else - ---@param path string - ---@return string | nil - return function(path) - local last_component = path:match("[/\\]+[^/\\]+$") - if not last_component then - return nil - end - - return path:sub(1, #path - #last_component) - end - end - end - - -- for test only - if __LUASNIP_TEST_SEP_OVERRIDE then - return generate_parent - else - return generate_parent(sep) - end -end)() - --- returns nil if the file does not exist! -Path.normalize = uv.fs_realpath - -return Path diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/pattern_tokenizer.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/pattern_tokenizer.lua deleted file mode 100644 index 8dfc1a44..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/pattern_tokenizer.lua +++ /dev/null @@ -1,137 +0,0 @@ -local is_class = { - a = true, - c = true, - d = true, - l = true, - p = true, - s = true, - u = true, - w = true, - x = true, - z = true, - -- and uppercase versions. - A = true, - C = true, - D = true, - L = true, - P = true, - S = true, - U = true, - W = true, - X = true, - Z = true, - -- all others false. -} - -local is_rep_mod = { - ["+"] = true, - ["*"] = true, - ["-"] = true, - ["?"] = true, -} - -local function is_escaped(text, indx) - local count = 0 - for i = indx - 1, 1, -1 do - if string.sub(text, i, i) == "%" then - count = count + 1 - else - break - end - end - return count % 2 == 1 -end - -local function charset_end_indx(string, start_indx) - -- set plain - local indx = string:find("]", start_indx, true) - -- find unescaped ']' - while indx and is_escaped(string, indx) do - indx = string:find("]", indx + 1, true) - end - return indx -end - -return { - tokenize = function(pattern) - local indx = 1 - local current_text = "" - local tokens = {} - -- assume the pattern starts with text (as opposed to eg. a character - -- class), worst-case an empty textNode is (unnecessarily) inserted at - -- the beginning. - local is_text = true - while indx <= #pattern do - local next_indx - local next_text - local next_is_text - -- for some atoms *,+,-,? are not applicable, ignore them. - local repeatable = true - local char = pattern:sub(indx, indx) - if char == "%" then - if pattern:sub(indx + 1, indx + 1) == "b" then - -- %b seems to consume exactly the next two chars literally. - next_is_text = false - next_indx = indx + 4 - repeatable = false - elseif is_class[pattern:sub(indx + 1, indx + 1)] then - next_is_text = false - next_indx = indx + 2 - else - -- not a class, just an escaped character. - next_is_text = true - next_indx = indx + 2 - -- only append escaped char, not '%'. - end - elseif char == "." then - next_is_text = false - next_indx = indx + 1 - elseif char == "[" then - next_is_text = false - -- if not found, just exit loop now, pattern is malformed. - next_indx = (charset_end_indx(pattern, indx) or #pattern) + 1 - elseif - char == "(" - or char == ")" - or (char == "^" and indx == 1) - then - -- ^ is interpreted literally if not at beginning. - -- $ will always be interpreted literally in triggers. - - -- remove ( and ) from text. - -- keep text or no-text active. - next_is_text = is_text - -- increase indx to exclude ( from tokens. - indx = indx + 1 - next_indx = indx - -- cannot repeat group. - repeatable = false - else - next_is_text = true - next_indx = indx + 1 - end - - if repeatable and is_rep_mod[pattern:sub(next_indx, next_indx)] then - next_indx = next_indx + 1 - next_is_text = false - end - - next_text = pattern:sub(indx, next_indx - 1) - - -- check if this token is still the same as the previous. - if next_is_text == is_text then - current_text = current_text .. next_text - else - tokens[#tokens + 1] = current_text - current_text = next_text - end - - indx = next_indx - is_text = next_is_text - end - - -- add last part, would normally be added at the end of the loop. - tokens[#tokens + 1] = current_text - return tokens - end, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/select.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/select.lua deleted file mode 100644 index decf8fb5..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/select.lua +++ /dev/null @@ -1,141 +0,0 @@ -local M = {} - -local SELECT_RAW = "LUASNIP_SELECT_RAW" -local SELECT_DEDENT = "LUASNIP_SELECT_DEDENT" -local TM_SELECT = "LUASNIP_TM_SELECT" - -function M.retrieve() - local ok, val = pcall(vim.api.nvim_buf_get_var, 0, SELECT_RAW) - if ok then - local result = { - val, - vim.api.nvim_buf_get_var(0, SELECT_DEDENT), - vim.api.nvim_buf_get_var(0, TM_SELECT), - } - - vim.api.nvim_buf_del_var(0, SELECT_RAW) - vim.api.nvim_buf_del_var(0, SELECT_DEDENT) - vim.api.nvim_buf_del_var(0, TM_SELECT) - - return unpack(result) - end - return {}, {}, {} -end - -local function get_min_indent(lines) - -- "^(%s*)%S": match only lines that actually contain text. - local min_indent = lines[1]:match("^(%s*)%S") - for i = 2, #lines do - -- %s* -> at least matches - local line_indent = lines[i]:match("^(%s*)%S") - -- ignore if not matched. - if line_indent then - -- if no line until now matched, use line_indent. - if not min_indent or #line_indent < #min_indent then - min_indent = line_indent - end - end - end - return min_indent -end - -local function store_registers(...) - local names = { ... } - local restore_data = {} - for _, name in ipairs(names) do - restore_data[name] = { - data = vim.fn.getreg(name), - type = vim.fn.getregtype(name), - } - end - return restore_data -end - -local function restore_registers(restore_data) - for name, name_restore_data in pairs(restore_data) do - vim.fn.setreg(name, name_restore_data.data, name_restore_data.type) - end -end - --- subtle: `:lua` exits VISUAL, which means that the '< '>-marks will be set correctly! --- Afterwards, we can just use lua, which does not change the mode. -M.select_keys = - [[:lua require("luasnip.util.select").pre_cut()gv"zslua require('luasnip.util.select').post_cut("z")]] - -local saved_registers -local lines -local start_line, start_col, end_line, end_col -local mode -function M.pre_cut() - -- store registers so we don't change any of them. - -- "" is affected since we perform a cut (s), 1-9 also (although :h - -- quote_number seems to state otherwise for cuts to specific registers..?). - saved_registers = - store_registers("", "1", "2", "3", "4", "5", "6", "7", "8", "9", "z") - - -- store data needed for de-indenting lines. - start_line = vim.fn.line("'<") - 1 - start_col = vim.fn.col("'<") - end_line = vim.fn.line("'>") - 1 - end_col = vim.fn.col("'>") - -- +1: include final line. - lines = vim.api.nvim_buf_get_lines(0, start_line, end_line + 1, true) - mode = vim.fn.visualmode() -end - -function M.post_cut(register_name) - -- remove trailing newline. - local chunks = vim.split(vim.fn.getreg(register_name):gsub("\n$", ""), "\n") - - -- make sure to restore the registers to the state they were before cutting. - restore_registers(saved_registers) - - local tm_select, select_dedent = vim.deepcopy(chunks), vim.deepcopy(chunks) - - local min_indent = get_min_indent(lines) or "" - if mode == "V" then - tm_select[1] = tm_select[1]:gsub("^%s+", "") - -- remove indent from all lines: - for i = 1, #select_dedent do - select_dedent[i] = select_dedent[i]:gsub("^" .. min_indent, "") - end - -- due to the trailing newline of the last line, and vim.split's - -- behaviour, the last line of `chunks` is always empty. - -- Keep this - elseif mode == "v" then - -- if selection starts inside indent, remove indent. - if #min_indent > start_col then - select_dedent[1] = lines[1]:gsub(min_indent, "") - end - for i = 2, #select_dedent - 1 do - select_dedent[i] = select_dedent[i]:gsub(min_indent, "") - end - - -- remove as much indent from the last line as possible. - if #min_indent > end_col then - select_dedent[#select_dedent] = "" - else - select_dedent[#select_dedent] = - select_dedent[#select_dedent]:gsub("^" .. min_indent, "") - end - else - -- in block: if indent is in block, remove the part of it that is inside - -- it for select_dedent. - if #min_indent > start_col then - local indent_in_block = min_indent:sub(start_col, #min_indent) - for i, line in ipairs(chunks) do - select_dedent[i] = line:gsub("^" .. indent_in_block, "") - end - end - end - - vim.api.nvim_buf_set_var(0, SELECT_RAW, chunks) - vim.api.nvim_buf_set_var(0, SELECT_DEDENT, select_dedent) - vim.api.nvim_buf_set_var(0, TM_SELECT, tm_select) - - lines = nil - start_line, start_col, end_line, end_col = nil, nil, nil, nil - mode = nil -end - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/str.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/str.lua deleted file mode 100644 index 7b8ec5f5..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/str.lua +++ /dev/null @@ -1,141 +0,0 @@ --- Some string processing utility functions -local M = {} - ----In-place dedents strings in lines. ----@param lines string[]. -local function dedent(lines) - if #lines > 0 then - local ind_size = math.huge - for i, _ in ipairs(lines) do - local i1, i2 = lines[i]:find("^%s*[^%s]") - if i1 and i2 < ind_size then - ind_size = i2 - end - end - for i, _ in ipairs(lines) do - lines[i] = lines[i]:sub(ind_size, -1) - end - end -end - ----Applies opts to lines. ----lines is modified in-place. ----@param lines string[]. ----@param options table, required, can have values: ---- - trim_empty: removes empty first and last lines. ---- - dedent: removes indent common to all lines. -function M.process_multiline(lines, options) - if options.trim_empty then - if lines[1]:match("^%s*$") then - table.remove(lines, 1) - end - if #lines > 0 and lines[#lines]:match("^%s*$") then - lines[#lines] = nil - end - end - - if options.dedent then - dedent(lines) - end -end - -function M.dedent(s) - local lst = vim.split(s, "\n") - dedent(lst) - return table.concat(lst, "\n") -end - -local function is_escaped(s, indx) - local count = 0 - for i = indx - 1, 1, -1 do - if string.sub(s, i, i) == "\\" then - count = count + 1 - else - break - end - end - return count % 2 == 1 -end - ---- return position of next (relative to `start`) unescaped occurence of ---- `target` in `s`. ----@param s string ----@param target string ----@param start number -local function find_next_unescaped(s, target, start) - while true do - local from = s:find(target, start, true) - if not from then - return nil - end - if not is_escaped(s, from) then - return from - end - start = from + 1 - end -end - ---- Creates iterator that returns all positions of substrings .* ---- in `s`, where left and right are not escaped. ---- Only complete pairs left,right are returned, an unclosed left is ignored. ----@param s string ----@param left string ----@param right string ----@return function: iterator, returns pairs from,to. -function M.unescaped_pairs(s, left, right) - local search_from = 1 - - return function() - local match_from = find_next_unescaped(s, left, search_from) - if not match_from then - return nil - end - local match_to = find_next_unescaped(s, right, match_from + 1) - if not match_to then - return nil - end - - search_from = match_to + 1 - return match_from, match_to - end -end - -function M.aupatescape(s) - if vim.fn.has("win32") or vim.fn.has("win64") then - -- windows: replace \ with / for au-pattern. - s, _ = s:gsub("\\", "/") - end - local escaped, _ = s:gsub(",", "\\,") - return vim.fn.fnameescape(escaped) -end - -function M.sanitize(str) - return str:gsub("%\r", "") -end - --- string-operations implemented according to --- https://github.com/microsoft/vscode/blob/71c221c532996c9976405f62bb888283c0cf6545/src/vs/editor/contrib/snippet/browser/snippetParser.ts#L372-L415 --- such that they can be used for snippet-transformations in vscode-snippets. -local function capitalize(str) - -- uppercase first character. - return str:gsub("^.", string.upper) -end -local function pascalcase(str) - local pascalcased = "" - for match in str:gmatch("[a-zA-Z0-9]+") do - pascalcased = pascalcased .. capitalize(match) - end - return pascalcased -end -M.vscode_string_modifiers = { - upcase = string.upper, - downcase = string.lower, - capitalize = capitalize, - pascalcase = pascalcase, - camelcase = function(str) - -- same as pascalcase, but first character lowercased. - return pascalcase(str):gsub("^.", string.lower) - end, -} - -return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/table.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/table.lua deleted file mode 100644 index 31762686..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/table.lua +++ /dev/null @@ -1,39 +0,0 @@ ----Convert set of values to a list of those values. ----@generic T ----@param tbl T|T[]|table ----@return table -local function set_to_list(tbl) - local ls = {} - - for v, _ in pairs(tbl) do - table.insert(ls, v) - end - - return ls -end - ----Convert value or list of values to a table of booleans for fast lookup. ----@generic T ----@param values T|T[]|table ----@return table -local function list_to_set(values) - if values == nil then - return {} - end - - if type(values) ~= "table" then - return { [values] = true } - end - - local list = {} - for _, v in ipairs(values) do - list[v] = true - end - - return list -end - -return { - list_to_set = list_to_set, - set_to_list = set_to_list, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/time.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/time.lua deleted file mode 100644 index 39fc9233..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/time.lua +++ /dev/null @@ -1,13 +0,0 @@ --- http://lua-users.org/wiki/TimeZone -local function get_timezone_offset(ts) - local utcdate = os.date("!*t", ts) - local localdate = os.date("*t", ts) - localdate.isdst = false -- this is the trick - local diff = os.difftime(os.time(localdate), os.time(utcdate)) - local h, m = math.modf(diff / 3600) - return string.format("%+.4d", 100 * h + 60 * m) -end - -return { - get_timezone_offset = get_timezone_offset, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/types.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/types.lua deleted file mode 100644 index a9ded11d..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/types.lua +++ /dev/null @@ -1,34 +0,0 @@ -return { - textNode = 1, - insertNode = 2, - functionNode = 3, - snippetNode = 4, - choiceNode = 5, - dynamicNode = 6, - snippet = 7, - exitNode = 8, - restoreNode = 9, - node_types = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, - names = { - "textNode", - "insertNode", - "functionNode", - "snippetNode", - "choiceNode", - "dynamicNode", - "snippet", - "exitNode", - "restoreNode", - }, - names_pascal_case = { - "TextNode", - "InsertNode", - "FunctionNode", - "SnippetNode", - "ChoiceNode", - "DynamicNode", - "Snippet", - "ExitNode", - "RestoreNode", - }, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/util.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/util.lua deleted file mode 100644 index 956eaf7a..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/fennel/luasnip/util/util.lua +++ /dev/null @@ -1,522 +0,0 @@ -local session = require("luasnip.session") - -local function get_cursor_0ind() - local c = vim.api.nvim_win_get_cursor(0) - c[1] = c[1] - 1 - return c -end - --- don't use utf-indexed column, win_set_cursor ignores these. -local function set_cursor_0ind(c) - c[1] = c[1] + 1 - vim.api.nvim_win_set_cursor(0, c) -end - --- pos: (0,0)-indexed. -local function line_chars_before(pos) - -- cur-rows are 1-indexed, api-rows 0. - local line = vim.api.nvim_buf_get_lines(0, pos[1], pos[1] + 1, false) - return string.sub(line[1], 1, pos[2]) -end - --- returns current line with text up-to and excluding the cursor. -local function get_current_line_to_cursor() - return line_chars_before(get_cursor_0ind()) -end - --- delete n chars before cursor, MOVES CURSOR -local function remove_n_before_cur(n) - local cur = get_cursor_0ind() - vim.api.nvim_buf_set_text(0, cur[1], cur[2] - n, cur[1], cur[2], { "" }) - cur[2] = cur[2] - n - set_cursor_0ind(cur) -end - --- in-place modifies the table. -local function dedent(text, indentstring) - -- 2 because 1 shouldn't contain indent. - for i = 2, #text do - text[i] = text[i]:gsub("^" .. indentstring, "") - end - return text -end - --- in-place insert indenstrig before each line. -local function indent(text, indentstring) - for i = 2, #text - 1, 1 do - -- only indent if there is actually text. - if #text[i] > 0 then - text[i] = indentstring .. text[i] - end - end - -- assuming that the last line should be indented as it is probably - -- followed by some other node, therefore isn't an empty line. - if #text > 1 then - text[#text] = indentstring .. text[#text] - end - return text -end - ---- In-place expands tabs in `text`. ---- Difficulties: ---- we cannot simply replace tabs with a given number of spaces, the tabs align ---- text at multiples of `tabwidth`. This is also the reason we need the number ---- of columns the text is already indented by (otherwise we can only start a 0). ----@param text string[], multiline string. ----@param tabwidth number, displaycolumns one tab should shift following text ---- by. ----@param parent_indent_displaycolumns number, displaycolumn this text is ---- already at. ----@return string[], `text` (only for simple nesting). -local function expand_tabs(text, tabwidth, parent_indent_displaycolumns) - for i, line in ipairs(text) do - local new_line = "" - local start_indx = 1 - while true do - local tab_indx = line:find("\t", start_indx, true) - -- if no tab found, sub till end (ie. -1). - new_line = new_line .. line:sub(start_indx, (tab_indx or 0) - 1) - if tab_indx then - -- #new_line is index of this tab in new_line. - new_line = new_line - .. string.rep( - " ", - tabwidth - - ( - (parent_indent_displaycolumns + #new_line) - % tabwidth - ) - ) - else - -- reached end of string. - break - end - start_indx = tab_indx + 1 - end - text[i] = new_line - end - return text -end - -local function tab_width() - return vim.bo.shiftwidth ~= 0 and vim.bo.shiftwidth or vim.bo.tabstop -end - -local function mark_pos_equal(m1, m2) - local p1 = vim.api.nvim_buf_get_extmark_by_id(0, session.ns_id, m1, {}) - local p2 = vim.api.nvim_buf_get_extmark_by_id(0, session.ns_id, m2, {}) - return p1[1] == p2[1] and p1[2] == p2[2] -end - -local function move_to_mark(id) - local new_cur_pos - new_cur_pos = vim.api.nvim_buf_get_extmark_by_id( - 0, - session.ns_id, - id, - { details = false } - ) - set_cursor_0ind(new_cur_pos) -end - -local function bytecol_to_utfcol(pos) - local line = vim.api.nvim_buf_get_lines(0, pos[1], pos[1] + 1, false) - -- line[1]: get_lines returns table. - return { pos[1], vim.str_utfindex(line[1] or "", pos[2]) } -end - -local function replace_feedkeys(keys, opts) - vim.api.nvim_feedkeys( - vim.api.nvim_replace_termcodes(keys, true, false, true), - -- folds are opened manually now, no need to pass t. - -- n prevents langmap from interfering. - opts or "n", - true - ) -end - --- pos: (0,0)-indexed. -local function cursor_set_keys(pos, before) - if before then - if pos[2] == 0 then - pos[1] = pos[1] - 1 - -- pos2 is set to last columnt of previous line. - -- # counts bytes, but win_set_cursor expects bytes, so all's good. - pos[2] = - #vim.api.nvim_buf_get_lines(0, pos[1], pos[1] + 1, false)[1] - else - pos[2] = pos[2] - 1 - end - end - - return "lua vim.api.nvim_win_set_cursor(0,{" - -- +1, win_set_cursor starts at 1. - .. pos[1] + 1 - .. "," - -- -1 works for multibyte because of rounding, apparently. - .. pos[2] - .. "})" - .. ":silent! foldopen!" -end - --- any for any mode. --- other functions prefixed with eg. normal have to be in that mode, the --- initial esc removes that need. -local function any_select(b, e) - -- stylua: ignore - replace_feedkeys( - -- this esc -> movement sometimes leads to a slight flicker - -- TODO: look into preventing that reliably. - -- Go into visual, then place endpoints. - -- This is to allow us to place the cursor on the \n of a line. - -- see #1158 - "" - -- open folds that contain this selection. - -- we assume that the selection is contained in at most one fold, and - -- that that fold covers b. - -- if we open the fold while visual is active, the selection will be - -- wrong, so this is necessary before we enter VISUAL. - .. cursor_set_keys(b) - -- start visual highlight and move to b again. - -- since we are now in visual, this might actually move the cursor. - .. "v" - .. cursor_set_keys(b) - -- swap to other end of selection, and move it to e. - .. "o" - .. (vim.o.selection == "exclusive" and - cursor_set_keys(e) or - -- set before - cursor_set_keys(e, true)) - .. "o_" ) -end - -local function normal_move_on_insert(new_cur_pos) - -- moving in normal and going into insert is kind of annoying, eg. when the - -- cursor is, in normal, on a tab, i will set it on the beginning of the - -- tab. There's more problems, but this is very safe. - replace_feedkeys("i" .. cursor_set_keys(new_cur_pos)) -end - -local function insert_move_on(new_cur_pos) - -- maybe feedkeys this too. - set_cursor_0ind(new_cur_pos) - vim.api.nvim_command("redraw!") -end - -local function multiline_equal(t1, t2) - for i, line in ipairs(t1) do - if line ~= t2[i] then - return false - end - end - - return #t1 == #t2 -end - -local function word_under_cursor(cur, line) - local ind_start = 1 - local ind_end = #line - - while true do - local tmp = string.find(line, "%W%w", ind_start) - if not tmp then - break - end - if tmp > cur[2] + 1 then - break - end - ind_start = tmp + 1 - end - - local tmp = string.find(line, "%w%W", cur[2] + 1) - if tmp then - ind_end = tmp - end - - return string.sub(line, ind_start, ind_end) -end - --- Put text and update cursor(pos) where cursor is byte-indexed. -local function put(text, pos) - vim.api.nvim_buf_set_text(0, pos[1], pos[2], pos[1], pos[2], text) - -- add rows - pos[1] = pos[1] + #text - 1 - -- add columns, start at 0 if no rows were added, else at old col-value. - pos[2] = (#text > 1 and 0 or pos[2]) + #text[#text] -end - ---[[ Wraps the value in a table if it's not one, makes - the first element an empty str if the table is empty]] -local function to_string_table(value) - if not value then - return { "" } - end - if type(value) == "string" then - return { value } - end - -- at this point it's a table - if #value == 0 then - return { "" } - end - -- non empty table - return value -end - --- Wrap node in a table if it is not one -local function wrap_nodes(nodes) - -- safe to assume, if nodes has a metatable, it is a single node, not a - -- table. - if getmetatable(nodes) and nodes.type then - return { nodes } - else - return nodes - end -end - -local function pos_equal(p1, p2) - return p1[1] == p2[1] and p1[2] == p2[2] -end - -local function string_wrap(lines, pos) - local new_lines = vim.deepcopy(lines) - if #new_lines == 1 and #new_lines[1] == 0 then - return { "$" .. (pos and tostring(pos) or "{}") } - end - new_lines[1] = "${" - .. (pos and (tostring(pos) .. ":") or "") - .. new_lines[1] - new_lines[#new_lines] = new_lines[#new_lines] .. "}" - return new_lines -end - --- Heuristic to extract the comment style from the commentstring -local _comments_cache = {} -local function buffer_comment_chars() - local commentstring = vim.bo.commentstring - if _comments_cache[commentstring] then - return _comments_cache[commentstring] - end - local comments = { "//", "/*", "*/" } - local placeholder = "%s" - local index_placeholder = commentstring:find(vim.pesc(placeholder)) - if index_placeholder then - index_placeholder = index_placeholder - 1 - if index_placeholder + #placeholder == #commentstring then - comments[1] = vim.trim(commentstring:sub(1, -#placeholder - 1)) - else - comments[2] = vim.trim(commentstring:sub(1, index_placeholder)) - comments[3] = vim.trim( - commentstring:sub(index_placeholder + #placeholder + 1, -1) - ) - end - end - _comments_cache[commentstring] = comments - return comments -end - -local function to_line_table(table_or_string) - local tbl = to_string_table(table_or_string) - - -- split entries at \n. - local line_table = {} - for _, str in ipairs(tbl) do - local split = vim.split(str, "\n", true) - for i = 1, #split do - line_table[#line_table + 1] = split[i] - end - end - - return line_table -end - -local function find_outer_snippet(node) - while node.parent do - node = node.parent - end - return node -end - -local function redirect_filetypes(fts) - local snippet_fts = {} - - for _, ft in ipairs(fts) do - vim.list_extend(snippet_fts, session.ft_redirect[ft]) - end - - return snippet_fts -end - -local function deduplicate(list) - vim.validate({ list = { list, "table" } }) - local ret = {} - local contains = {} - for _, v in ipairs(list) do - if not contains[v] then - table.insert(ret, v) - contains[v] = true - end - end - return ret -end - -local function get_snippet_filetypes() - local config = require("luasnip.session").config - local fts = config.ft_func() - -- add all last. - table.insert(fts, "all") - - return deduplicate(redirect_filetypes(fts)) -end - -local function pos_add(p1, p2) - return { p1[1] + p2[1], p1[2] + p2[2] } -end -local function pos_sub(p1, p2) - return { p1[1] - p2[1], p1[2] - p2[2] } -end - -local function pop_front(list) - local front = list[1] - for i = 2, #list do - list[i - 1] = list[i] - end - list[#list] = nil - return front -end - -local function sorted_keys(t) - local s = {} - local i = 1 - for k, _ in pairs(t) do - s[i] = k - i = i + 1 - end - table.sort(s) - return s -end - --- from https://www.lua.org/pil/19.3.html -local function key_sorted_pairs(t) - local sorted = sorted_keys(t) - local i = 0 - return function() - i = i + 1 - if sorted[i] == nil then - return nil - else - return sorted[i], t[sorted[i]], i - end - end -end - -local function no_region_check_wrap(fn, ...) - session.jump_active = true - -- will run on next tick, after autocommands (especially CursorMoved) for this are done. - vim.schedule(function() - session.jump_active = false - end) - return fn(...) -end - -local function id(a) - return a -end - -local function no() - return false -end - -local function yes() - return true -end - -local function reverse_lookup(t) - local rev = {} - for k, v in pairs(t) do - rev[v] = k - end - return rev -end - -local function nop() end - -local function indx_of(t, v) - for i, value in ipairs(t) do - if v == value then - return i - end - end - return nil -end - -local function ternary(cond, if_val, else_val) - if cond == true then - return if_val - else - return else_val - end -end - --- just compare two integers. -local function cmp(i1, i2) - -- lets hope this ends up as one cmp. - if i1 < i2 then - return -1 - end - if i1 > i2 then - return 1 - end - return 0 -end - --- compare two positions, <0 => pos1 pos1=pos2, >0 => pos1 > pos2. -local function pos_cmp(pos1, pos2) - -- if row is different it determines result, otherwise the column does. - return 2 * cmp(pos1[1], pos2[1]) + cmp(pos1[2], pos2[2]) -end - -return { - get_cursor_0ind = get_cursor_0ind, - set_cursor_0ind = set_cursor_0ind, - move_to_mark = move_to_mark, - normal_move_on_insert = normal_move_on_insert, - insert_move_on = insert_move_on, - any_select = any_select, - remove_n_before_cur = remove_n_before_cur, - get_current_line_to_cursor = get_current_line_to_cursor, - line_chars_before = line_chars_before, - mark_pos_equal = mark_pos_equal, - multiline_equal = multiline_equal, - word_under_cursor = word_under_cursor, - put = put, - to_string_table = to_string_table, - wrap_nodes = wrap_nodes, - pos_equal = pos_equal, - dedent = dedent, - indent = indent, - expand_tabs = expand_tabs, - tab_width = tab_width, - buffer_comment_chars = buffer_comment_chars, - string_wrap = string_wrap, - to_line_table = to_line_table, - find_outer_snippet = find_outer_snippet, - redirect_filetypes = redirect_filetypes, - get_snippet_filetypes = get_snippet_filetypes, - json_decode = vim.json.decode, - json_encode = vim.json.encode, - bytecol_to_utfcol = bytecol_to_utfcol, - pos_sub = pos_sub, - pos_add = pos_add, - deduplicate = deduplicate, - pop_front = pop_front, - key_sorted_pairs = key_sorted_pairs, - no_region_check_wrap = no_region_check_wrap, - id = id, - no = no, - yes = yes, - reverse_lookup = reverse_lookup, - nop = nop, - indx_of = indx_of, - ternary = ternary, - pos_cmp = pos_cmp, -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/doc/luasnip.txt b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/doc/luasnip.txt deleted file mode 100644 index e0ce8a2a..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/doc/luasnip.txt +++ /dev/null @@ -1,3709 +0,0 @@ -*luasnip.txt* For NVIM v0.8.0 Last change: 2024 May 24 - -============================================================================== -Table of Contents *luasnip-table-of-contents* - -1. Basics |luasnip-basics| - - Jump-Index |luasnip-basics-jump-index| - - Adding Snippets |luasnip-basics-adding-snippets| - - Snippet Insertion |luasnip-basics-snippet-insertion| -2. Node |luasnip-node| - - Api |luasnip-node-api| -3. Snippets |luasnip-snippets| - - Data |luasnip-snippets-data| -4. TextNode |luasnip-textnode| -5. InsertNode |luasnip-insertnode| -6. FunctionNode |luasnip-functionnode| -7. Node Reference |luasnip-node-reference| -8. ChoiceNode |luasnip-choicenode| -9. SnippetNode |luasnip-snippetnode| -10. IndentSnippetNode |luasnip-indentsnippetnode| -11. DynamicNode |luasnip-dynamicnode| -12. RestoreNode |luasnip-restorenode| -13. Key Indexer |luasnip-key-indexer| -14. Absolute Indexer |luasnip-absolute-indexer| -15. MultiSnippet |luasnip-multisnippet| -16. Extras |luasnip-extras| - - Lambda |luasnip-extras-lambda| - - Match |luasnip-extras-match| - - Repeat |luasnip-extras-repeat| - - Partial |luasnip-extras-partial| - - Nonempty |luasnip-extras-nonempty| - - Dynamic Lambda |luasnip-extras-dynamic-lambda| - - FMT |luasnip-extras-fmt| - - Conditions |luasnip-extras-conditions| - - On The Fly-Snippets |luasnip-extras-on-the-fly-snippets| - - select_choice |luasnip-extras-select_choice| - - Filetype-Functions |luasnip-extras-filetype-functions| - - Postfix-Snippet |luasnip-extras-postfix-snippet| - - Treesitter-Postfix-Snippet |luasnip-extras-treesitter-postfix-snippet| - - Snippet List |luasnip-extras-snippet-list| - - Snippet Location |luasnip-extras-snippet-location| -17. Extend Decorator |luasnip-extend-decorator| -18. LSP-Snippets |luasnip-lsp-snippets| - - Snipmate Parser |luasnip-lsp-snippets-snipmate-parser| - - Transformations |luasnip-lsp-snippets-transformations| -19. Variables |luasnip-variables| - - Environment Namespaces |luasnip-variables-environment-namespaces| - - LSP-Variables |luasnip-variables-lsp-variables| -20. Loaders |luasnip-loaders| - - Snippet-specific filetypes |luasnip-loaders-snippet-specific-filetypes| - - VS-Code |luasnip-loaders-vs-code| - - SNIPMATE |luasnip-loaders-snipmate| - - Lua |luasnip-loaders-lua| - - edit_snippets |luasnip-loaders-edit_snippets| -21. SnippetProxy |luasnip-snippetproxy| -22. ext_opts |luasnip-ext_opts| -23. Docstrings |luasnip-docstrings| -24. Docstring-Cache |luasnip-docstring-cache| -25. Events |luasnip-events| -26. Cleanup |luasnip-cleanup| -27. Logging |luasnip-logging| -28. Source |luasnip-source| -29. Config-Options |luasnip-config-options| -30. Troubleshooting |luasnip-troubleshooting| - - Adding Snippets |luasnip-troubleshooting-adding-snippets| -31. API |luasnip-api| -> - __ ____ - /\ \ /\ _`\ __ - \ \ \ __ __ __ \ \,\L\_\ ___ /\_\ _____ - \ \ \ __/\ \/\ \ /'__`\\/_\__ \ /' _ `\/\ \/\ '__`\ - \ \ \L\ \ \ \_\ \/\ \L\.\_/\ \L\ \/\ \/\ \ \ \ \ \L\ \ - \ \____/\ \____/\ \__/.\_\ `\____\ \_\ \_\ \_\ \ ,__/ - \/___/ \/___/ \/__/\/_/\/_____/\/_/\/_/\/_/\ \ \/ - \ \_\ - \/_/ -< - -LuaSnip is a snippet engine written entirely in Lua. It has some great features -like inserting text (`luasnip-function-node`) or nodes (`luasnip-dynamic-node`) -based on user input, parsing LSP syntax and switching nodes -(`luasnip-choice-node`). For basic setup like mappings and installing, check -the README. - -All code snippets in this help assume the following: - ->lua - local ls = require("luasnip") - local s = ls.snippet - local sn = ls.snippet_node - local isn = ls.indent_snippet_node - local t = ls.text_node - local i = ls.insert_node - local f = ls.function_node - local c = ls.choice_node - local d = ls.dynamic_node - local r = ls.restore_node - local events = require("luasnip.util.events") - local ai = require("luasnip.nodes.absolute_indexer") - local extras = require("luasnip.extras") - local l = extras.lambda - local rep = extras.rep - local p = extras.partial - local m = extras.match - local n = extras.nonempty - local dl = extras.dynamic_lambda - local fmt = require("luasnip.extras.fmt").fmt - local fmta = require("luasnip.extras.fmt").fmta - local conds = require("luasnip.extras.expand_conditions") - local postfix = require("luasnip.extras.postfix").postfix - local types = require("luasnip.util.types") - local parse = require("luasnip.util.parser").parse_snippet - local ms = ls.multi_snippet - local k = require("luasnip.nodes.key_indexer").new_key -< - -As noted in the |luasnip-loaders-lua|-section: - - - By default, the names from `luasnip.config.snip_env` - - will be used, but it’s possible to customize them by setting `snip_env` in - `setup`. -Furthermore, note that while this document assumes you have defined `ls` to be -`require("luasnip")`, it is **not** provided in the default set of variables. - - -============================================================================== -1. Basics *luasnip-basics* - -In LuaSnip, snippets are made up of `nodes`. These can contain either - -- static text (`textNode`) -- text that can be edited (`insertNode`) -- text that can be generated from the contents of other nodes (`functionNode`) -- other nodes - - `choiceNode`: allows choosing between two nodes (which might contain more - nodes) - - `restoreNode`: store and restore input to nodes -- or nodes that can be generated based on input (`dynamicNode`). - -Snippets are always created using the `s(trigger:string, -nodes:table)`-function. It is explained in more detail in |luasnip-snippets|, -but the gist is that it creates a snippet that contains the nodes specified in -`nodes`, which will be inserted into a buffer if the text before the cursor -matches `trigger` when `ls.expand` is called. - - -JUMP-INDEX *luasnip-basics-jump-index* - -Nodes that can be jumped to (`insertNode`, `choiceNode`, `dynamicNode`, -`restoreNode`, `snippetNode`) all require a "jump-index" so luasnip knows the -order in which these nodes are supposed to be visited ("jumped to"). - ->lua - s("trig", { - i(1), t"text", i(2), t"text again", i(3) - }) -< - -These indices don’t "run" through the entire snippet, like they do in -textmate-snippets (`"$1 ${2: $3 $4}"`), they restart at 1 in each nested -snippetNode: - ->lua - s("trig", { - i(1), t" ", sn(2, { - t" ", i(1), t" ", i(2) - }) - }) -< - -(roughly equivalent to the given textmate-snippet). - - -ADDING SNIPPETS *luasnip-basics-adding-snippets* - -The snippets for a given filetype have to be added to luasnip via -`ls.add_snippets(filetype, snippets)`. Snippets that should be accessible -globally (in all filetypes) have to be added to the special filetype `all`. - ->lua - ls.add_snippets("all", { - s("ternary", { - -- equivalent to "${1:cond} ? ${2:then} : ${3:else}" - i(1, "cond"), t(" ? "), i(2, "then"), t(" : "), i(3, "else") - }) - }) -< - -It is possible to make snippets from one filetype available to another using -`ls.filetype_extend`, more info on that in the section |luasnip-api|. - - -SNIPPET INSERTION *luasnip-basics-snippet-insertion* - -When a new snippet is expanded, it can be connected with the snippets that have -already been expanded in the buffer in various ways. First of all, Luasnip -distinguishes between root-snippets and child-snippets. The latter are nested -inside other snippets, so when jumping through a snippet, one may also traverse -the child-snippets expanded inside it, more or less as if the child just -contains more nodes of the parent. Root-snippets are of course characterised by -not being child-snippets. When expanding a new snippet, it becomes a child of -the snippet whose region it is expanded inside, and a root if it is not inside -any snippet’s region. If it is inside another snippet, the specific node it -is inside is determined, and the snippet then nested inside that node. - -- If that node is interactive (for example, an `insertNode`), the new snippet - will be traversed when the node is visited, as long as the - configuration-option `link_children` is enabled. If it is not enabled, it is - possible to jump from the snippet to the node, but not the other way around. -- If that node is not interactive, the snippet will be linked to the currently - active node, also such that it will not be jumped to again once it is left. - This is to prevent jumping large distances across the buffer as much as - possible. There may still be one large jump from the snippet back to the - current node it is nested inside, but that seems hard to avoid. - Thus, one should design snippets such that the regions where other snippets - may be expanded are inside `insertNodes`. - -If the snippet is not a child, but a root, it can be linked up with the roots -immediately adjacent to it by enabling `link_roots` in `setup`. Since by -default only one root is remembered, one should also set `keep_roots` if -`link_roots` is enabled. The two are separate options, since roots that are not -linked can still be reached by `ls.activate_node()`. This setup (remember -roots, but don’t jump to them) is useful for a super-tab like mapping -(`` and jump on the same key), where one would like to still enter -previous roots. Since there would almost always be more jumps if the roots are -linked, regular `` would not work almost all the time, and thus -`link_roots` has to stay disabled. - - -============================================================================== -2. Node *luasnip-node* - -Every node accepts, as its last parameter, an optional table of arguments. -There are some common ones (which are listed here), and some that only apply to -some nodes (`user_args` for function/dynamicNode). These `opts` are only -mentioned if they accept options that are not common to all nodes. - -Common opts: - -- `node_ext_opts` and `merge_node_ext_opts`: Control `ext_opts` (most likely - highlighting) of the node. Described in detail in |luasnip-ext_opts| -- `key`: The node can be reffered to by this key. Useful for either |luasnip-key-indexer| or for finding the node at runtime (See - |luasnip-snippets-api|), for example inside a `dynamicNode`. The keys - do not have to be unique across the entire lifetime of the snippet, but at any - point in time, the snippet may contain each key only once. This means it is - fine to return a keyed node from a `dynamicNode`, because even if it will be - generated multiple times, those will not be valid at the same time. -- `node_callbacks`: Define event-callbacks for this node (see - |luasnip-events|). - Accepts a table that maps an event, e.g. `events.enter` to the callback - (essentially the same as `callbacks` passed to `s`, only that there is no - first mapping from jump-index to the table of callbacks). - - -API *luasnip-node-api* - -- `get_jump_index()`: this method returns the jump-index of a node. If a node - doesn’t have a jump-index, this method returns `nil` instead. -- `get_buf_position(opts) -> {from_position, to_position}`: - Determines the range of the buffer occupied by this node. `from`- and - `to_position` are `row,column`-tuples, `0,0`-indexed (first line is 0, first - column is 0) and end-inclusive (see |api-indexing|, this is extmarks - indexing). - - `opts`: `table|nil`, options, valid keys are: - - `raw`: `bool`, default `true`. This can be used to switch between - byte-columns (`raw=true`) and visual columns (`raw=false`). This makes a - difference if the line contains characters represented by multiple bytes - in UTF, for example `ÿ`. - - -============================================================================== -3. Snippets *luasnip-snippets* - -The most direct way to define snippets is `s`: - ->lua - s({trig="trigger"}, {}) -< - -(This snippet is useless beyond serving as a minimal example) - -`s(context, nodes, opts) -> snippet` - -- `context`: Either table or a string. Passing a string is equivalent to passing - >lua - { - trig = context - } - < - The following keys are valid: - - `trig`: string, the trigger of the snippet. If the text in front of (to the - left of) the cursor when `ls.expand()` is called matches it, the snippet will - be expanded. By default, "matches" means the text in front of the cursor - matches the trigger exactly, this behaviour can be modified through - `trigEngine` - - `name`: string, can be used by e.g. `nvim-compe` to identify the snippet. - - `desc` (or `dscr`): string, description of the snippet, -separated or table for - multiple lines. - - `wordTrig`: boolean, if true, the snippet is only expanded if the word - (`[%w_]+`) before the cursor matches the trigger entirely. True by default. - - `regTrig`: boolean, whether the trigger should be interpreted as a lua pattern. - False by default. Consider setting `trigEngine` to `"pattern"` instead, it is - more expressive, and in line with other settings. - - `trigEngine`: (function|string), determines how `trig` is interpreted, and what - it means for it to "match" the text in front of the cursor. This behaviour can - be completely customized by passing a function, but the predefined ones, which - are accessible by passing their identifier, should suffice in most cases: - - `"plain"`: the default-behaviour, the trigger has to match the text before - the cursor exactly. - - `"pattern"`: the trigger is interpreted as a lua-pattern, and is a match if - `trig .. "$"` matches the line up to the cursor. Capture-groups will be - accessible as `snippet.captures`. - - `"ecma"`: the trigger is interpreted as an ECMAscript-regex, and is a - match if `trig .. "$"` matches the line up to the cursor. Capture-groups - will be accessible as `snippet.captures`. - This `trigEngine` requires `jsregexp` (see - |luasnip-lsp-snippets-transformations|) to be installed, if it - is not, this engine will behave like `"plain"`. - - `"vim"`: the trigger is interpreted as a vim-regex, and is a match if - `trig .. "$"` matches the line up to the cursor. As with the other - regex/pattern-engines, captures will be available as `snippet.captures`, - but there is one caveat: the matching is done using `matchlist`, so for - now empty-string submatches will be interpreted as unmatched, and the - corresponding `snippet.capture[i]` will be `nil` (this will most likely - change, don’t rely on this behavior). - Besides these predefined engines, it is also possible to create new ones: - Instead of a string, pass a function which satisfies `trigEngine(trigger, opts) - -> (matcher(line_to_cursor, trigger) -> whole_match, captures)` (ie. the - function receives `trig` and `trigEngineOpts` can, for example, precompile a - regex, and then returns a function responsible for determining whether the - current cursor-position (represented by the line up to the cursor) matches the - trigger (it is passed again here so engines which don’t do any - trigger-specific work (like compilation) can just return a static `matcher`), - and what the capture-groups are). The `lua`-engine, for example, can be - implemented like this: - >lua - local function matcher(line_to_cursor, trigger) - -- look for match which ends at the cursor. - -- put all results into a list, there might be many capture-groups. - local find_res = { line_to_cursor:find(trigger .. "$") } - - if #find_res > 0 then - -- if there is a match, determine matching string, and the - -- capture-groups. - local captures = {} - -- find_res[1] is `from`, find_res[2] is `to` (which we already know - -- anyway). - local from = find_res[1] - local match = line_to_cursor:sub(from, #line_to_cursor) - -- collect capture-groups. - for i = 3, #find_res do - captures[i - 2] = find_res[i] - end - return match, captures - else - return nil - end - end - - local function engine(trigger) - -- don't do any special work here, can't precompile lua-pattern. - return matcher - end - < - The predefined engines are defined in `trig_engines.lua` - , - read it for more examples. - - `trigEngineOpts`: `table`, options for the used trigEngine. The - valid options are: - - `max_len`: number, upper bound on the length of the trigger. - If this is set, the `line_to_cursor` will be truncated (from the cursor of - course) to `max_len` characters before performing the match. - This is implemented because feeding long `line_to_cursor` into eg. the - pattern-trigEngine will hurt performance quite a bit (see issue - Luasnip#1103). - This option is implemented for all `trigEngines`. - - `docstring`: string, textual representation of the snippet, specified like - `desc`. Overrides docstrings loaded from json. - - `docTrig`: string, used as `line_to_cursor` during docstring-generation. This - might be relevant if the snippet relies on specific values in the - capture-groups (for example, numbers, which won’t work with the default - `$CAPTURESN` used during docstring-generation) - - `hidden`: boolean, hint for completion-engines. If set, the snippet should not - show up when querying snippets. - - `priority`: positive number, Priority of the snippet, 1000 by default. Snippets - with high priority will be matched to a trigger before those with a lower one. - The priority for multiple snippets can also be set in `add_snippets`. - - `snippetType`: string, should be either `snippet` or `autosnippet` (ATTENTION: - singular form is used), decides whether this snippet has to be triggered by - `ls.expand()` or whether is triggered automatically (don’t forget to set - `ls.config.setup({ enable_autosnippets = true })` if you want to use this - feature). If unset it depends on how the snippet is added of which type the - snippet will be. - - `resolveExpandParams`: `fn(snippet, line_to_cursor, matched_trigger, captures) - -> table|nil`, where - - `snippet`: `Snippet`, the expanding snippet object - - `line_to_cursor`: `string`, the line up to the cursor. - - `matched_trigger`: `string`, the fully matched trigger (can be retrieved - from `line_to_cursor`, but we already have that info here :D) - - `captures`: `captures` as returned by `trigEngine`. - This function will be evaluated in `Snippet:matches()` to decide whether the - snippet can be expanded or not. Returns a table if the snippet can be expanded, - `nil` if can not. The returned table can contain any of these fields: - - `trigger`: `string`, the fully matched trigger. - - `captures`: `table`, this list could update the capture-groups from - parameter in snippet expansion. - Both `trigger` and `captures` can override the values returned via - `trigEngine`. - - `clear_region`: `{ "from": {, }, "to": {, } }`, - both (0, 0)-indexed, the region where text has to be cleared before - inserting the snippet. - - `env_override`: `map string->(string[]|string)`, override or extend - the snippet’s environment (`snip.env`) - If any of these is `nil`, the default is used (`trigger` and `captures` as - returned by `trigEngine`, `clear_region` such that exactly the trigger is - deleted, no overridden environment-variables). - A good example for the usage of `resolveExpandParams` can be found in the - implementation of `postfix` - . - - `condition`: `fn(line_to_cursor, matched_trigger, captures) -> bool`, where - - `line_to_cursor`: `string`, the line up to the cursor. - - `matched_trigger`: `string`, the fully matched trigger (can be retrieved - from `line_to_cursor`, but we already have that info here :D) - - `captures`: if the trigger is pattern, this list contains the - capture-groups. Again, could be computed from `line_to_cursor`, but we - already did so. - - `show_condition`: `f(line_to_cursor) -> bool`. - - `line_to_cursor`: `string`, the line up to the cursor. - This function is (should be) evaluated by completion engines, indicating - whether the snippet should be included in current completion candidates. - Defaults to a function returning `true`. This is different from `condition` - because `condition` is evaluated by LuaSnip on snippet expansion (and thus has - access to the matched trigger and captures), while `show_condition` is (should - be) evaluated by the completion engines when scanning for available snippet - candidates. - - `filetype`: `string`, the filetype of the snippet. This overrides the filetype - the snippet is added (via `add_snippet`) as. -- `nodes`: A single node or a list of nodes. The nodes that make up the snippet. -- `opts`: A table with the following valid keys: - - `callbacks`: Contains functions that are called upon entering/leaving a node of - this snippet. For example: to print text upon entering the _second_ node of a - snippet, `callbacks` should be set as follows: - >lua - { - -- position of the node, not the jump-index!! - -- s("trig", {t"first node", t"second node", i(1, "third node")}). - [2] = { - [events.enter] = function(node, _event_args) print("2!") end - } - } - < - To register a callback for the snippets’ own events, the key `[-1]` may be - used. More info on events in |luasnip-events| - - `child_ext_opts`, `merge_child_ext_opts`: Control `ext_opts` applied to the - children of this snippet. More info on those in the |luasnip-ext_opts|-section. - -The `opts`-table, as described here, can also be passed to e.g. `snippetNode` -and `indentSnippetNode`. It is also possible to set `condition` and -`show_condition` (described in the documentation of the `context`-table) from -`opts`. They should, however, not be set from both. - - -DATA *luasnip-snippets-data* - -Snippets contain some interesting tables during runtime: - -- `snippet.env`: Contains variables used in the LSP-protocol, for example - `TM_CURRENT_LINE` or `TM_FILENAME`. It’s possible to add customized variables - here too, check |luasnip-variables-environment-namespaces| -- `snippet.captures`: If the snippet was triggered by a pattern (`regTrig`), and - the pattern contained capture-groups, they can be retrieved here. -- `snippet.trigger`: The string that triggered this snippet. Again, only - interesting if the snippet was triggered through `regTrig`, for getting the - full match. - -These variables/tables primarily come in handy in `dynamic/functionNodes`, -where the snippet can be accessed through the immediate parent -(`parent.snippet`), which is passed to the function. (in most cases `parent == -parent.snippet`, but the `parent` of the dynamicNode is not always the -surrounding snippet, it could be a `snippetNode`). - -## Api - -- `invalidate()`: call this method to effectively remove the snippet. The - snippet will no longer be able to expand via `expand` or `expand_auto`. It - will also be hidden from lists (at least if the plugin creating the list - respects the `hidden`-key), but it might be necessary to call - `ls.refresh_notify(ft)` after invalidating snippets. -- `get_keyed_node(key)`: Returns the currently visible node associated with - `key`. - - -============================================================================== -4. TextNode *luasnip-textnode* - -The most simple kind of node; just text. - ->lua - s("trigger", { t("Wow! Text!") }) -< - -This snippet expands to - -> - Wow! Text!⎵ -< - -where ⎵ is the cursor. - -Multiline strings can be defined by passing a table of lines rather than a -string: - ->lua - s("trigger", { - t({"Wow! Text!", "And another line."}) - }) -< - -`t(text, node_opts)`: - -- `text`: `string` or `string[]` -- `node_opts`: `table`, see |luasnip-node| - - -============================================================================== -5. InsertNode *luasnip-insertnode* - -These Nodes contain editable text and can be jumped to- and from (e.g. -traditional placeholders and tabstops, like `$1` in textmate-snippets). - -The functionality is best demonstrated with an example: - ->lua - s("trigger", { - t({"After expanding, the cursor is here ->"}), i(1), - t({"", "After jumping forward once, cursor is here ->"}), i(2), - t({"", "After jumping once more, the snippet is exited there ->"}), i(0), - }) -< - -The Insert Nodes are visited in order `1,2,3,..,n,0`. (The jump-index 0 also -_has_ to belong to an `insertNode`!) So the order of InsertNode-jumps is as -follows: - -1. After expansion, the cursor is at InsertNode 1, -2. after jumping forward once at InsertNode 2, -3. and after jumping forward again at InsertNode 0. - -If no 0-th InsertNode is found in a snippet, one is automatically inserted -after all other nodes. - -The jump-order doesn’t have to follow the "textual" order of the nodes: - ->lua - s("trigger", { - t({"After jumping forward once, cursor is here ->"}), i(2), - t({"", "After expanding, the cursor is here ->"}), i(1), - t({"", "After jumping once more, the snippet is exited there ->"}), i(0), - }) -< - -The above snippet will behave as follows: - -1. After expansion, we will be at InsertNode 1. -2. After jumping forward, we will be at InsertNode 2. -3. After jumping forward again, we will be at InsertNode 0. - -An **important** (because here Luasnip differs from other snippet engines) -detail is that the jump-indices restart at 1 in nested snippets: - ->lua - s("trigger", { - i(1, "First jump"), - t(" :: "), - sn(2, { - i(1, "Second jump"), - t" : ", - i(2, "Third jump") - }) - }) -< - -as opposed to e.g. the textmate syntax, where tabstops are snippet-global: - ->snippet - ${1:First jump} :: ${2: ${3:Third jump} : ${4:Fourth jump}} -< - -(this is not exactly the same snippet of course, but as close as possible) (the -restart-rule only applies when defining snippets in lua, the above -textmate-snippet will expand correctly when parsed). - -`i(jump_index, text, node_opts)` - -- `jump_index`: `number`, this determines when this node will be jumped to (see - |luasnip-basics-jump-index|). -- `text`: `string|string[]`, a single string for just one line, a list with >1 - entries for multiple lines. - This text will be SELECTed when the `insertNode` is jumped into. -- `node_opts`: `table`, described in |luasnip-node| - -If the `jump_index` is `0`, replacing its’ `text` will leave it outside the -`insertNode` (for reasons, check out Luasnip#110). - - -============================================================================== -6. FunctionNode *luasnip-functionnode* - -Function Nodes insert text based on the content of other nodes using a -user-defined function: - ->lua - local function fn( - args, -- text from i(2) in this example i.e. { { "456" } } - parent, -- parent snippet or parent node - user_args -- user_args from opts.user_args - ) - return '[' .. args[1][1] .. user_args .. ']' - end - - s("trig", { - i(1), t '<-i(1) ', - f(fn, -- callback (args, parent, user_args) -> string - {2}, -- node indice(s) whose text is passed to fn, i.e. i(2) - { user_args = { "user_args_value" }} -- opts - ), - t ' i(2)->', i(2), t '<-i(2) i(0)->', i(0) - }) -< - -`f(fn, argnode_references, node_opts)`: - `fn`: `function(argnode_text, parent, -user_args1,...,user_argsn) -> text` - `argnode_text`: `string[][]`, the text -currently contained in the argnodes (e.g. `{{line1}, {line1, line2}}`). The -snippet indent will be removed from all lines following the first. - -- `parent`: The immediate parent of the `functionNode`. It is included here as it - allows easy access to some information that could be useful in functionNodes - (see |luasnip-snippets-data| for some examples). Many snippets access the - surrounding snippet just as `parent`, but if the `functionNode` is nested - within a `snippetNode`, the immediate parent is a `snippetNode`, not the - surrounding snippet (only the surrounding snippet contains data like `env` or - `captures`). -- `user_args`: The `user_args` passed in `opts`. Note that there may be multiple - user_args (e.g. `user_args1, ..., user_argsn`). - -`fn` shall return a string, which will be inserted as is, or a table of strings -for multiline strings, where all lines following the first will be prefixed -with the snippets’ indentation. - -- `argnode_references`: `node_reference[]|node_refernce|nil`. Either no, a - single, or multiple |luasnip-node-reference|s. Changing any of these will - trigger a re-evaluation of `fn`, and insertion of the updated text. If no node - reference is passed, the `functionNode` is evaluated once upon expansion. -- `node_opts`: `table`, see |luasnip-node|. One additional key is supported: - - `user_args`: `any[]`, these will be passed to `fn` as `user_arg1`-`user_argn`. - These make it easier to reuse similar functions, for example a functionNode - that wraps some text in different delimiters (`()`, `[]`, …). - >lua - local function reused_func(_,_, user_arg1) - return user_arg1 - end - - s("trig", { - f(reused_func, {}, { - user_args = {"text"} - }), - f(reused_func, {}, { - user_args = {"different text"} - }), - }) - < - -**Examples**: - -- Use captures from the regex trigger using a functionNode: - >lua - s({trig = "b(%d)", regTrig = true}, - f(function(args, snip) return - "Captured Text: " .. snip.captures[1] .. "." end, {}) - ) - < -- `argnodes_text` during function evaluation: - >lua - s("trig", { - i(1, "text_of_first"), - i(2, {"first_line_of_second", "second_line_of_second"}), - f(function(args, snip) - --here - -- order is 2,1, not 1,2!! - end, {2, 1} )}) - < - At `--here`, `args` would look as follows (provided no text was changed after - expansion): - >lua - args = { - {"first_line_of_second", "second_line_of_second"}, - {"text_of_first"} - } - < -- |luasnip-absolute-indexer|: - >lua - s("trig", { - i(1, "text_of_first"), - i(2, {"first_line_of_second", "second_line_of_second"}), - f(function(args, snip) - -- just concat first lines of both. - return args[1][1] .. args[2][1] - end, {ai[2], ai[1]} )}) - < - -If the function only performs simple operations on text, consider using the -`lambda` from `luasnip.extras` (See |luasnip-extras-lambda|) - - -============================================================================== -7. Node Reference *luasnip-node-reference* - -Node references are used to refer to other nodes in various parts of -luasnip’s API. For example, argnodes in functionNode, dynamicNode or lambda -are node references. These references can be either of: - -- `number`: the jump-index of the node. - This will be resolved relative to the parent of the node this is passed to. - (So, only nodes with the same parent can be referenced. This is very easy to - grasp, but also limiting) -- `key_indexer`: the key of the node, if it is present. This will come in - handy if the node that is being referred to is not in the same - snippet/snippetNode as the one the node reference is passed to. - Also, it is the proper way to refer to a non-interactive node (a - functionNode, for example) -- `absolute_indexer`: the absolute position of the node. Just like - `key_indexer`, it allows addressing non-sibling nodes, but is a bit more - awkward to handle since a path from root to node has to be determined, - whereas `key_indexer` just needs the key to match. - Due to this, `key_indexer` should be generally preferred. - (More information in |luasnip-absolute-indexer|). -- `node`: just the node. Usage of this is discouraged since it can lead to - subtle errors (for example, if the node passed here is captured in a closure - and therefore not copied with the remaining tables in the snippet; there’s a - big comment about just this in commit 8bfbd61). - - -============================================================================== -8. ChoiceNode *luasnip-choicenode* - -ChoiceNodes allow choosing between multiple nodes. - ->lua - s("trig", c(1, { - t("Ugh boring, a text node"), - i(nil, "At least I can edit something now..."), - f(function(args) return "Still only counts as text!!" end, {}) - })) -< - -`c(jump_index, choices, node_opts)` - -- `jump_index`: `number`, since choiceNodes can be jumped to, they need a - jump-index (Info in |luasnip-basics-jump-index|). -- `choices`: `node[]|node`, the choices. The first will be initialliy active. - A list of nodes will be turned into a `snippetNode`. -- `node_opts`: `table`. `choiceNode` supports the keys common to all nodes - described in |luasnip-node|, and one additional key: - - `restore_cursor`: `false` by default. If it is set, and the node that was being - edited also appears in the switched to choice (can be the case if a - `restoreNode` is present in both choice) the cursor is restored relative to - that node. The default is `false` as enabling might lead to decreased - performance. It’s possible to override the default by wrapping the - `choiceNode` constructor in another function that sets `opts.restore_cursor` to - `true` and then using that to construct `choiceNode`s: - >lua - local function restore_cursor_choice(pos, choices, opts) - if opts then - opts.restore_cursor = true - else - opts = {restore_cursor = true} - end - return c(pos, choices, opts) - end - < - -Jumpable nodes that normally expect an index as their first parameter don’t -need one inside a choiceNode; their jump-index is the same as the -choiceNodes’. - -As it is only possible (for now) to change choices from within the choiceNode, -make sure that all of the choices have some place for the cursor to stop at! - -This means that in `sn(nil, {...nodes...})` `nodes` has to contain e.g. an -`i(1)`, otherwise luasnip will just "jump through" the nodes, making it -impossible to change the choice. - ->lua - c(1, { - t"some text", -- textNodes are just stopped at. - i(nil, "some text"), -- likewise. - sn(nil, {t"some text"}) -- this will not work! - sn(nil, {i(1), t"some text"}) -- this will. - }) -< - -The active choice for a choiceNode can be changed by either calling one of -`ls.change_choice(1)` (forwards) or `ls.change_choice(-1)` (backwards), or by -calling `ls.set_choice(choice_indx)`. - -One way to easily interact with choiceNodes is binding `change_choice(1/-1)` to -keys: - ->lua - -- set keybinds for both INSERT and VISUAL. - vim.api.nvim_set_keymap("i", "", "luasnip-next-choice", {}) - vim.api.nvim_set_keymap("s", "", "luasnip-next-choice", {}) - vim.api.nvim_set_keymap("i", "", "luasnip-prev-choice", {}) - vim.api.nvim_set_keymap("s", "", "luasnip-prev-choice", {}) -< - -Apart from this, there is also a picker (see |luasnip-select_choice| where no -cycling is necessary and any choice can be selected right away, via -`vim.ui.select`. - - -============================================================================== -9. SnippetNode *luasnip-snippetnode* - -SnippetNodes directly insert their contents into the surrounding snippet. This -is useful for `choiceNode`s, which only accept one child, or `dynamicNode`s, -where nodes are created at runtime and inserted as a `snippetNode`. - -Their syntax is similar to `s`, however, where snippets require a table -specifying when to expand, `snippetNode`s, similar to `insertNode`s, expect a -jump-index. - ->lua - s("trig", sn(1, { - t("basically just text "), - i(1, "And an insertNode.") - })) -< - -`sn(jump_index, nodes, node_opts)` - -- `jump_index`: `number`, the usual |luasnip-jump-index|. -- `nodes`: `node[]|node`, just like for `s`. - Note that `snippetNode`s don’t accept an `i(0)`, so the jump-indices of the nodes - inside them have to be in `1,2,...,n`. -- `node_opts`: `table`: again, the keys common to all nodes (documented in - |luasnip-node|) are supported, but also - - `callbacks`, - - `child_ext_opts` and - - `merge_child_ext_opts`, - which are further explained in |luasnip-snippets|. - - -============================================================================== -10. IndentSnippetNode *luasnip-indentsnippetnode* - -By default, all nodes are indented at least as deep as the trigger. With these -nodes it’s possible to override that behaviour: - ->lua - s("isn", { - isn(1, { - t({"This is indented as deep as the trigger", - "and this is at the beginning of the next line"}) - }, "") - }) -< - -(Note the empty string passed to isn). - -Indent is only applied after linebreaks, so it’s not possible to remove -indent on the line where the snippet was triggered using `ISN` (That is -possible via regex triggers where the entire line before the trigger is -matched). - -Another nice use case for `ISN` is inserting text, e.g. `//` or some other -comment string before the nodes of the snippet: - ->lua - s("isn2", { - isn(1, t({"//This is", "A multiline", "comment"}), "$PARENT_INDENT//") - }) -< - -Here the `//` before `This is` is important, once again, because indent is only -applied after linebreaks. - -To enable such usage, `$PARENT_INDENT` in the indentstring is replaced by the -parent’s indent. - -`isn(jump_index, nodes, indentstring, node_opts)` - -All of these parameters except `indentstring` are exactly the same as in -|luasnip-snippetnode|. - -- `indentstring`: `string`, will be used to indent the nodes inside this - `snippetNode`. - All occurences of `"$PARENT_INDENT"` are replaced with the actual indent of - the parent. - - -============================================================================== -11. DynamicNode *luasnip-dynamicnode* - -Very similar to functionNode, but returns a snippetNode instead of just text, -which makes them very powerful as parts of the snippet can be changed based on -user input. - -`d(jump_index, function, node-references, opts)`: - -- `jump_index`: `number`, just like all jumpable nodes, its’ position in the - jump-list (|luasnip-basics-jump-index|). -- `function`: `fn(args, parent, old_state, user_args) -> snippetNode` This - function is called when the argnodes’ text changes. It should generate and - return (wrapped inside a `snippetNode`) nodes, which will be inserted at the - dynamicNode’s place. `args`, `parent` and `user_args` are also explained in - |luasnip-functionnode| - - `args`: `table of text` (`{{"node1line1", "node1line2"}, {"node2line1"}}`) - from nodes the `dynamicNode` depends on. - - `parent`: the immediate parent of the `dynamicNode`. - - `old_state`: a user-defined table. This table may contain anything; its - intended usage is to preserve information from the previously generated - `snippetNode`. If the `dynamicNode` depends on other nodes, it may be - reconstructed, which means all user input (text inserted in `insertNodes`, - changed choices) to the previous `dynamicNode` is lost. - The `old_state` table must be stored in `snippetNode` returned by - the function (`snippetNode.old_state`). - The second example below illustrates the usage of `old_state`. - - `user_args`: passed through from `dynamicNode`-opts; may have more than one - argument. -- `node_references`: `node_reference[]|node_references|nil`, - |luasnip-node-references| to the nodes the dynamicNode depends on: if any of - these trigger an update (for example, if the text inside them changes), the - `dynamicNode`s’ function will be executed, and the result inserted at the - `dynamicNode`s place. (`dynamicNode` behaves exactly the same as `functionNode` - in this regard). -- `opts`: In addition to the common |luasnip-node|-keys, there is, again, - - `user_args`, which is described in |luasnip-functionnode|. - -**Examples**: - -This `dynamicNode` inserts an `insertNode` which copies the text inside the -first `insertNode`. - ->lua - s("trig", { - t"text: ", i(1), t{"", "copy: "}, - d(2, function(args) - -- the returned snippetNode doesn't need a position; it's inserted - -- "inside" the dynamicNode. - return sn(nil, { - -- jump-indices are local to each snippetNode, so restart at 1. - i(1, args[1]) - }) - end, - {1}) - }) -< - -This snippet makes use of `old_state` to count the number of updates. - -To store/restore values generated by the `dynamicNode` or entered into -`insert/choiceNode`, consider using the shortly-introduced `restoreNode` -instead of `old_state`. - ->lua - local function count(_, _, old_state) - old_state = old_state or { - updates = 0 - } - - old_state.updates = old_state.updates + 1 - - local snip = sn(nil, { - t(tostring(old_state.updates)) - }) - - snip.old_state = old_state - return snip - end - - ls.add_snippets("all", - s("trig", { - i(1, "change to update"), - d(2, count, {1}) - }) - ) -< - -As with `functionNode`, `user_args` can be used to reuse similar `dynamicNode`- -functions. - - -============================================================================== -12. RestoreNode *luasnip-restorenode* - -This node can store and restore a snippetNode as is. This includes changed -choices and changed text. Its’ usage is best demonstrated by an example: - ->lua - s("paren_change", { - c(1, { - sn(nil, { t("("), r(1, "user_text"), t(")") }), - sn(nil, { t("["), r(1, "user_text"), t("]") }), - sn(nil, { t("{"), r(1, "user_text"), t("}") }), - }), - }, { - stored = { - -- key passed to restoreNodes. - ["user_text"] = i(1, "default_text") - } - }) -< - -Here the text entered into `user_text` is preserved upon changing choice. - -`r(jump_index, key, nodes, node_opts)`: - -- `jump_index`, when to jump to this node. -- `key`, `string`: `restoreNode`s with the same key share their content. -- `nodes`, `node[]|node`: the content of the `restoreNode`. - Can either be a single node, or a table of nodes (both of which will be - wrapped inside a `snippetNode`, except if the single node already is a - `snippetNode`). - The content for a given key may be defined multiple times, but if the - contents differ, it’s undefined which will actually be used. - If a key’s content is defined in a `dynamicNode`, it will not be initially - used for `restoreNodes` outside that `dynamicNode`. A way around this - limitation is defining the content in the `restoreNode` outside the - `dynamicNode`. - -The content for a key may also be defined in the `opts`-parameter of the -snippet-constructor, as seen in the example above. The `stored`-table accepts -the same values as the `nodes`-parameter passed to `r`. If no content is -defined for a key, it defaults to the empty `insertNode`. - -An important-to-know limitation of `restoreNode` is that, for a given key, only -one may be visible at a time. See this issue - for details. - -The `restoreNode` is especially useful for storing input across updates of a -`dynamicNode`. Consider this: - ->lua - local function simple_restore(args, _) - return sn(nil, {i(1, args[1]), i(2, "user_text")}) - end - - s("rest", { - i(1, "preset"), t{"",""}, - d(2, simple_restore, 1) - }) -< - -Every time the `i(1)` in the outer snippet is changed, the text inside the -`dynamicNode` is reset to `"user_text"`. This can be prevented by using a -`restoreNode`: - ->lua - local function simple_restore(args, _) - return sn(nil, {i(1, args[1]), r(2, "dyn", i(nil, "user_text"))}) - end - - s("rest", { - i(1, "preset"), t{"",""}, - d(2, simple_restore, 1) - }) -< - -Now the entered text is stored. - -`restoreNode`s indent is not influenced by `indentSnippetNodes` right now. If -that really bothers you feel free to open an issue. - - -============================================================================== -13. Key Indexer *luasnip-key-indexer* - -A very flexible way of referencing nodes (|luasnip-node-reference|). While the -straightforward way of addressing nodes via their |luasnip-jump-index| suffices -in most cases, a `dynamic/functionNode` can only depend on nodes in the same -snippet(Node), its siblings (since the index is interpreted as relative to -their parent). Accessing a node with a different parent is thus not possible. -Secondly, and less relevant, only nodes that actually have a jump-index can be -referred to (a `functionNode`, for example, cannot be depended on). Both of -these restrictions are lifted with `key_indexer`: It allows addressing nodes by -their key, which can be set when the node is constructed, and is wholly -independent of the nodes’ position in the snippet, thus enabling descriptive -labeling. - -The following snippets demonstrate the issue and the solution by using -`key_indexer`: - -First, the addressed problem of referring to nodes outside the `functionNode`s -parent: - ->lua - s("trig", { - i(1), c(2, { - sn(nil, { - t"cannot access the argnode :(", - f(function(args) - return args[1] - end, {???}) -- can't refer to i(1), since it isn't a sibling of `f`. - }), - t"sample_text" - }) - }) -< - -And the solution: first give the node we want to refer to a key, and then pass -the same to the `functionNode`. - ->lua - s("trig", { - i(1, "", {key = "i1-key"}), c(2, { - sn(nil, { i(1), - t"can access the argnode :)", - f(function(args) - return args[1] - end, k("i1-key") ) - }), - t"sample_text" - }) - }) -< - - -============================================================================== -14. Absolute Indexer *luasnip-absolute-indexer* - -`absolute_indexer` allows accessing nodes by their unique jump-index path from -the snippet-root. This makes it almost as powerful as |luasnip-key-indexer|, -but again removes the possibility of referring to non-jumpable nodes and makes -it all a bit more error-prone since the jump-index paths are hard to follow, -and (unfortunately) have to be a bit verbose (see the long example of -`absolute_indexer`-positions below). Consider just using |luasnip-key-indexer| -instead. - -(The solution-snippet from |luasnip-key-indexer|, but using `ai` instead.) - ->lua - s("trig", { - i(1), c(2, { - sn(nil, { i(1), - t"can access the argnode :)", - f(function(args) - return args[1] - end, ai(1) ) - }), - t"sample_text" - }) - }) -< - -There are some quirks in addressing nodes: - ->lua - s("trig", { - i(2), -- ai[2]: indices based on jump-index, not position. - sn(1, { -- ai[1] - i(1), -- ai[1][1] - t"lel", -- not addressable. - i(2) -- ai[1][2] - }), - c(3, { -- ai[3] - i(nil), -- ai[3][1] - t"lel", -- ai[3][2]: choices are always addressable. - }), - d(4, function() -- ai[4] - return sn(nil, { -- ai[4][0] - i(1), -- ai[4][0][1] - }) - end, {}), - r(5, "restore_key", -- ai[5] - i(1) -- ai[5][0][1]: restoreNodes always store snippetNodes. - ), - r(6, "restore_key_2", -- ai[6] - sn(nil, { -- ai[6][0] - i(1) -- ai[6][0][1] - }) - ) - }) -< - -Note specifically that the index of a dynamicNode differs from that of the -generated snippetNode, and that restoreNodes (internally) always store a -snippetNode, so even if the restoreNode only contains one node, that node has -to be accessed as `ai[restoreNodeIndx][0][1]`. - -`absolute_indexer`s’ can be constructed in different ways: - -- `ai[1][2][3]` -- `ai(1, 2, 3)` -- `ai{1, 2, 3}` - -are all the same node. - - -============================================================================== -15. MultiSnippet *luasnip-multisnippet* - -There are situations where it might be comfortable to access a snippet in -different ways. For example, one might want to enable auto-triggering in -regions where the snippets usage is common, while leaving it manual-only in -others. This is where `ms` should be used: A single snippet can be associated -with multiple `context`s (the `context`-table determines the conditions under -which a snippet may be triggered). This has the advantage (compared with just -registering copies) that all `context`s are backed by a single snippet, and not -multiple, and it’s (at least should be :D) more comfortable to use. - -`ms(contexts, nodes, opts) -> addable`: - -- `contexts`: table containing list of `contexts`, and some keywords. - `context` are described in |luasnip-snippets|, here they may also be tables - or strings. - So far, there is only one valid keyword: - - `common`: Accepts yet another context. - The options in `common` are applied to (but don’t override) the other - contexts specified in `contexts`. -- `nodes`: List of nodes, exactly like in |luasnip-snippets|. -- `opts`: Table, options for this function: - - `common_opts`: The snippet-options (see also |luasnip-snippets|) applied - to the snippet generated from `nodes`. - -The returned object is an `addable`, something which can be passed to -`add_snippets`, or returned from the lua-loader. - -**Examples**: - ->lua - ls.add_snippets("all", { - ms({"a", "b"}, {t"a or b"}) - }) -< - ->lua - ls.add_snippets("all", { - ms({ - common = {snippetType = "autosnippet"}, - "a", - "b" - }, { - t"a or b (but autotriggered!!)" - }) - }) -< - ->lua - ls.add_snippets("all", { - ms({ - common = {snippetType = "autosnippet"}, - {trig = "a", snippetType = "snippet"}, - "b", - {trig = "c", condition = function(line_to_cursor) - return line_to_cursor == "" - end} - }, { - t"a or b (but autotriggered!!)" - }) - }) -< - - -============================================================================== -16. Extras *luasnip-extras* - - -LAMBDA *luasnip-extras-lambda* - -A shortcut for `functionNode`s that only do very basic string manipulation. - -`l(lambda, argnodes)`: - -- `lambda`: An object created by applying string-operations to `l._n`, objects - representing the `n`th argnode. - For example: - - `l._1:gsub("a", "e")` replaces all occurences of "a" in the text of the - first argnode with "e", or - - `l._1 .. l._2` concatenates text of the first and second argnode. - If an argnode contains multiple lines of text, they are concatenated with - `"\n"` prior to any operation. -- `argnodes`, a |luasnip-node-reference|, just like in function- and - dynamicNode. - -There are many examples for `lambda` in `Examples/snippets.lua` - - -MATCH *luasnip-extras-match* - -`match` can insert text based on a predicate (again, a shorthand for -`functionNode`). - -`match(argnodes, condition, then, else)`: - -- `argnode`: A single |luasnip-node-reference|. May not be nil, or - a table. -- `condition` may be either of - - `string`: interpreted as a lua pattern. Matched on the `\n`-joined (in case - it’s multiline) text of the first argnode (`args[1]:match(condition)`). - - `function`: `fn(args, snip) -> bool`: takes the same parameters as the - `functionNode`-function, any value other than nil or false is interpreted - as a match. - - `lambda`: `l._n` is the `\n`-joined text of the nth argnode. - Useful if string manipulations have to be performed before the string is matched. - Should end with `match`, but any other truthy result will be interpreted - as matching. -- `then` is inserted if the condition matches, -- `else` if it does not. - -Both `then` and `else` can be either text, lambda or function (with the same -parameters as specified above). `then`’s default-value depends on the -`condition`: - -- `pattern`: Simply the return value from the `match`, e.g. the entire match, - or, if there were capture groups, the first capture group. -- `function`: the return value of the function if it is either a string, or a - table (if there is no `then`, the function cannot return a table containing - something other than strings). -- `lambda`: Simply the first value returned by the lambda. - -Examples: - -- `match(n, "^ABC$", "A")`. -- `match(n, lambda._1:match(lambda._1:reverse()), "PALINDROME")` - >lua - s("trig", { - i(1), t":", - i(2), t"::", - m({1, 2}, l._1:match("^"..l._2.."$"), l._1:gsub("a", "e")) - }) - < -- >lua - s("extras1", { - i(1), t { "", "" }, m(1, "^ABC$", "A") - }) - < - Inserts "A" if the node with jump-index `n` matches "ABC" exactly, nothing - otherwise. -- >lua - s("extras2", { - i(1, "INPUT"), t { "", "" }, m(1, l._1:match(l._1:reverse()), "PALINDROME") - }) - < - Inserts `"PALINDROME"` if i(1) contains a palindrome. -- >lua - s("extras3", { - i(1), t { "", "" }, i(2), t { "", "" }, - m({ 1, 2 }, l._1:match("^" .. l._2 .. "$"), l._1:gsub("a", "e")) - }) - < - This inserts the text of the node with jump-index 1, with all occurences of `a` - replaced with `e`, if the second insertNode matches the first exactly. - - -REPEAT *luasnip-extras-repeat* - -Inserts the text of the passed node. - -`rep(node_reference)` - `node_reference`, a single |luasnip-node-reference|. - ->lua - s("extras4", { i(1), t { "", "" }, extras.rep(1) }) -< - - -PARTIAL *luasnip-extras-partial* - -Evaluates a function on expand and inserts its value. - -`partial(fn, params...)` - `fn`: any function - `params`: varargs, any, will be -passed to `fn`. - -For example `partial(os.date, "%Y")` inserts the current year on expansion. - ->lua - s("extras5", { extras.partial(os.date, "%Y") }) -< - - -NONEMPTY *luasnip-extras-nonempty* - -Inserts text if the referenced node doesn’t contain any text. - -`nonempty(node_reference, not_empty, empty)`: - -- `node_reference`, a single |luasnip-node-reference|. -- `not_empty`, `string`: inserted if the node is not empty. -- `empty`, `string`: inserted if the node is empty. - ->lua - s("extras6", { i(1, ""), t { "", "" }, extras.nonempty(1, "not empty!", "empty!") }) -< - - -DYNAMIC LAMBDA *luasnip-extras-dynamic-lambda* - -Pretty much the same as lambda, but it inserts the resulting text as an -insertNode, and, as such, it can be quickly overridden. - -`dynamic_lambda(jump_indx, lambda, node_references)` - `jump_indx`, as usual, -the jump-indx. - -The remaining arguments carry over from lambda. - ->lua - s("extras7", { i(1), t { "", "" }, extras.dynamic_lambda(2, l._1 .. l._1, 1) }) -< - - -FMT *luasnip-extras-fmt* - -Authoring snippets can be quite clunky, especially since every second node is -probably a `textNode`, inserting a small number of characters between two more -complicated nodes. - -`fmt` can be used to define snippets in a much more readable way. This is -achieved by borrowing (as the name implies) from `format`-functionality (our -syntax is very similar to python’s -). - -`fmt` accepts a string and a table of nodes. Each occurrence of a delimiter -pair in the string is replaced by one node from the table, while text outside -the delimiters is turned into textNodes. - -Simple example: - ->lua - ls.add_snippets("all", { - -- important! fmt does not return a snippet, it returns a table of nodes. - s("example1", fmt("just an {iNode1}", { - iNode1 = i(1, "example") - })), - s("example2", fmt([[ - if {} then - {} - end - ]], { - -- i(1) is at nodes[1], i(2) at nodes[2]. - i(1, "not now"), i(2, "when") - })), - s("example3", fmt([[ - if <> then - <> - end - ]], { - -- i(1) is at nodes[1], i(2) at nodes[2]. - i(1, "not now"), i(2, "when") - }, { - delimiters = "<>" - })), - s("example4", fmt([[ - repeat {a} with the same key {a} - ]], { - a = i(1, "this will be repeat") - }, { - repeat_duplicates = true - })) - }) -< - -One important detail here is that the position of the delimiters does not, in -any way, correspond to the jump-index of the nodes! - -`fmt(format:string, nodes:table of nodes, opts:table|nil) -> table of nodes` - -- `format`: a string. Occurences of `{}` ( `{}` are customizable; more - on that later) are replaced with `content[]` (which should be a - node), while surrounding text becomes `textNode`s. - To escape a delimiter, repeat it (`"{{"`). - If no key is given (`{}`) are numbered automatically: - `"{} ? {} : {}"` becomes `"{1} ? {2} : {3}"`, while - `"{} ? {3} : {}"` becomes `"{1} ? {3} : {4}"` (the count restarts at each - numbered placeholder). - If a key appears more than once in `format`, the node in - `content[]` is inserted for the first, and copies of it for - subsequent occurences. -- `nodes`: just a table of nodes. -- `opts`: optional arguments: - - `delimiters`: string, two characters. Change `{}` to some other pair, e.g. - `"<>"`. - - `strict`: Warn about unused nodes (default true). - - `trim_empty`: remove empty (`"%s*"`) first and last line in `format`. Useful - when passing multiline strings via `[[]]` (default true). - - `dedent`: remove indent common to all lines in `format`. Again, makes - passing multiline-strings a bit nicer (default true). - - `repeat_duplicates`: repeat nodes when a key is reused instead of copying - the node if it has a jump-index, refer to |luasnip-basics-jump-index| to - know which nodes have a jump-index (default false). - -There is also `require("luasnip.extras.fmt").fmta`. This only differs from -`fmt` by using angle brackets (`<>`) as the default delimiter. - - -CONDITIONS *luasnip-extras-conditions* - -This module (`luasnip.extras.condition`) contains functions that can be passed -to a snippet’s `condition` or `show_condition`. These are grouped accordingly -into `luasnip.extras.conditions.expand` and `luasnip.extras.conditions.show`: - -**expand**: - -- `line_begin`: only expand if the cursor is at the beginning of the line. - -**show**: - -- `line_end`: only expand at the end of the line. -- `has_selected_text`: only expand if there’s selected text stored after pressing - `store_selection_keys`. - -Additionally, `expand` contains all conditions provided by `show`. - - -CONDITION OBJECTS ~ - -`luasnip.extras.conditions` also contains condition objects. These can, just -like functions, be passed to `condition` or `show_condition`, but can also be -combined with each other into logical expressions: - -- `-c1 -> not c1` -- `c1 * c2 -> c1 and c2` -- `c1 + c2 -> c1 or c2` -- `c1 - c2 -> c1 and not c2`: This is similar to set differences: - `A \ B = {a in A | a not in B}`. This makes `-(a + b) = -a - b` an identity - representing de Morgan’s law: `not (a or b) = not a and not b`. However, - since boolean algebra lacks an additive inverse, `a + (-b) = a - b` does not - hold. Thus, this is NOT the same as `c1 + (-c2)`. -- `c1 ^ c2 -> c1 xor(!=) c2` -- `c1 % c2 -> c1 xnor(==) c2`: This decision may seem weird, considering how - there is an overload for the `==`-operator. Unfortunately, it’s not possible - to use this for our purposes (some info - here ), - so we decided to make use of a more obscure symbol (which will hopefully avoid - false assumptions about its meaning). - -This makes logical combinations of conditions very readable. Compare - ->lua - condition = conditions.expand.line_end + conditions.expand.line_begin -< - -with the more verbose - ->lua - condition = function(...) return conditions.expand.line_end(...) or conditions.expand.line_begin(...) end -< - -The conditions provided in `show` and `expand` are already condition objects. -To create new ones, use -`require("luasnip.extras.conditions").make_condition(condition_fn)` - - -ON THE FLY-SNIPPETS *luasnip-extras-on-the-fly-snippets* - -Sometimes it’s desirable to create snippets tailored for exactly the current -situation. For example inserting repetitive, but just slightly different -invocations of some function, or supplying data in some schema. - -On-the-fly snippets enable exactly this use case: they can be quickly created -and expanded with as little disruption as possible. - -Since they should mainly fast to write and don’t necessarily need all bells -and whistles, they don’t make use of lsp/textmate-syntax, but a more -simplistic one: - -- `$anytext` denotes a placeholder (`insertNode`) with text "anytext". The text - also serves as a unique key: if there are multiple placeholders with the same - key, only the first will be editable, the others will just mirror it. -- … That’s it. `$` can be escaped by preceding it with a second `$`, all other - symbols will be interpreted literally. - -There is currently only one way to expand on-the-fly snippets: -`require('luasnip.extras.otf').on_the_fly("")` will interpret -whatever text is in the register `` as a snippet, and expand it -immediately. The idea behind this mechanism is that it enables a very immediate -way of supplying and retrieving (expanding) the snippet: write the snippet-body -into the buffer, cut/yank it into some register, and call -`on_the_fly("")` to expand the snippet. - -Here’s one set of example keybindings: - ->vim - " in the first call: passing the register is optional since `on_the_fly` - " defaults to the unnamed register, which will always contain the previously cut - " text. - vnoremap "eclua require('luasnip.extras.otf').on_the_fly("e") - inoremap lua require('luasnip.extras.otf').on_the_fly("e") -< - -Obviously, `` is arbritary and can be changed to any other key combo. -Another interesting application is allowing multiple on-the-fly snippets at the -same time by retrieving snippets from multiple registers: - ->vim - " For register a - vnoremap a "aclua require('luasnip.extras.otf').on_the_fly() - inoremap a lua require('luasnip.extras.otf').on_the_fly("a") - - - " For register b - vnoremap a "bc:lua require('luasnip.extras.otf').on_the_fly() - inoremap b lua require('luasnip.extras.otf').on_the_fly("b") -< - - -SELECT_CHOICE *luasnip-extras-select_choice* - -It’s possible to leverage `vim.ui.select` for selecting a choice directly, -without cycling through the available choices. All that is needed for this is -calling `require("luasnip.extras.select_choice")`, most likely via some -keybind, e.g. - ->vim - inoremap lua require("luasnip.extras.select_choice")() -< - -while inside a choiceNode. The `opts.kind` hint for `vim.ui.select` will be set -to `luasnip`. - - -FILETYPE-FUNCTIONS *luasnip-extras-filetype-functions* - -Contains some utility functions that can be passed to the `ft_func` or -`load_ft_func`-settings. - -- `from_filetype`: the default for `ft_func`. Simply returns the filetype(s) of - the buffer. -- `from_cursor_pos`: uses treesitter to determine the filetype at the cursor. - With that, it’s possible to expand snippets in injected regions, as long as - the treesitter parser supports them. If this is used in conjuction with - `lazy_load`, extra care must be taken that all the filetypes that can be - expanded in a given buffer are also returned by `load_ft_func` (otherwise their - snippets may not be loaded). This can easily be achieved with `extend_load_ft`. -- `extend_load_ft`: `fn(extend_ft:map) -> fn` A simple solution to the problem - described above is loading more filetypes than just that of the target buffer - when `lazy_load`ing. This can be done ergonomically via `extend_load_ft`: - calling it with a table where the keys are filetypes, and the values are the - filetypes that should be loaded additionaly returns a function that can be - passed to `load_ft_func` and takes care of extending the filetypes properly. - >lua - ls.setup({ - load_ft_func = - -- Also load both lua and json when a markdown-file is opened, - -- javascript for html. - -- Other filetypes just load themselves. - require("luasnip.extras.filetype_functions").extend_load_ft({ - markdown = {"lua", "json"}, - html = {"javascript"} - }) - }) - < - - -POSTFIX-SNIPPET *luasnip-extras-postfix-snippet* - -Postfix snippets, famously used in rust analyzer - and various IDEs, are a type of snippet -which alters text before the snippet’s trigger. While these can be -implemented using regTrig snippets, this helper makes the process easier in -most cases. - -The simplest example, which surrounds the text preceeding the `.br` with -brackets `[]`, looks like: - ->lua - postfix(".br", { - f(function(_, parent) - return "[" .. parent.snippet.env.POSTFIX_MATCH .. "]" - end, {}), - }) -< - -and is triggered with `xxx.br` and expands to `[xxx]`. - -Note the `parent.snippet.env.POSTFIX_MATCH` in the function node. This is -additional field generated by the postfix snippet. This field is generated by -extracting the text matched (using a configurable matching string, see below) -from before the trigger. In the case above, the field would equal `"xxx"`. This -is also usable within dynamic nodes. - -This field can also be used within lambdas and dynamic nodes. - ->lua - postfix(".br", { - l("[" .. l.POSTFIX_MATCH .. "]"), - }) -< - ->lua - postfix(".brd", { - d(1, function (_, parent) - return sn(nil, {t("[" .. parent.env.POSTFIX_MATCH .. "]")}) - end) - }) -< - -The arguments to `postfix` are identical to the arguments to `s` but with a few -extra options. - -The first argument can be either a string or a table. If it is a string, that -string will act as the trigger, and if it is a table it has the same valid keys -as the table in the same position for `s` except: - -- `wordTrig`: This key will be ignored if passed in, as it must always be - false for postfix snippets. -- `match_pattern`: The pattern that the line before the trigger is matched - against. The default match pattern is `"[%w%.%_%-]+$"`. Note the `$`. This - matches since only the line _up until_ the beginning of the trigger is - matched against the pattern, which makes the character immediately - preceeding the trigger match as the end of the string. - -Some other match strings, including the default, are available from the postfix -module. `require("luasnip.extras.postfix).matches`: - -- `default`: `[%w%.%_%-%"%']+$` -- `line`: `^.+$` - -The second argument is identical to the second argument for `s`, that is, a -table of nodes. - -The optional third argument is the same as the third (`opts`) argument to the -`s` function, but with one difference: - -The postfix snippet works using a callback on the pre_expand event of the -snippet. If you pass a callback on the pre_expand event (structure example -below) it will get run after the builtin callback. - ->lua - { - callbacks = { - [-1] = { - [events.pre_expand] = function(snippet, event_args) - -- function body to match before the dot - -- goes here - end - } - } - } -< - - -TREESITTER-POSTFIX-SNIPPET *luasnip-extras-treesitter-postfix-snippet* - -Instead of triggering a postfix-snippet when some pattern matches in front of -the trigger, it might be useful to match if some specific treesitter-nodes -surround/are in front of the trigger. While this functionality can also be -implemented by a cusutom `resolveExpandParams`, this helper simplifies the -common cases. - -This matching of treesitter-nodes can be done either - -- by providing a query and the name of the capture that should be in front of - the trigger (in most cases, the complete match, but requiring specific nodes - before/after the matched node may be useful as well), or -- by providing a function that manually walks the node-tree, and returns the - node in front of the trigger on success (for increased flexibility). - -A simple example, which surrounds the previous node’s text preceeding the -`.mv` with `std::move()` in cpp files, looks like: - ->lua - local treesitter_postfix = require("luasnip.extras.treesitter_postfix").treesitter_postfix - - treesitter_postfix({ - trig = ".mv", - matchTSNode = { - query = [[ - [ - (call_expression) - (identifier) - (template_function) - (subscript_expression) - (field_expression) - (user_defined_literal) - ] @prefix - ]] - query_lang = "cpp" - }, - },{ - f(function(_, parent) - local node_content = table.concat(parent.snippet.env.LS_TSMATCH, '\n') - local replaced_content = ("std::move(%s)"):format(node_content) - return vim.split(ret_str, "\n", { trimempty = false }) - end) - }) -< - -`LS_TSMATCH` is the treesitter-postfix equivalent to `POSTFIX_MATCH`, and is -populated with the match (in this case the text of a treesitter-node) in front -of the trigger. - -The arguments to `treesitter_postfix` are identical to the arguments to `s` but -with a few extra options. - -The first argument has to be a table, which defines at least `trig` and -`matchTSNode`. All keys from the regular `s` may be set here (except for -`wordTrig`, which will be ignored), and additionally the following: - -- `reparseBuffer`, `string?`: Sometimes the trigger may interfere with - treesitter recognizing queries correctly. With this option, the trigger may - either be removed from the live-buffer (`"live"`), from a copy of the buffer - (`"copy"`), or not at all (`nil`). -- `matchTSNode`: How to determine whether there is a matching node in front of - the cursor. There are two options: - - `fun(parser: LuaSnip.extra.TSParser, pos: { [1]: number, [2]: number }): LuaSnip.extra.NamedTSMatch?, TSNode? Manually determine whether there is a matching node that ends just before`pos`(the beginning of the trigger). Return`nil,nil`if there is no match, otherwise first return a table mapping names to nodes (the text, position and type of these will be provided via`snip.env`), and second the node that is the matched node. - - `LuaSnip.extra.MatchTSNodeOpts`, which represents a query and provides all - captures of the matched pattern in `NamedTSMatch`. It contains the following - options: - - `query`, `string`: The query, in textual form. - - `query_name`, `string`: The name of the runtime-query to be used (passed - to `query.get()`), defaults to `"luasnip"` (so one could create a - file which only contains queries used by luasnip, like - `$CONFDIR/queries//luasnip.scm`, which might make sense to define - general concepts independent of a single snippet). - `query` and `query_name` are mutually exclusive, only one of both shall be - defined. - - `query_lang`, `string`: The language of the query. This is the only - required parameter to this function, since there’s no sufficiently - straightforward way to determine the language of the query for us. - Consider using `extend_override` to define a `ts_postfix`-function that - automatically fills in the language for the filetype of the snippet-file. - - `match_captures`, `string|string[]`: The capture(s) to use for determining - the actual prefix (so the node that should be immediately in front of the - trigger). This defaults to just `"prefix"`. - - `select`, `string?|fun(): LuaSnip.extra.MatchSelector`: Since there may be - multiple matching captures in front of the cursor, there has to be some - way to select the node that will actually be used. - If this is a string, it has to be one of "any", "shortest", or "longest", - which mean that any, the shortest, or the longest match is used. - If it is a function, it must return a table with two fields, `record` and - `retrieve`. `record` is called with a TSMatch and a potential node for the - ts-match, and may return `true` to abort the selection-procedure. - `retrieve` must return either a TSMatch-TSNode-tuple (which is used as the - match) or `nil`, to signify that there is no match. - `lua/luasnip/extras/_treesitter.lua` contains the table - `builtin_tsnode_selectors`, which contains the implementations for - any/shortest/longest, which can be used as examples for more complicated - custom-selectors. - -The text of the matched node can be accessed as `snip.env.LS_TSMATCH`. The text -of the nodes returned as `NamedTSMatch` can be accessed as -`snip.env.LS_TSCAPTURE_`, and their range and type as -`snip.env.LS_TSDATA..range/type` (where range is a tuple -of row-col-tuples, both 0-indexed). - -For a query like - ->scm - (function_declaration - name: (identifier) @fname - parameters: (parameters) @params - body: (block) @body - ) @prefix -< - -matched against - ->lua - function add(a, b) - return a + b - end -< - -`snip.env` would contain: - -- `LS_TSMATCH`: `{ "function add(a, b)", "\treturn a + b", "end" }` -- `LS_TSDATA`: - >lua - { - body = { - range = { { 1, 1 }, { 1, 13 } }, - type = "block" - }, - fname = { - range = { { 0, 9 }, { 0, 12 } }, - type = "identifier" - }, - params = { - range = { { 0, 12 }, { 0, 18 } }, - type = "parameters" - }, - prefix = { - range = { { 0, 0 }, { 2, 3 } }, - type = "function_declaration" - } - } - < -- `LS_TSCAPTURE_FNAME`: `{ "add" }` -- `LS_TSCAPTURE_PARAMS`: `{ "(a, b)" }` -- `LS_TSCAPTURE_BODY`: `{ "return a + b" }` -- `LS_TSCAPTURE_PREFIX`: `{ "function add(a, b)", "\treturn a + b", "end" }` - -(note that all variables containing text of nodes are string-arrays, one entry -for each line) - -There is one important caveat when accessing `LS_TSDATA` in -function/dynamicNodes: It won’t contain the values as specified here while -generating docstrings (in fact, it won’t even be a table). Since docstrings -have to be generated without any runtime-information, we just have to provide -dummy-data in `env`, which will be some kind of string related to the name of -the env-variable. Since the structure of `LS_TSDATA` obviously does not fit -that model, we can’t really handle it in a nice way (at least yet). So, for -now, best include a check like `local static_evaluation = type(env.LS_TSDATA) -== "string"`, and behave accordingly if `static_evaluation` is true (for -example, return some value tailored for displaying it in a docstring). - -One more example, which actually uses a few captures: - ->lua - ts_post({ - matchTSNode = { - query = [[ - (function_declaration - name: (identifier) @fname - parameters: (parameters) @params - body: (block) @body - ) @prefix - ]], - query_lang = "lua", - }, - trig = ".var" - }, fmt([[ - local {} = function{} - {} - end - ]], { - l(l.LS_TSCAPTURE_FNAME), - l(l.LS_TSCAPTURE_PARAMS), - l(l.LS_TSCAPTURE_BODY), - })) -< - -The module `luasnip.extras.treesitter_postfix` contains a few functions that -may be useful for creating more efficient ts-postfix-snippets. Nested in -`builtin.tsnode_matcher` are: - -- `fun find_topmost_types(types: string[]): MatchTSNodeFunc`: Generates - a `LuaSnip.extra.MatchTSNodeFunc` which returns the last parent whose type - is in `types`. -- `fun find_first_types(types: string[]): MatchTSNodeFunc`: Similar to - `find_topmost_types`, only this one matches the first parent whose type is in - types. -- `find_nth_parent(n: number): MatchTSNodeFunc`: Simply matches the `n`-th - parent of the innermost node infront of the trigger. - -With `find_topmost_types`, the first example can be implemented more -efficiently (without needing a whole query): - ->lua - local postfix_builtin = require("luasnip.extras.treesitter_postfix").builtin - - ls.add_snippets("all", { - ts_post({ - matchTSNode = postfix_builtin.tsnode_matcher.find_topmost_types({ - "call_expression", - "identifier", - "template_function", - "subscript_expression", - "field_expression", - "user_defined_literal" - }), - trig = ".mv" - }, { - l(l_str.format("std::move(%s)", l.LS_TSMATCH)) - }) - }, {key = "asdf"}) -< - - -SNIPPET LIST *luasnip-extras-snippet-list* - ->lua - local sl = require("luasnip.extras.snippet_list") -< - -Makes an `open` function available to use to open currently available snippets -in a different buffer/window/tab. - -`sl.open(opts:table|nil)` - -- `opts`: optional arguments: - - `snip_info`: `snip_info(snippet) -> table representation of snippet` - - `printer`: `printer(snippets:table) -> any` - - `display`: `display(snippets:any)` - -Benefits include: syntax highlighting, searching, and customizability. - -Simple Example: - ->lua - sl.open() -< - -Customization Examples: - ->lua - -- making our own snip_info - local function snip_info(snippet) - return { name = snippet.name } - end - - -- using it - sl.open({snip_info = snip_info}) -< - ->lua - -- making our own printer - local function printer(snippets) - local res = "" - - for ft, snips in pairs(snippets) do - res = res .. ft .. "\n" - for _, snip in pairs(snips) do - res = res .. " " .. "Name: " .. snip.name .. "\n" - res = res .. " " .. "Desc: " .. snip.description[1] .. "\n" - res = res .. " " .. "Trigger: " .. snip.trigger .. "\n" - res = res .. " ----" .. "\n" - end - end - - return res - end - - - -- using it - sl.open({printer = printer}) -< - ->lua - -- making our own display - local function display(printer_result) - -- right vertical split - vim.cmd("botright vnew") - - -- get buf and win handle - local buf = vim.api.nvim_get_current_buf() - local win = vim.api.nvim_get_current_win() - - -- setting window and buffer options - vim.api.nvim_win_set_option(win, "foldmethod", "manual") - vim.api.nvim_buf_set_option(buf, "filetype", "javascript") - - vim.api.nvim_buf_set_option(buf, "buftype", "nofile") - vim.api.nvim_buf_set_option(buf, "bufhidden", "wipe") - vim.api.nvim_buf_set_option(buf, "buflisted", false) - - vim.api.nvim_buf_set_name(buf, "Custom Display buf " .. buf) - - -- dump snippets - local replacement = vim.split(printer_result) - vim.api.nvim_buf_set_lines(buf, 0, 0, false, replacement) - end - - -- using it - sl.open({display = display}) -< - -There is a **caveat** with implementing your own printer and/or display -function. The **default** behavior for the printer function is to return a -string representation of the snippets. The display function uses the results -from the printer function, therefore by **default** the display function is -expecting that result to be a string. - -However, this doesn’t have to be the case. For example, you can implement -your own printer function that returns a table representation of the snippets -**but** you would have to then implement your own display function or some -other function in order to return the result as a string. - -An `options` table, which has some core functionality that can be used to -customize 'common' settings, is provided. - -- `sl.options`: options table: - - `display`: `display(opts:table|nil) -> function(printer_result:string)` - -You can see from the example above that making a custom display is a fairly -involved process. What if you just wanted to change a buffer option like the -name or just the filetype? This is where `sl.options.display` comes in. It -allows you to customize buffer and window options while keeping the default -behavior. - -`sl.options.display(opts:table|nil) -> function(printer_result:string)` - -- `opts`: optional arguments: - - `win_opts`: `table which has a {window_option = value} form` - - `buf_opts`: `table which has a {buffer_option = value} form` - - `get_name`: `get_name(buf) -> string` - -Let’s recreate the custom display example above: - ->lua - -- keeping the default display behavior but modifying window/buffer - local modified_default_display = sl.options.display({ - buf_opts = {filetype = "javascript"}, - win_opts = {foldmethod = "manual"}, - get_name = function(buf) return "Custom Display buf " .. buf end - }) - - -- using it - sl.open({display = modified_default_display}) -< - - -SNIPPET LOCATION *luasnip-extras-snippet-location* - -This module can consume a snippets |luasnip-source|, more specifically, jump to -the location referred by it. This is primarily implemented for snippet which -got their source from one of the loaders, but might also work for snippets -where the source was set manually. - -`require("luasnip.extras.snip_location")`: - -- `snip_location.jump_to_snippet(snip, opts)` - Jump to the definition of `snip`. - - `snip`: a snippet with attached source-data. - - `opts`: `nil|table`, optional arguments, valid keys are: - - `hl_duration_ms`: `number`, duration for which the definition should be highlighted, - in milliseconds. 0 disables the highlight. - - `edit_fn`: `function(file)`, this function will be called with the file - the snippet is located in, and is responsible for jumping to it. - We assume that after it has returned, the current buffer contains `file`. -- `snip_location.jump_to_active_snippet(opts)` - Jump to definition of active snippet. - - `opts`: `nil|table`, accepts the same keys as the `opts`-parameter of - `jump_to_snippet`. - - -============================================================================== -17. Extend Decorator *luasnip-extend-decorator* - -Most of luasnip’s functions have some arguments to control their behaviour. -Examples include `s`, where `wordTrig`, `regTrig`, … can be set in the first -argument to the function, or `fmt`, where the delimiter can be set in the third -argument. This is all good and well, but if these functions are often used with -non-default settings, it can become cumbersome to always explicitly set them. - -This is where the `extend_decorator` comes in: it can be used to create -decorated functions which always extend the arguments passed directly with -other previously defined ones. - -An example: - ->lua - local fmt = require("luasnip.extras.fmt").fmt - - fmt("{}", {i(1)}) -- -> list of nodes, containing just the i(1). - - -- when authoring snippets for some filetype where `{` and `}` are common, they - -- would always have to be escaped in the format-string. It might be preferable - -- to use other delimiters, like `<` and `>`. - - fmt("<>", {i(1)}, {delimiters = "<>"}) -- -> same as above. - - -- but it's quite annoying to always pass the `{delimiters = "<>"}`. - - -- with extend_decorator: - local fmt_angle = ls.extend_decorator.apply(fmt, {delimiters = "<>"}) - fmt_angle("<>", {i(1)}) -- -> same as above. - - -- the same also works with other functions provided by luasnip, for example all - -- node/snippet-constructors and `parse_snippet`. -< - -`extend_decorator.apply(fn, ...)` requires that `fn` is previously registered -via `extend_decorator.register`. (This is not limited to LuaSnip’s functions; -although, for usage outside of LuaSnip, best copy the source file: -`/lua/luasnip/util/extend_decorator.lua`). - -`register(fn, ...)`: - -- `fn`: the function. -- `...`: any number of tables. Each specifies how to extend an argument of `fn`. - The tables accept: - - arg_indx, `number` (required): the position of the parameter to override. - - extend, `fn(arg, extend_value) -> effective_arg` (optional): this function - is used to extend the args passed to the decorated function. - It defaults to a function which just extends the the arg-table with the - extend table (accepts `nil`). - This extend behaviour is adaptable to accomodate `s`, where the first - argument may be string or table. - -`apply(fn, ...) -> decorated_fn`: - -- `fn`: the function to decorate. -- `...`: The values to extend with. These should match the descriptions passed - in `register` (the argument first passed to `register` will be extended with - the first value passed here). - -One more example for registering a new function: - ->lua - local function somefn(arg1, arg2, opts1, opts2) - -- not important - end - - -- note the reversed arg_indx!! - extend_decorator.register(somefn, {arg_indx=4}, {arg_indx=3}) - local extended = extend_decorator.apply(somefn, - {key = "opts2 is extended with this"}, - {key = "and opts1 with this"}) - extended(...) -< - - -============================================================================== -18. LSP-Snippets *luasnip-lsp-snippets* - -LuaSnip is capable of parsing LSP-style snippets using -`ls.parser.parse_snippet(context, snippet_string, opts)`: - ->lua - ls.parser.parse_snippet({trig = "lsp"}, "$1 is ${2|hard,easy,challenging|}") -< - -`context` can be: - `string|table`: treated like the first argument to `ls.s`, -`parse_snippet` returns a snippet. - `number`: `parse_snippet` returns a -snippetNode, with the position `context`. - `nil`: `parse_snippet` returns a -flat table of nodes. This can be used like `fmt`. - -Nested placeholders(`"${1:this is ${2:nested}}"`) will be turned into -choiceNodes with: - the given snippet(`"this is ${1:nested}"`) and - an empty -insertNode - -This behaviour can be modified by changing `parser_nested_assembler` in -`ls.setup()`. - -LuaSnip will also modify some snippets that it is incapable of representing -accurately: - -- if the `$0` is a placeholder with something other than just text inside -- if the `$0` is a choice -- if the `$0` is not an immediate child of the snippet (it could be inside a - placeholder: `"${1: $0 }"`) - -To remedy those incompatibilities, the invalid `$0` will be replaced with a -tabstop/placeholder/choice which will be visited just before the new `$0`. This -new `$0` will be inserted at the (textually) earliest valid position behind the -invalid `$0`. - -`opts` can contain the following keys: - `trim_empty`: boolean, remove empty -lines from the snippet. Default true. - `dedent`: boolean, remove common indent -from the snippet’s lines. Default true. - -Both `trim_empty` and `dedent` will be disabled for snippets parsed via -`ls.lsp_expand`: it might prevent correct expansion of snippets sent by lsp. - - -SNIPMATE PARSER *luasnip-lsp-snippets-snipmate-parser* - -It is furthermore possible to parse SnipMate snippets (this includes support -for vimscript-evaluation!!) - -SnipMate snippets need to be parsed with a different function, -`ls.parser.parse_snipmate`: - ->lua - ls.parser.parse_snipmate("year", "The year is `strftime('%Y')`") -< - -`parse_snipmate` accepts the same arguments as `parse_snippet`, only the -snippet body is parsed differently. - - -TRANSFORMATIONS *luasnip-lsp-snippets-transformations* - -To apply Variable/Placeholder-transformations -, -luasnip needs to apply ECMAScript regexes. This is implemented by relying on -`jsregexp` . - -The easiest (but potentially error-prone) way to install it is by calling `make -install_jsregexp` in the repo root. - -This process can be automated by `packer.nvim`: - ->lua - use { "L3MON4D3/LuaSnip", run = "make install_jsregexp" } -< - -If this fails, first open an issue :P, and then try installing the -`jsregexp`-luarock. This is also possible via `packer.nvim`, although actual -usage may require a small workaround, see here - or here -. - -Alternatively, `jsregexp` can be cloned locally, `make`d, and the resulting -`jsregexp.so` placed in some place where nvim can find it (probably -`~/.config/nvim/lua/`). - -If `jsregexp` is not available, transformations are replaced by a simple copy. - - -============================================================================== -19. Variables *luasnip-variables* - -All `TM_something`-variables are supported with two additions: `LS_SELECT_RAW` -and `LS_SELECT_DEDENT`. These were introduced because `TM_SELECTED_TEXT` is -designed to be compatible with VSCode’s behavior, which can be -counterintuitive when the snippet can be expanded at places other than the -point where selection started (or when doing transformations on selected text). -Besides those we also provide `LS_TRIGGER` which contains the trigger of the -snippet, and `LS_CAPTURE_n` (where n is a positive integer) that contains the -n-th capture when using a regex with capture groups as `trig` in the snippet -definition. - -All variables can be used outside of lsp-parsed snippets as their values are -stored in a snippets’ `snip.env`-table: - ->lua - s("selected_text", f(function(args, snip) - local res, env = {}, snip.env - table.insert(res, "Selected Text (current line is " .. env.TM_LINE_NUMBER .. "):") - for _, ele in ipairs(env.LS_SELECT_RAW) do table.insert(res, ele) end - return res - end, {})) -< - -To use any `*SELECT*` variable, the `store_selection_keys` must be set via -`require("luasnip").config.setup({store_selection_keys=""})`. In this -case, hitting `` while in visual mode will populate the `*SELECT*`-vars -for the next snippet and then clear them. - - -ENVIRONMENT NAMESPACES *luasnip-variables-environment-namespaces* - -You can also add your own variables by using the `ls.env_namespace(name, opts)` -where: - -- `name`: `string` the names the namespace, can’t contain the character “_” -- `opts` is a table containing (in every case `EnvVal` is the same as `string|list[string]`: - - `vars`: `(fn(name:string)->EnvVal) | map[string, EnvVal]` - Is a function that receives a string and returns a value for the var with that name - or a table from var name to a value - (in this case, if the value is a function it will be executed lazily once per snippet expansion). - - `init`: `fn(info: table)->map[string, EnvVal]` Returns - a table of variables that will set to the environment of the snippet on expansion, - use this for vars that have to be calculated in that moment or that depend on each other. - The `info` table argument contains `pos` (0-based position of the cursor on expansion), - the `trigger` of the snippet and the `captures` list. - - `eager`: `list[string]` names of variables that will be taken from `vars` and appended eagerly (like those in init) - - `multiline_vars`: `(fn(name:string)->bool)|map[sting, bool]|bool|string[]` Says if certain vars are a table or just a string, - can be a function that get’s the name of the var and returns true if the var is a key, - a list of vars that are tables or a boolean for the full namespace, it’s false by default. Refer to - issue#510 for more information. - -The four fields of `opts` are optional but you need to provide either `init` or -`vars`, and `eager` can’t be without `vars`. Also, you can’t use namespaces -that override default vars. - -A simple example to make it more clear: - ->lua - local function random_lang() - return ({"LUA", "VIML", "VIML9"})[math.floor(math.random()/2 + 1.5)] - end - - ls.env_namespace("MY", {vars={ NAME="LuaSnip", LANG=random_lang }}) - - -- then you can use $MY_NAME and $MY_LANG in your snippets - - ls.env_namespace("SYS", {vars=os.getenv, eager={"HOME"}}) - - -- then you can use $SYS_HOME which was eagerly initialized but also $SYS_USER (or any other system environment var) in your snippets - - lsp.env_namespace("POS", {init=function(info) return {VAL=vim.inspect(info.pos)} end}) - - -- then you can use $POS_VAL in your snippets - - s("custom_env", d(1, function(args, parent) - local env = parent.snippet.env - return sn(nil, t { - "NAME: " .. env.MY_NAME, - "LANG: " .. env.MY_LANG, - "HOME: " .. env.SYS_HOME, - "USER: " .. env.SYS_USER, - "VAL: " .. env.POS_VAL - }) - end, {})) -< - - -LSP-VARIABLES *luasnip-variables-lsp-variables* - -All variables, even ones added via `env_namespace`, can be accessed in LSP -snippets as `$VAR_NAME`. - -The lsp-spec states: - ------------------------------------------------------------------------------- -With `$name` or `${name:default}` you can insert the value of a variable. When -a variable isn’t set, its default or the empty string is inserted. When a -variable is unknown (that is, its name isn’t defined) the name of the -variable is inserted and it is transformed into a placeholder. - ------------------------------------------------------------------------------- -The above necessiates a differentiation between `unknown` and `unset` -variables: - -For LuaSnip, a variable `VARNAME` is `unknown` when `env.VARNAME` returns `nil` -and `unset` if it returns an empty string. - -Consider this when adding env-variables which might be used in LSP snippets. - - -============================================================================== -20. Loaders *luasnip-loaders* - -Luasnip is capable of loading snippets from different formats, including both -the well-established VSCode and SnipMate format, as well as plain Lua files for -snippets written in Lua. - -All loaders (except the vscode-standalone-loader) share a similar interface: -`require("luasnip.loaders.from_{vscode,snipmate,lua}").{lazy_,}load(opts:table|nil)` - -where `opts` can contain the following keys: - -- `paths`: List of paths to load. Can be a table, or a single - comma-separated string. - The paths may begin with `~/` or `./` to indicate that the path is - relative to your `$HOME` or to the directory where your `$MYVIMRC` resides - (useful to add your snippets). - If not set, `runtimepath` is searched for - directories that contain snippets. This procedure differs slightly for - each loader: - - `lua`: the snippet-library has to be in a directory named - `"luasnippets"`. - - `snipmate`: similar to lua, but the directory has to be `"snippets"`. - - `vscode`: any directory in `runtimepath` that contains a - `package.json` contributing snippets. -- `lazy_paths`: behaves essentially like `paths`, with two exceptions: if it is - `nil`, it does not default to `runtimepath`, and the paths listed here do not - need to exist, and will be loaded on creation. - LuaSnip will do its best to determine the path that this should resolve to, - but since the resolving we do is not very sophisticated it may produce - incorrect paths. Definitely check the log if snippets are not loaded as - expected. -- `exclude`: List of languages to exclude, empty by default. -- `include`: List of languages to include, includes everything by default. -- `{override,default}_priority`: These keys are passed straight to the - `add_snippets`-calls (documented in |luasnip-api|) and can therefore change the - priority of snippets loaded from some colletion (or, in combination with - `{in,ex}clude`, only some of its snippets). -- `fs_event_providers`: `table?`, specifies which mechanisms - should be used to watch files for updates/creation. - If `autocmd` is set to `true`, a `BufWritePost`-hook watches files of this - collection, if `libuv` is set, the file-watcher-api exposed by libuv is used - to watch for updates. - Use `libuv` if you want snippets to update from other neovim-instances, and - `autocmd` if the collection resides on a filesystem where the libuv-watchers - may not work correctly. Or, of course, just enable both :D - By default, only `autocmd` is enabled. - -While `load` will immediately load the snippets, `lazy_load` will defer loading -until the snippets are actually needed (whenever a new buffer is created, or -the filetype is changed luasnip actually loads `lazy_load`ed snippets for the -filetypes associated with this buffer. This association can be changed by -customizing `load_ft_func` in `setup`: the option takes a function that, passed -a `bufnr`, returns the filetypes that should be loaded (`fn(bufnr) -> filetypes -(string[])`)). - -All of the loaders support reloading, so simply editing any file contributing -snippets will reload its snippets (according to `fs_event_providers` in the -instance where the file was edited, or in other instances as well). - -As an alternative (or addition) to automatic reloading, luasnip can also -process manual updates to files: Call -`require("luasnip.loaders").reload_file(path)` to reload the file at `path`. -This may be useful when the collection is controlled by some other plugin, or -when enabling the other reload-mechanisms is for some reason undesirable -(performance? minimalism?). - -For easy editing of these files, LuaSnip provides a `vim.ui.select`-based -dialog (|luasnip-loaders-edit_snippets|) where first the filetype, and then the -file can be selected. - - -SNIPPET-SPECIFIC FILETYPES *luasnip-loaders-snippet-specific-filetypes* - -Some loaders (vscode,lua) support giving snippets generated in some file their -own filetype (vscode via `scope`, lua via the underlying `filetype`-option for -snippets). These snippet-specific filetypes are not considered when determining -which files to `lazy_load` for some filetype, this is exclusively determined by -the `language` associated with a file in vscodes’ `package.json`, and the -file/directory-name in lua. - -- This can be resolved relatively easily in vscode, where the `language` - advertised in `package.json` can just be a superset of the `scope`s in the file. -- Another simplistic solution is to set the language to `all` (in lua, it might - make sense to create a directory `luasnippets/all/*.lua` to group these files - together). -- Another approach is to modify `load_ft_func` to load a custom filetype if the - snippets should be activated, and store the snippets in a file for that - filetype. This can be used to group snippets by e.g. framework, and load them - once a file belonging to such a framework is edited. - -**Example**: `react.lua` - ->lua - return { - s({filetype = "css", trig = ...}, ...), - s({filetype = "html", trig = ...}, ...), - s({filetype = "js", trig = ...}, ...), - } -< - -`luasnip_config.lua` - ->lua - load_ft_func = function(bufnr) - if "" then - -- will load `react.lua` for this buffer - return {"react"} - else - return require("luasnip.extras.filetype_functions").from_filetype_load - end - end -< - -See the |luasnip-troubleshooting-adding-snippets-loaders| section if one is -having issues adding snippets via loaders. - - -VS-CODE *luasnip-loaders-vs-code* - -As a reference on the structure of these snippet libraries, see -`friendly-snippets` . - -We support a small extension: snippets can contain LuaSnip-specific options in -the `luasnip`-table: - ->json - "example1": { - "prefix": "options", - "body": [ - "whoa! :O" - ], - "luasnip": { - "priority": 2000, - "autotrigger": true, - "wordTrig": false - } - } -< - -Files with the extension `jsonc` will be parsed as `jsonc`, json with comments -, while -`*.json` are parsed with a regular `json` parser, where comments are -disallowed. (the json-parser is a bit faster, so don’t default to `jsonc` if -it’s not necessary). - -**Example**: - -`~/.config/nvim/my_snippets/package.json`: - ->json - { - "name": "example-snippets", - "contributes": { - "snippets": [ - { - "language": [ - "all" - ], - "path": "./snippets/all.json" - }, - { - "language": [ - "lua" - ], - "path": "./lua.json" - } - ] - } - } -< - -`~/.config/nvim/my_snippets/snippets/all.json`: - ->json - { - "snip1": { - "prefix": "all1", - "body": [ - "expands? jumps? $1 $2 !" - ] - }, - "snip2": { - "prefix": "all2", - "body": [ - "multi $1", - "line $2", - "snippet$0" - ] - } - } -< - -`~/.config/nvim/my_snippets/lua.json`: - ->json - { - "snip1": { - "prefix": "lua", - "body": [ - "lualualua" - ] - } - } -< - -This collection can be loaded with any of - ->lua - -- don't pass any arguments, luasnip will find the collection because it is - -- (probably) in rtp. - require("luasnip.loaders.from_vscode").lazy_load() - -- specify the full path... - require("luasnip.loaders.from_vscode").lazy_load({paths = "~/.config/nvim/my_snippets"}) - -- or relative to the directory of $MYVIMRC - require("luasnip.loaders.from_vscode").load({paths = "./my_snippets"}) -< - - -STANDALONE ~ - -Beside snippet-libraries provided by packages, vscode also supports another -format which can be used for project-local snippets, or user-defined snippets, -`.code-snippets`. - -The layout of these files is almost identical to that of the package-provided -snippets, but there is one additional field supported in the -snippet-definitions, `scope`, with which the filetype of the snippet can be -set. If `scope` is not set, the snippet will be added to the global filetype -(`all`). - -`require("luasnip.loaders.from_vscode").load_standalone(opts)` - -- `opts`: `table`, can contain the following keys: - - `path`: `string`, Path to the `*.code-snippets`-file that should be loaded. - Just like the paths in `load`, this one can begin with a `"~/"` to be - relative to `$HOME`, and a `"./"` to be relative to the - neovim-config-directory. - - `{override,default}_priority`: These keys are passed straight to the - `add_snippets`-calls (documented in |luasnip-api|) and can be used to change - the priority of the loaded snippets. - - `lazy`: `boolean`, if it is set, the file does not have to exist when - `load_standalone` is called, and it will be loaded on creation. - `false` by default. - -**Example**: `a.code-snippets`: - ->jsonc - { - // a comment, since `.code-snippets` may contain jsonc. - "c/cpp-snippet": { - "prefix": [ - "trigger1", - "trigger2" - ], - "body": [ - "this is $1", - "my snippet $2" - ], - "description": "A description of the snippet.", - "scope": "c,cpp" - }, - "python-snippet": { - "prefix": "trig", - "body": [ - "this is $1", - "a different snippet $2" - ], - "description": "Another snippet-description.", - "scope": "python" - }, - "global snippet": { - "prefix": "trigg", - "body": [ - "this is $1", - "the last snippet $2" - ], - "description": "One last snippet-description.", - } - } -< - -This file can be loaded by calling - ->lua - require("luasnip.loaders.from_vscode").load_standalone({path = "a.code-snippets"}) -< - - -SNIPMATE *luasnip-loaders-snipmate* - -Luasnip does not support the full snipmate format: Only `./{ft}.snippets` and -`./{ft}/*.snippets` will be loaded. See honza/vim-snippets - for lots of examples. - -Like VSCode, the SnipMate format is also extended to make use of some of -LuaSnip’s more advanced capabilities: - ->snippets - priority 2000 - autosnippet options - whoa :O -< - -**Example**: - -`~/.config/nvim/snippets/c.snippets`: - ->snippets - # this is a comment - snippet c c-snippet - c! -< - -`~/.config/nvim/snippets/cpp.snippets`: - ->snippets - extends c - - snippet cpp cpp-snippet - cpp! -< - -This can, again, be loaded with any of - ->lua - require("luasnip.loaders.from_snipmate").load() - -- specify the full path... - require("luasnip.loaders.from_snipmate").lazy_load({paths = "~/.config/nvim/snippets"}) - -- or relative to the directory of $MYVIMRC - require("luasnip.loaders.from_snipmate").lazy_load({paths = "./snippets"}) -< - -Stuff to watch out for: - -- Using both `extends ` in `.snippets` and - `ls.filetype_extend("", {""})` leads to duplicate snippets. -- `${VISUAL}` will be replaced by `$TM_SELECTED_TEXT` to make the snippets - compatible with LuaSnip -- We do not implement eval using ` (backtick). This may be implemented in the - future. - - -LUA *luasnip-loaders-lua* - -Instead of adding all snippets via `add_snippets`, it’s possible to store -them in separate files and load all of those. The file-structure here is -exactly the supported snipmate-structure, e.g. `.lua` or `/*.lua` to -add snippets for the filetype ``. - -There are two ways to add snippets: - -- the files may return two lists of snippets, the snippets in the first are all - added as regular snippets, while the snippets in the second will be added as - autosnippets (both are the defaults, if a snippet defines a different - `snippetType`, that will have preference) -- snippets can also be appended to the global (only for these files - they are - not visible anywhere else) tables `ls_file_snippets` and - `ls_file_autosnippets`. This can be combined with a custom `snip_env` to define - and add snippets with one function call: - >lua - ls.setup({ - snip_env = { - s = function(...) - local snip = ls.s(...) - -- we can't just access the global `ls_file_snippets`, since it will be - -- resolved in the environment of the scope in which it was defined. - table.insert(getfenv(2).ls_file_snippets, snip) - end, - parse = function(...) - local snip = ls.parser.parse_snippet(...) - table.insert(getfenv(2).ls_file_snippets, snip) - end, - -- remaining definitions. - ... - }, - ... - }) - < - This is more flexible than the previous approach since the snippets don’t - have to be collected; they just have to be defined using the above `s` and - `parse`. - -As defining all of the snippet constructors (`s`, `c`, `t`, …) in every file -is rather cumbersome, LuaSnip will bring some globals into scope for executing -these files. By default, the names from `luasnip.config.snip_env` - -will be used, but it’s possible to customize them by setting `snip_env` in -`setup`. - -**Example**: - -`~/snippets/all.lua`: - ->lua - return { - s("trig", t("loaded!!")) - } -< - -`~/snippets/c.lua`: - ->lua - return { - s("ctrig", t("also loaded!!")) - }, { - s("autotrig", t("autotriggered, if enabled")) - } -< - -Load via - ->lua - require("luasnip.loaders.from_lua").load({paths = "~/snippets"}) -< - - -RELOADING WHEN EDITING REQUIRE’D FILES ~ - -While the lua-snippet-files will be reloaded on edit, this does not -automatically happen if a file the snippet-file depends on (eg. via `require`) -is changed. Since this still may still be desirable, there are two functions -exposed when a file is loaded by the lua-loader: `ls_tracked_dofile` and -`ls_tracked_dopackage`. They perform like `dofile` and (almost like) `require`, -but both register the loaded file internally as a dependency of the -snippet-file, so it can be reloaded when the loaded file is edited. As stated, -`ls_tracked_dofile` behaves exactly like `dofile`, but does the dependency-work -as well. `ls_tracked_dopackage` mimics `require` in that it does not take a -path, but a module-name like `"luasnip.loaders.from_lua"`, and then searches -the `runtimepath/lua`-directories, and path and cpath for the module. Unlike -`require`, the file will not be cached, since that would complicate the -reload-on-edit-behaviour. - - -EDIT_SNIPPETS *luasnip-loaders-edit_snippets* - -To easily edit snippets for the current session, the files loaded by any loader -can be quickly edited via -`require("luasnip.loaders").edit_snippet_files(opts:table|nil)` - -When called, it will open a `vim.ui.select`-dialog to select first a filetype, -and then (if there are multiple) the associated file to edit. - -`opts` contains four settings: - -- `ft_filter`: `fn(filetype:string) -> bool` Optionally filter initially listed - filetypes. `true` -> filetype will be listed, `false` -> not listed. Accepts - all filetypes by default. -- `format`: `fn(file:string, source_name:string) -> string|nil` `file` is simply - the path to the file, `source_name` is one of `"lua"`, `"snipmate"` or - `"vscode"`. If a string is returned, it is used as the title of the item, `nil` - on the other hand will filter out this item. The default simply replaces some - long strings (packer-path and config-path) in `file` with shorter, symbolic - names (`"$PLUGINS"`, `"$CONFIG"`), but this can be extended to - - filter files from some specific source/path - - more aggressively shorten paths using symbolic names, e.g. - `"$FRIENDLY_SNIPPETS"`. Example: hide the `*.lua` snippet files, and shorten - the path with `$LuaSnip`: - >lua - require "luasnip.loaders" .edit_snippet_files { - format = function(file, source_name) - if source_name == "lua" then return nil - else return file:gsub("/root/.config/nvim/luasnippets", "$LuaSnip") - end - end - } - < -- `edit`: `fn(file:string)` This function is supposed to open the file for - editing. The default is a simple `vim.cmd("edit " .. file)` (replace the - current buffer), but one could open the file in a split, a tab, or a floating - window, for example. -- `extend`: `fn(ft:string, ft_paths:string[]) -> (string,string)[]` This function - can be used to create additional choices for the file-selection. - - `ft`: The filetype snippet-files are queried for. - - `ft_paths`: list of paths to the known snippet files. - The function should return a list of `(string,string)`-tuples. The first of - each pair is the label that will appear in the selection-prompt, and the second - is the path that will be passed to the `edit()` function if that item was - selected. - This can be used to create a new snippet file for the current filetype: - >lua - require("luasnip.loaders").edit_snippet_files { - extend = function(ft, paths) - if #paths == 0 then - return { - { "$CONFIG/" .. ft .. ".snippets", - string.format("%s/%s.snippets", , ft) } - } - end - - return {} - end - } - < - -One comfortable way to call this function is registering it as a command: - ->vim - command! LuaSnipEdit :lua require("luasnip.loaders").edit_snippet_files() -< - - -============================================================================== -21. SnippetProxy *luasnip-snippetproxy* - -`SnippetProxy` is used internally to alleviate the upfront cost of loading -snippets from e.g. a SnipMate library or a VSCode package. This is achieved by -only parsing the snippet on expansion, not immediately after reading it from -some file. `SnippetProxy` may also be used from Lua directly to get the same -benefits: - -This will parse the snippet on startup: - ->lua - ls.parser.parse_snippet("trig", "a snippet $1!") -< - -while this will parse the snippet upon expansion: - ->lua - local sp = require("luasnip.nodes.snippetProxy") - sp("trig", "a snippet $1") -< - -`sp(context, body, opts) -> snippetProxy` - -- `context`: exactly the same as the first argument passed to `ls.s`. -- `body`: the snippet body. -- `opts`: accepts the same `opts` as `ls.s`, with some additions: - - `parse_fn`: the function for parsing the snippet. Defaults to - `ls.parser.parse_snippet` (the parser for LSP snippets), an alternative is - the parser for SnipMate snippets (`ls.parser.parse_snipmate`). - - -============================================================================== -22. ext_opts *luasnip-ext_opts* - -`ext_opts` can be used to set the `opts` (see `nvim_buf_set_extmark`) of the -extmarks used for marking node positions, either globally, per snippet or per -node. This means that they allow highlighting the text inside of nodes, or -adding virtual text to the line the node begins on. - -This is an example for the `node_ext_opts` used to set `ext_opts` of single -nodes: - ->lua - local ext_opts = { - -- these ext_opts are applied when the node is active (e.g. it has been - -- jumped into, and not out yet). - active = - -- this is the table actually passed to `nvim_buf_set_extmark`. - { - -- highlight the text inside the node red. - hl_group = "GruvboxRed" - }, - -- these ext_opts are applied when the node is not active, but - -- the snippet still is. - passive = { - -- add virtual text on the line of the node, behind all text. - virt_text = {{"virtual text!!", "GruvboxBlue"}} - }, - -- visited or unvisited are applied when a node was/was not jumped into. - visited = { - hl_group = "GruvboxBlue" - }, - unvisited = { - hl_group = "GruvboxGreen" - }, - -- and these are applied when both the node and the snippet are inactive. - snippet_passive = {} - } - - s("trig", { - i(1, "text1", { - node_ext_opts = ext_opts - }), - i(2, "text2", { - node_ext_opts = ext_opts - }) - }) -< - -In the above example, the text inside the insertNodes is higlighted in green if -they were not yet visited, in blue once they were, and red while they are. The -virtual text "virtual text!!" is visible as long as the snippet is active. - -To make defining `ext_opts` less verbose, more specific states inherit from -less specific ones: - -- `passive` inherits from `snippet_passive` -- `visited` and `unvisited` from `passive` -- `active` from `visited` - -To disable a key from a less specific state, it has to be explicitly set to its -default, e.g. to disable highlighting inherited from `passive` when the node -is `active`, `hl_group` should be set to `None`. - ------------------------------------------------------------------------------- -As stated earlier, these `ext_opts` can also be applied globally or for an -entire snippet. For this, it’s necessary to specify which kind of node a -given set of `ext_opts` should be applied to: - ->lua - local types = require("luasnip.util.types") - - ls.setup({ - ext_opts = { - [types.insertNode] = { - active = {...}, - visited = {...}, - passive = {...}, - snippet_passive = {...} - }, - [types.choiceNode] = { - active = {...}, - unvisited = {...} - }, - [types.snippet] = { - passive = {...} - } - } - }) -< - -The above applies the given `ext_opts` to all nodes of these types, in all -snippets. - ->lua - local types = require("luasnip.util.types") - - s("trig", { i(1, "text1"), i(2, "text2") }, { - child_ext_opts = { - [types.insertNode] = { - passive = { - hl_group = "GruvboxAqua" - } - } - } - }) -< - -However, the `ext_opts` here are only applied to the `insertNodes` inside this -snippet. - ------------------------------------------------------------------------------- -By default, the `ext_opts` actually used for a node are created by extending -the `node_ext_opts` with the `effective_child_ext_opts[node.type]` of the -parent, which are in turn the parent’s `child_ext_opts` extended with the -global `ext_opts` (those set `ls.setup`). - -It’s possible to prevent both of these merges by passing -`merge_node/child_ext_opts=false` to the snippet/node-opts: - ->lua - ls.setup({ - ext_opts = { - [types.insertNode] = { - active = {...} - } - } - }) - - s("trig", { - i(1, "text1", { - node_ext_opts = { - active = {...} - }, - merge_node_ext_opts = false - }), - i(2, "text2") - }, { - child_ext_opts = { - [types.insertNode] = { - passive = {...} - } - }, - merge_child_ext_opts = false - }) -< - ------------------------------------------------------------------------------- -The `hl_group` of the global `ext_opts` can also be set via standard highlight -groups: - ->lua - vim.cmd("hi link LuasnipInsertNodePassive GruvboxRed") - vim.cmd("hi link LuasnipSnippetPassive GruvboxBlue") - - -- needs to be called for resolving the effective ext_opts. - ls.setup({}) -< - -The names for the used highlight groups are -`"Luasnip{Passive,Active,SnippetPassive}"`, where `` can be any -kind of node in PascalCase (or "Snippet"). - ------------------------------------------------------------------------------- -One problem that might arise when nested nodes are highlighted is that the -highlight of inner nodes should be visible, e.g. above that of nodes they are -nested inside. - -This can be controlled using the `priority`-key in `ext_opts`. In -`nvim_buf_set_extmark`, that value is an absolute value, but here it is -relative to some base-priority, which is increased for each nesting level of -snippet(Nodes)s. - -Both the initial base-priority and its’ increase and can be controlled using -`ext_base_prio` and `ext_prio_increase`: - ->lua - ls.setup({ - ext_opts = { - [types.insertNode] = { - active = { - hl_group = "GruvboxBlue", - -- the priorities should be \in [0, ext_prio_increase). - priority = 1 - } - }, - [types.choiceNode] = { - active = { - hl_group = "GruvboxRed" - -- priority defaults to 0 - } - } - } - ext_base_prio = 200, - ext_prio_increase = 2 - }) -< - -Here the highlight of an insertNode nested directly inside a choiceNode is -always visible on top of it. - - -============================================================================== -23. Docstrings *luasnip-docstrings* - -Snippet docstrings can be queried using `snippet:get_docstring()`. The function -evaluates the snippet as if it was expanded regularly, which can be problematic -if e.g. a dynamicNode in the snippet relies on inputs other than the argument -nodes. `snip.env` and `snip.captures` are populated with the names of the -queried variable and the index of the capture respectively -(`snip.env.TM_SELECTED_TEXT` -> `'$TM_SELECTED_TEXT'`, `snip.captures[1]` -> -`'$CAPTURES1'`). Although this leads to more expressive docstrings, it can -cause errors in functions that e.g. rely on a capture being a number: - ->lua - s({trig = "(%d)", regTrig = true}, { - f(function(args, snip) - return string.rep("repeatme ", tonumber(snip.captures[1])) - end, {}) - }) -< - -This snippet works fine because `snippet.captures[1]` is always a number. -During docstring generation, however, `snippet.captures[1]` is `'$CAPTURES1'`, -which will cause an error in the functionNode. Issues with `snippet.captures` -can be prevented by specifying `docTrig` during snippet-definition: - ->lua - s({trig = "(%d)", regTrig = true, docTrig = "3"}, { - f(function(args, snip) - return string.rep("repeatme ", tonumber(snip.captures[1])) - end, {}) - }) -< - -`snippet.captures` and `snippet.trigger` will be populated as if actually -triggered with `3`. - -Other issues will have to be handled manually by checking the contents of e.g. -`snip.env` or predefining the docstring for the snippet: - ->lua - s({trig = "(%d)", regTrig = true, docstring = "repeatmerepeatmerepeatme"}, { - f(function(args, snip) - return string.rep("repeatme ", tonumber(snip.captures[1])) - end, {}) - }) -< - -Refer to #515 for a better -example to understand `docTrig` and `docstring`. - - -============================================================================== -24. Docstring-Cache *luasnip-docstring-cache* - -Although generation of docstrings is pretty fast, it’s preferable to not redo -it as long as the snippets haven’t changed. Using -`ls.store_snippet_docstrings(snippets)` and its counterpart -`ls.load_snippet_docstrings(snippets)`, they may be serialized from or -deserialized into the snippets. Both functions accept a table structsured like -this: `{ft1={snippets}, ft2={snippets}}`. Such a table containing all snippets -can be obtained via `ls.get_snippets()`. `load` should be called before any of -the `loader`-functions as snippets loaded from VSCode style packages already -have their `docstring` set (`docstrings` wouldn’t be overwritten, but -there’d be unnecessary calls). - -The cache is located at `stdpath("cache")/luasnip/docstrings.json` (probably -`~/.cache/nvim/luasnip/docstrings.json`). - - -============================================================================== -25. Events *luasnip-events* - -Events can be used to react to some action inside snippets. These callbacks can -be defined per snippet (`callbacks`-key in snippet constructor), per-node by -passing them as `node_callbacks` in `node_opts`, or globally (autocommand). - -`callbacks`: `fn(node[, event_args]) -> event_res` All callbacks receive the -`node` associated with the event and event-specific optional arguments, -`event_args`. `event_res` is only used in one event, `pre_expand`, where some -properties of the snippet can be changed. If multiple callbacks return -`event_res`, we only guarantee that one of them will be effective, not all of -them. - -`autocommand`: Luasnip uses `User`-events. Autocommands for these can be -registered using - ->vim - au User SomeUserEvent echom "SomeUserEvent was triggered" -< - -or - ->lua - vim.api.nvim_create_autocommand("User", { - patter = "SomeUserEvent", - command = "echom SomeUserEvent was triggered" - }) -< - -The node and `event_args` can be accessed through `require("luasnip").session`: - -- `node`: `session.event_node` -- `event_args`: `session.event_args` - -**Events**: - -- `enter/leave`: Called when a node is entered/left (for example when jumping - around in a snippet). - `User-event`: `"Luasnip{Enter,Leave}"`, with `` in - PascalCase, e.g. `InsertNode` or `DynamicNode`. - `event_args`: none -- `change_choice`: When the active choice in a choiceNode is changed. - `User-event`: `"LuasnipChangeChoice"` - `event_args`: none -- `pre_expand`: Called before a snippet is expanded. Modifying text is allowed, - the expand-position will be adjusted so the snippet expands at the same - position relative to existing text. - `User-event`: `"LuasnipPreExpand"` - `event_args`: - - `expand_pos`: `{, }`, position at which the snippet will be - expanded. `` and `` are both 0-indexed. - `event_res`: - - `env_override`: `map string->(string[]|string)`, override or extend the - snippet’s environment (`snip.env`). - -A pretty useless, beyond serving as an example here, application of these would -be printing e.g. the node’s text after entering: - ->lua - vim.api.nvim_create_autocmd("User", { - pattern = "LuasnipInsertNodeEnter", - callback = function() - local node = require("luasnip").session.event_node - print(table.concat(node:get_text(), "\n")) - end - }) -< - -or some information about expansions: - ->lua - vim.api.nvim_create_autocmd("User", { - pattern = "LuasnipPreExpand", - callback = function() - -- get event-parameters from `session`. - local snippet = require("luasnip").session.event_node - local expand_position = - require("luasnip").session.event_args.expand_pos - - print(string.format("expanding snippet %s at %s:%s", - table.concat(snippet:get_docstring(), "\n"), - expand_position[1], - expand_position[2] - )) - end - }) -< - - -============================================================================== -26. Cleanup *luasnip-cleanup* - -The function ls.cleanup() triggers the `LuasnipCleanup` user event, that you -can listen to do some kind of cleaning in your own snippets; by default it will -empty the snippets table and the caches of the lazy_load. - - -============================================================================== -27. Logging *luasnip-logging* - -Luasnip uses logging to report unexpected program states, and information on -what’s going on in general. If something does not work as expected, taking a -look at the log (and potentially increasing the loglevel) might give some good -hints towards what is going wrong. - -The log is stored in `/luasnip.log` -(`/luasnip.log` for Neovim versions where -`stdpath("log")` does not exist), and can be opened by calling `ls.log.open()`. -The loglevel (granularity of reported events) can be adjusted by calling -`ls.log.set_loglevel("error"|"warn"|"info"|"debug")`. `"debug"` has the highest -granularity, `"error"` the lowest, the default is `"warn"`. - -Once this log grows too large (10MiB, currently not adjustable), it will be -renamed to `luasnip.log.old`, and a new, empty log created in its place. If -there already exists a `luasnip.log.old`, it will be deleted. - -`ls.log.ping()` can be used to verify the log is working correctly: it will -print a short message to the log. - - -============================================================================== -28. Source *luasnip-source* - -It is possible to attach, to a snippet, information about its source. This can -be done either by the various loaders (if it is enabled in `ls.setup` -(|luasnip-config-options|, `loaders_store_source`)), or manually. The attached -data can be used by |luasnip-extras-snippet-location| to jump to the definition -of a snippet. - -It is also possible to get/set the source of a snippet via API: - -`ls.snippet_source`: - -- `get(snippet) -> source_data`: - Retrieve the source-data of `snippet`. `source_data` always contains the key - `file`, the file in which the snippet was defined, and may additionally - contain `line` or `line_end`, the first and last line of the definition. -- `set(snippet, source)`: - Set the source of a snippet. - - `snippet`: a snippet which was added via `ls.add_snippets`. - - `source`: a `source`-object, obtained from either `from_debuginfo` or - `from_location`. -- `from_location(file, opts) -> source`: - - `file`: `string`, The path to the file in which the snippet is defined. - - `opts`: `table|nil`, optional parameters for the source. - - `line`: `number`, the first line of the definition. 1-indexed. - - `line_end`: `number`, the final line of the definition. 1-indexed. -- `from_debuginfo(debuginfo) -> source`: - Generates source from the table returned by `debug.getinfo` (from now on - referred to as `debuginfo`). `debuginfo` has to be of a frame of a function - which is backed by a file, and has to contain this information, ie. has to be - generated by `debug.get_info(*, "Sl")` (at least `"Sl"`, it may also contain - more info). - - -============================================================================== -29. Config-Options *luasnip-config-options* - -These are the settings you can provide to `luasnip.setup()`: - -- `keep_roots`: Whether snippet-roots should be linked. See - |luasnip-basics-snippet-insertion| for more context. -- `link_roots`: Whether snippet-roots should be linked. See - |luasnip-basics-snippet-insertion| for more context. -- `exit_roots`: Whether snippet-roots should exit at reaching at their last node, - `$0`. This setting is only valid for root snippets, not child snippets. This - setting may avoid unexpected behavior by disallowing to jump earlier (finished) - snippets. Check |luasnip-basics-snippet-insertion| for more information on - snippet-roots. -- `link_children`: Whether children should be linked. See - |luasnip-basics-snippet-insertion| for more context. -- `history` (deprecated): if not nil, `keep_roots`, `link_roots`, and - `link_children` will be set to the value of `history`, and `exit_roots` will - set to inverse value of `history`. This is just to ensure - backwards-compatibility. -- `update_events`: Choose which events trigger an update of the active nodes’ - dependents. Default is just `'InsertLeave'`, `'TextChanged,TextChangedI'` would - update on every change. These, like all other `*_events` are passed to - `nvim_create_autocmd` as `events`, so they can be wrapped in a table, like - >lua - ls.setup({ - update_events = {"TextChanged", "TextChangedI"} - }) - < -- `region_check_events`: Events on which to leave the current snippet-root if the - cursor is outside its’ 'region'. Disabled by default, `'CursorMoved'`, - `'CursorHold'` or `'InsertEnter'` seem reasonable. -- `delete_check_events`: When to check if the current snippet was deleted, and if - so, remove it from the history. Off by default, `'TextChanged'` (perhaps - `'InsertLeave'`, to react to changes done in Insert mode) should work just fine - (alternatively, this can also be mapped using `luasnip-delete-check`). -- `store_selection_keys`: Mapping for populating `TM_SELECTED_TEXT` and related - variables (not set by default). If you want to set this mapping yourself, map - `ls.select_keys` (not a function, actually a string/key-combination) as a rhs. -- `enable_autosnippets`: Autosnippets are disabled by default to minimize - performance penalty if unused. Set to `true` to enable. -- `ext_opts`: Additional options passed to extmarks. Can be used to add - passive/active highlight on a per-node-basis (more info in DOC.md) -- `parser_nested_assembler`: Override the default behaviour of inserting a - `choiceNode` containing the nested snippet and an empty `insertNode` for nested - placeholders (`"${1: ${2: this is nested}}"`). For an example (behaviour more - similar to vscode), check here - -- `ft_func`: Source of possible filetypes for snippets. Defaults to a function, - which returns `vim.split(vim.bo.filetype, ".", true)`, but check - filetype_functions or the - |luasnip-extras-filetype-functions|-section for more options. -- `load_ft_func`: Function to determine which filetypes belong to a given buffer - (used for `lazy_loading`). `fn(bufnr) -> filetypes (string[])`. Again, there - are some examples in filetype_functions - . -- `snip_env`: The best way to author snippets in lua involves the lua-loader (see - |luasnip-loaders-lua|). Unfortunately, this requires that snippets are defined - in separate files, which means that common definitions like `s`, `i`, `sn`, - `t`, `fmt`, … have to be repeated in each of them, and that adding more - customized functions to ease writing snippets also requires some setup. - `snip_env` can be used to insert variables into exactly the places where - lua-snippets are defined (for now only the file loaded by the lua-loader). - Setting `snip_env` to `{ some_global = "a value" }` will add (amongst the - defaults stated at the beginning of this documentation) the global variable - `some_global` while evaluating these files. There are special keys which, when - set in `snip_env` change the behaviour of this option, and are not passed - through to the lua-files: - - `__snip_env_behaviour`, string: either `"set"` or `"extend"` (default - `"extend"`) - If this is `"extend"`, the variables defined in `snip_env` will complement (and - override) the defaults. If this is not desired, `"set"` will not include the - defaults, but only the variables set here. - One side-effect of this is that analysis-tools (most likely - `lua-language-server`) for lua will generate diagnostics for the usage of - undefined symbols. If you mind the (probably) large number of generated - warnings, consider adding the undefined globals to the globals recognized by - `lua-language-server` or add `---@diagnostic disable: undefined-global` - somewhere in the affected files. -- `loaders_store_source`, boolean, whether loaders should store the source of the - loaded snippets. Enabling this means that the definition of any snippet can be - jumped to via |luasnip-extras-snippet-location|, but also entails slightly - increased memory consumption (and load-time, but it’s not really noticeable). - - -============================================================================== -30. Troubleshooting *luasnip-troubleshooting* - - -ADDING SNIPPETS *luasnip-troubleshooting-adding-snippets* - -### Loaders - -- **Filetypes**. LuaSnip uses `all` as the global filetype. As most snippet - collections don’t explicitly target LuaSnip, they may not provide global - snippets for this filetype, but another, like `_` (`honza/vim-snippets`). In - these cases, it’s necessary to extend LuaSnip’s global filetype with the - collection’s global filetype: - >lua - ls.filetype_extend("all", { "_" }) - < - In general, if some snippets don’t show up when loading a collection, a good - first step is checking the filetype LuaSnip is actually looking into (print - them for the current buffer via `:lua - print(vim.inspect(require("luasnip").get_snippet_filetypes()))`), against the - one the missing snippet is provided for (in the collection). If there is indeed - a mismatch, `filetype_extend` can be used to also search the collection’s - filetype: - >lua - ls.filetype_extend("", { "" }) - < -- **Non-default ft_func loading**. As we only load `lazy_load`ed snippets on some - events, `lazy_load` will probably not play nice when a non-default `ft_func` is - used: if it depends on e.g. the cursor position, only the filetypes for the - cursor position when the `lazy_load` events are triggered will be loaded. Check - |luasnip-extras-filetype-function|’s `extend_load_ft` for a solution. - - -GENERAL ~ - -- **Snippets sharing triggers**. If multiple snippets could be triggered at the - current buffer-position, the snippet that was defined first in one’s - configuration will be expanded first. As a small, real-world LaTeX math - example, given the following two snippets with triggers `.ov` and `ov`: - >lua - postfix( -- Insert over-line command to text via post-fix - { trig = ".ov", snippetType = "autosnippet" }, - { - f(function(_, parent) - return "\\overline{" .. parent.snippet.env.POSTFIX_MATCH .. "}" - end, {}), - } - ), - s( -- Insert over-line command - { trig = "ov", snippetType="autosnippet" }, - fmt( - [[\overline{<>}]], - { i(1) }, - { delimiters = "<>" } - ) - ), - < - If one types `x` followed by `.ov`, the postfix snippet expands producing - `\overline{x}`. However, if the `postfix` snippet above is defined _after_ the - normal snippet `s`, then the same key press sequence produces `x.\overline{}`. - This behaviour can be overridden by explicitly providing a priority to such - snippets. For example, in the above code, if the `postfix` snippet was defined - after the normal snippet `s`, then adding `priority=1001` to the `postfix` - snippet will cause it to expand as if it were defined before the normal snippet - `s`. Snippet `priority` is discussed in the Snippets section - of the - documentation. - - -============================================================================== -31. API *luasnip-api* - -`require("luasnip")`: - -- `add_snippets(ft:string or nil, snippets:list or table, opts:table or nil)`: - Makes `snippets` (list of snippets) available in `ft`. If `ft` is `nil`, - `snippets` should be a table containing lists of snippets, the keys are - corresponding filetypes. `opts` may contain the following keys: - - `type`: type of `snippets`, `"snippets"` or `"autosnippets"` (ATTENTION: - plural form used here). This serves as default value for the `snippetType` - key of each snippet added by this call see |luasnip-snippets|. - - `key`: Key that identifies snippets added via this call. - If `add_snippets` is called with a key that was already used, the snippets - from that previous call will be removed. - This can be used to reload snippets: pass an unique key to each - `add_snippets` and just redo the `add_snippets`-call when the snippets have - changed. - - `override_priority`: set priority for all snippets. - - `default_priority`: set priority only for snippets without snippet priority. -- `clean_invalidated(opts: table or nil) -> bool`: clean invalidated snippets - from internal snippet storage. Invalidated snippets are still stored; it might - be useful to actually remove them as they still have to be iterated during - expansion. - `opts` may contain: - - `inv_limit`: how many invalidated snippets are allowed. If the number of - invalid snippets doesn’t exceed this threshold, they are not yet cleaned up. - A small number of invalidated snippets (<100) probably doesn’t affect runtime - at all, whereas recreating the internal snippet storage might. -- `get_id_snippet(id)`: returns snippet corresponding to id. -- `in_snippet()`: returns true if the cursor is inside the current snippet. -- `jumpable(direction)`: returns true if the current node has a next(`direction` - = 1) or previous(`direction` = -1), e.g. whether it’s possible to jump - forward or backward to another node. -- `jump(direction)`: returns true if the jump was successful. -- `expandable()`: true if a snippet can be expanded at the current cursor - position. -- `expand(opts)`: expands the snippet at(before) the cursor. `opts` may contain: - - `jump_into_func` passed through to `ls.snip_expand`, check its’ doc for a - description. -- `expand_or_jumpable()`: returns `expandable() or jumpable(1)` (exists only - because commonly, one key is used to both jump forward and expand). -- `expand_or_locally_jumpable()`: same as `expand_or_jumpable()` except jumpable - is ignored if the cursor is not inside the current snippet. -- `locally_jumpable(direction)`: same as `jumpable()` except it is ignored if the - cursor is not inside the current snippet. -- `expand_or_jump()`: returns true if jump/expand was succesful. -- `expand_auto()`: expands the autosnippets before the cursor (not necessary to - call manually, will be called via autocmd if `enable_autosnippets` is set in - the config). -- `snip_expand(snip, opts)`: expand `snip` at the current cursor position. `opts` - may contain the following keys: - - `clear_region`: A region of text to clear after expanding (but before jumping - into) snip. It has to be at this point (and therefore passed to this function) - as clearing before expansion will populate `TM_CURRENT_LINE` and - `TM_CURRENT_WORD` with wrong values (they would miss the snippet trigger) and - clearing after expansion may move the text currently under the cursor and have - it end up not at the `i(1)`, but a `#trigger` chars to its right. The actual - values used for clearing are `from` and `to`, both (0,0)-indexed - byte-positions. If the variables don’t have to be populated with the correct - values, it’s safe to remove the text manually. - - `expand_params`: table, override `trigger`, `captures` or environment of the - snippet. This is useful for manually expanding snippets where the trigger - passed via `trig` is not the text triggering the snippet, or those which expect - `captures` (basically, snippets with a non-plaintext `trigEngine`). - One example: ```lua snip_expand(snip, { trigger = "override_trigger", captures - = {"first capture", "second capture"}, env_override = { this_key = "some - value", other_key = {"multiple", "lines"}, TM_FILENAME = - "some_other_filename.lua" } }) - - `pos`: position (`{line, col}`), (0,0)-indexed (in bytes, as returned by - `nvim_win_get_cursor()`), where the snippet should be expanded. The snippet - will be put between `(line,col-1)` and `(line,col)`. The snippet will be - expanded at the current cursor if pos is nil. - - `jump_into_func`: fn(snippet) -> node: Callback responsible for jumping into - the snippet. The returned node is set as the new active node, ie. it is the - origin of the next jump. The default is basically this: `lua function(snip) -- - jump_into set the placeholder of the snippet, 1 -- to jump forwards. return - snip:jump_into(1)` while this can be used to only insert the snippet: `lua - function(snip) return snip.insert_nodes[0] end` - - `indent`: bool?, defaults to `true`. Whether LuaSnip will try to add additional - indents to fit current indent level in snippet expanding. This option is useful - when some LSP server already take indents into consideration. In such cases, - LuaSnip should not try to add additional indents. If you are using `nvim-cmp`, - sample config: - >lua - require("cmp").setup { - snippet = { - expand = function(args) - local indent_nodes = true - if vim.api.nvim_get_option_value("filetype", { buf = 0 }) == "dart" then - indent_nodes = false - end - require("luasnip").lsp_expand(args.body, { - indent = indent_nodes, - }) - end, - }, - } - < - `opts` and any of its parameters may be nil. -- `get_active_snip()`: returns the currently active snippet (not node!). -- `choice_active()`: true if inside a choiceNode. -- `change_choice(direction)`: changes the choice in the innermost currently - active choiceNode forward (`direction` = 1) or backward (`direction` = -1). -- `unlink_current()`: removes the current snippet from the jumplist (useful if - luasnip fails to automatically detect e.g. deletion of a snippet) and sets the - current node behind the snippet, or, if not possible, before it. -- `lsp_expand(snip_string, opts)`: expands the LSP snippet defined via - `snip_string` at the cursor. `opts` can have the same options as `opts` in - `snip_expand`. -- `active_update_dependents()`: update all function/dynamicNodes that have the - current node as an argnode (will actually only update them if the text in any - of the argnodes changed). -- `available(snip_info)`: returns a table of all snippets defined for the current - filetypes(s) (`{ft1={snip1, snip2}, ft2={snip3, snip4}}`). The structure of the - snippet is defined by `snip_info` which is a function (`snip_info(snip)`) that - takes in a snippet (`snip`), finds the desired information on it, and returns - it. `snip_info` is an optional argument as a default has already been defined. - You can use it for more granular control over the table of snippets that is - returned. -- `exit_out_of_region(node)`: checks whether the cursor is still within the range - of the root-snippet `node` belongs to. If yes, no change occurs; if no, the - root-snippet is exited and its `$0` will be the new active node. If a jump - causes an error (happens mostly because the text of a snippet was deleted), the - snippet is removed from the jumplist and the current node set to the - end/beginning of the next/previous snippet. -- `store_snippet_docstrings(snippet_table)`: Stores the docstrings of all - snippets in `snippet_table` to a file - (`stdpath("cache")/luasnip/docstrings.json`). Calling - `store_snippet_docstrings(snippet_table)` after adding/modifying snippets and - `load_snippet_docstrings(snippet_table)` on startup after all snippets have - been added to `snippet_table` is a way to avoide regenerating the (unchanged) - docstrings on each startup. (Depending on when the docstrings are required and - how luasnip is loaded, it may be more sensible to let them load lazily, - e.g. just before they are required). `snippet_table` should be laid out just - like `luasnip.snippets` (it will most likely always _be_ `luasnip.snippets`). -- `load_snippet_docstrings(snippet_table)`: Load docstrings for all snippets in - `snippet_table` from `stdpath("cache")/luasnip/docstrings.json`. The docstrings - are stored and restored via trigger, meaning if two snippets for one filetype - have the same (very unlikely to happen in actual usage), bugs could occur. - `snippet_table` should be laid out as described in `store_snippet_docstrings`. -- `unlink_current_if_deleted()`: Checks if the current snippet was deleted; if - so, it is removed from the jumplist. This is not 100% reliable as LuaSnip only - sees the extmarks and their beginning/end may not be on the same position, even - if all the text between them was deleted. -- `filetype_extend(filetype:string, extend_filetypes:table of string)`: Tells - luasnip that for a buffer with `ft=filetype`, snippets from `extend_filetypes` - should be searched as well. `extend_filetypes` is a lua-array (`{ft1, ft2, - ft3}`). `luasnip.filetype_extend("lua", {"c", "cpp"})` would search and expand - c and cpp snippets for lua files. -- `filetype_set(filetype:string, replace_filetypes:table of string)`: Similar to - `filetype_extend`, but where _append_ appended filetypes, _set_ sets them: - `filetype_set("lua", {"c"})` causes only c snippets to be expanded in lua - files; lua snippets aren’t even searched. -- `cleanup()`: clears all snippets. Not useful for regular usage, only when - authoring and testing snippets. -- `refresh_notify(ft:string)`: Triggers an autocmd that other plugins can hook - into to perform various cleanup for the refreshed filetype. Useful for - signaling that new snippets were added for the filetype `ft`. -- `set_choice(indx:number)`: Changes to the `indx`th choice. If no `choiceNode` - is active, an error is thrown. If the active `choiceNode` doesn’t have an - `indx`th choice, an error is thrown. -- `get_current_choices() -> string[]`: Returns a list of multiline-strings - (themselves lists, even if they have only one line), the `i`th string - corresponding to the `i`th choice of the currently active `choiceNode`. If no - `choiceNode` is active, an error is thrown. -- `setup_snip_env()`: Adds the variables defined (during `setup`) in `snip_env` - to the callers environment. -- `get_snip_env()`: Returns `snip_env`. -- `jump_destination(direction)`: Returns the node the next jump in `direction` - (either -1 or 1, for backwards, forwards respectively) leads to, or `nil` if - the destination could not be determined (most likely because there is no node - that can be jumped to in the given direction, or there is no active node). -- `activate_node(opts)`: Activate a node in any snippet. `opts` contains the - following options: - - `pos`, `{[1]: row, [2]: byte-column}?`: The position at which a node should - be activated. Defaults to the position of the cursor. - - `strict`, `bool?`: If set, throw an error if the node under the cursor can’t - be jumped into. If not set, fall back to any node of the snippet and enter - that instead. - - `select`, `bool?`: Whether the text inside the node should be selected. - Defaults to true. - -Not covered in this section are the various node-constructors exposed by the -module, their usage is shown either previously in this file or in -`Examples/snippets.lua` (in the repo). - -Generated by panvimdoc - -vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/ftplugin/snippets.vim b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/ftplugin/snippets.vim deleted file mode 100644 index b13cc8af..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/ftplugin/snippets.vim +++ /dev/null @@ -1,14 +0,0 @@ -" Vim filetype plugin for SnipMate snippets (.snippets files) - -if exists("b:did_ftplugin") - finish -endif -let b:did_ftplugin = 1 - -let b:undo_ftplugin = "setl et< sts< cms< fdm< fde<" - -" Use hard tabs -setlocal noexpandtab softtabstop=0 - -setlocal commentstring=#\ %s -setlocal nospell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/luasnip-2.3.0-1.rockspec b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/luasnip-2.3.0-1.rockspec deleted file mode 100644 index a392685b..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/luasnip-2.3.0-1.rockspec +++ /dev/null @@ -1,37 +0,0 @@ -local git_ref = 'v2.3.0' -local modrev = '2.3.0' -local specrev = '1' - -local repo_url = 'https://github.com/L3MON4D3/LuaSnip' - -rockspec_format = '3.0' -package = 'luasnip' -version = modrev ..'-'.. specrev - -description = { - summary = 'Snippet Engine for Neovim written in Lua.', - detailed = '', - labels = { 'lua', 'neovim', 'snippet-engine', 'snippets' } , - homepage = 'https://github.com/L3MON4D3/LuaSnip', - license = 'Apache-2.0' -} - -dependencies = { 'lua >= 5.1', 'jsregexp >= 0.0.5, <= 0.0.7' } - -test_dependencies = { } - -source = { - url = repo_url .. '/archive/' .. git_ref .. '.zip', - dir = 'LuaSnip-' .. '2.3.0', -} - -if modrev == 'scm' or modrev == 'dev' then - source = { - url = repo_url:gsub('https', 'git') - } -end - -build = { - type = 'builtin', - copy_directories = { 'doc', 'ftplugin', 'plugin', 'syntax' } , -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/plugin/luasnip.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/plugin/luasnip.lua deleted file mode 100644 index 420e4c0a..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/plugin/luasnip.lua +++ /dev/null @@ -1,90 +0,0 @@ -vim.filetype.add({ - extension = { snippets = "snippets" }, -}) - -local function silent_map(mode, lhs, rhs, desc) - vim.keymap.set(mode, lhs, rhs, { silent = true, desc = desc or "" }) -end - -silent_map("i", "luasnip-expand-or-jump", function() - require("luasnip").expand_or_jump() -end, "LuaSnip: Expand or jump in the current snippet") -silent_map("i", "luasnip-expand-snippet", function() - require("luasnip").expand() -end, "LuaSnip: Expand the current snippet") -silent_map("i", "luasnip-next-choice", function() - require("luasnip").change_choice(1) -end, "LuaSnip: Change to the next choice from the choiceNode") -silent_map("i", "luasnip-prev-choice", function() - require("luasnip").change_choice(-1) -end, "LuaSnip: Change to the previous choice from the choiceNode") -silent_map("i", "luasnip-jump-next", function() - require("luasnip").jump(1) -end, "LuaSnip: Jump to the next node") -silent_map("i", "luasnip-jump-prev", function() - require("luasnip").jump(-1) -end, "LuaSnip: Jump to the previous node") - -silent_map("n", "luasnip-delete-check", function() - require("luasnip").unlink_current_if_deleted() -end, "LuaSnip: Removes current snippet from jumplist") -silent_map("!", "luasnip-delete-check", function() - require("luasnip").unlink_current_if_deleted() -end, "LuaSnip: Removes current snippet from jumplist") - -silent_map("", "luasnip-expand-repeat", function() - require("luasnip").expand_repeat() -end, "LuaSnip: Repeat last node expansion") -silent_map("!", "luasnip-expand-repeat", function() - require("luasnip").expand_repeat() -end, "LuaSnip: Repeat last node expansion") - -silent_map("s", "luasnip-expand-or-jump", function() - require("luasnip").expand_or_jump() -end, "LuaSnip: Expand or jump in the current snippet") -silent_map("s", "luasnip-expand-snippet", function() - require("luasnip").expand() -end, "LuaSnip: Expand the current snippet") -silent_map("s", "luasnip-next-choice", function() - require("luasnip").change_choice(1) -end, "LuaSnip: Change to the next choice from the choiceNode") -silent_map("s", "luasnip-prev-choice", function() - require("luasnip").change_choice(-1) -end, "LuaSnip: Change to the previous choice from the choiceNode") -silent_map("s", "luasnip-jump-next", function() - require("luasnip").jump(1) -end, "LuaSnip: Jump to the next node") -silent_map("s", "luasnip-jump-prev", function() - require("luasnip").jump(-1) -end, "LuaSnip: Jump to the previous node") - -vim.api.nvim_create_user_command("LuaSnipUnlinkCurrent", function() - require("luasnip").unlink_current() -end, { force = true }) - ---stylua: ignore -vim.api.nvim_create_user_command("LuaSnipListAvailable", function() - ( - ( - vim.version - and type(vim.version) == "table" - and ( - ((vim.version().major == 0) and (vim.version().minor >= 9)) - or (vim.version().major > 0) ) - ) and vim.print - or vim.pretty_print - )(require("luasnip").available()) -end, { force = true }) - -require("luasnip.config")._setup() - --- register these during startup so lazy_load will also load filetypes whose --- events fired only before lazy_load is actually called. --- (BufWinEnter -> lazy_load() wouldn't load any files without these). -vim.api.nvim_create_augroup("_luasnip_lazy_load", {}) -vim.api.nvim_create_autocmd({ "BufWinEnter", "FileType" }, { - callback = function(event) - require("luasnip.loaders").load_lazy_loaded(tonumber(event.buf)) - end, - group = "_luasnip_lazy_load", -}) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/plugin/luasnip.vim b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/plugin/luasnip.vim deleted file mode 100644 index d8628ea7..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/plugin/luasnip.vim +++ /dev/null @@ -1,23 +0,0 @@ -function! luasnip#expandable() - return luaeval('require("luasnip").expandable()') -endfunction - -function! luasnip#expand_or_jumpable() - return luaeval('require("luasnip").expand_or_jumpable()') -endfunction - -function! luasnip#expand_or_locally_jumpable() - return luaeval('require("luasnip").expand_or_locally_jumpable()') -endfunction - -function! luasnip#locally_jumpable(direction) - return luaeval('require("luasnip").locally_jumpable(_A)', a:direction) -endfunction - -function! luasnip#jumpable(direction) - return luaeval('require("luasnip").jumpable(_A)', a:direction) -endfunction - -function! luasnip#choice_active() - return luaeval('require("luasnip").choice_active()') -endfunction diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/rock_manifest b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/rock_manifest deleted file mode 100644 index 2ed6b589..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/rock_manifest +++ /dev/null @@ -1,116 +0,0 @@ -rock_manifest = { - doc = { - ["luasnip.txt"] = "5014cf9a2bb7c7360fd34a1a02356207" - }, - ftplugin = { - ["snippets.vim"] = "ecd77fcf256c792985acf12ea7603322" - }, - lua = { - luasnip = { - ["_types.lua"] = "a1b1fc45d496f8ece3e17dc3541e5f93", - ["config.lua"] = "1bb0edf593b14b243b116d70cbb605c9", - ["default_config.lua"] = "51eea9c217eed18af81d580129c70461", - extras = { - ["_extra_types.lua"] = "b8f4a120d5abe22f0112efdcae358817", - ["_lambda.lua"] = "e94a2ad0606ed3c4276a573d4e7ab205", - ["_parser_combinator.lua"] = "bacc166557d1b5f9f03aff25a56bc801", - ["_treesitter.lua"] = "d9fb19599b9d95edab033fdda0684c32", - conditions = { - ["expand.lua"] = "35c3ab55ec8e9916ed7cde31cc807b08", - ["init.lua"] = "12f7e4b6fd6b5796c36ce61db5844efd", - ["show.lua"] = "0cd4059f6ba5582f409ced580e9fef13" - }, - ["expand_conditions.lua"] = "6ea7479cea2e5fac95a2045a6a283d4b", - ["filetype_functions.lua"] = "bdab365ff7bd2d7d148fdc6b3b78d9b4", - ["fmt.lua"] = "014768af82d3e7e58437e41335553eb6", - ["init.lua"] = "560335e3043e97a826fc8aee4b250fbc", - ["otf.lua"] = "8a95cdb7b582497542069bdd0886776b", - ["postfix.lua"] = "5e94359e6642b52d8ef6c9df3a90e167", - ["select_choice.lua"] = "8c924f05ee0d55ab9b0d9e5c603e1a52", - ["snip_location.lua"] = "bd0f8a7f1c61f6a001fa5781c15839d5", - ["snippet_list.lua"] = "fe61183934e0bb966b83461febdd1dcb", - ["treesitter_postfix.lua"] = "42a5143ad3c647d292b2183566fd6776" - }, - ["health.lua"] = "b6bd288f728f6897674347ad46917a5b", - ["init.lua"] = "96451aae98dbaf3ece53873298479172", - loaders = { - ["data.lua"] = "498490d7dfcf2f0374b0d20f429ba6fb", - ["from_lua.lua"] = "78d20ec3694e16581e21ed4948c26385", - ["from_snipmate.lua"] = "93e1cdc6e024549d9aa6bc917325de24", - ["from_vscode.lua"] = "0ff819764a09a735f9ea8ef51413ae83", - ["fs_watchers.lua"] = "b36b9f60988b568602350c41b032f9e6", - ["init.lua"] = "d470bc3c7bd4690199cf1c0d214782cf", - ["snippet_cache.lua"] = "e2b5cf9a46713fb3f108067100e77e0c", - ["types.lua"] = "89e18f0f21c1e77be74c1cbe85757d11", - ["util.lua"] = "77a85743643bf4d15cbe91af429908d5" - }, - nodes = { - ["absolute_indexer.lua"] = "efa73978bd91f2d90f2fc9ef53a9c38c", - ["choiceNode.lua"] = "c63618056997ec5aec6524fffff7f2fb", - ["duplicate.lua"] = "454e20ad45dbf371aa7d09aa21861f1c", - ["dynamicNode.lua"] = "28f4e7a46281dc3a2af0875ffc5ff58c", - ["functionNode.lua"] = "cf7cb4efb677a139618fd9255734873e", - ["insertNode.lua"] = "a25a723746e7ab5973901855de1d1f11", - ["key_indexer.lua"] = "d1c4887dfc10501f09b7851aea25f842", - ["multiSnippet.lua"] = "2eab1e75c5ee87096f03db006da31844", - ["node.lua"] = "c1d2f45dd25dcf5c1574ff63e0f9e88c", - ["restoreNode.lua"] = "9613ce23458968aa12737365dd302be7", - ["snippet.lua"] = "d6a31a62f45a460bc642822b6d0244f7", - ["snippetProxy.lua"] = "68262858f0f9a20a41640d5a11c43481", - ["textNode.lua"] = "c22395ab8305a581f021982cd88e2931", - util = { - ["trig_engines.lua"] = "a023c5ca92103478cbf40b7ffe2de903" - }, - ["util.lua"] = "a6be1172f1b37f2018460900b0ab987d" - }, - session = { - ["enqueueable_operations.lua"] = "2e4f57314f0573601e35943f56e8d4d8", - ["init.lua"] = "213d2ea8110e267278d62f5853151ceb", - snippet_collection = { - ["init.lua"] = "2d5015eb7cb5717f5aa44fdeebffbe59", - ["source.lua"] = "17f2f0c590d4deb57ae0e7af20c153ec" - } - }, - ["snippets.lua"] = "d41d8cd98f00b204e9800998ecf8427e", - util = { - ["_builtin_vars.lua"] = "cb7e73099c5711556f8df8821ca4a182", - ["auto_table.lua"] = "f9c5f84a99e71df229c4b6506a447727", - ["dict.lua"] = "83d98b784cfe6ab28c1d3727e7220110", - ["directed_graph.lua"] = "7eb06677cf726e6be7d64d470660677c", - ["environ.lua"] = "61b0b01947a335f749e854f039ec77ac", - ["events.lua"] = "cdac0c08202f1295a0bd9f5ee5909b3b", - ["ext_opts.lua"] = "55f3ee33870b070d50c3eae516b4724a", - ["extend_decorator.lua"] = "07576b8535b2729c9d70f5ba5b036a92", - ["functions.lua"] = "86ccff508ce6b6eeefc455308e7d4994", - ["jsonc.lua"] = "94fbde2a919a24f3957d004aaf7d136d", - ["jsregexp.lua"] = "59eb40a43fa328e82b086863dcbfa626", - ["lazy_table.lua"] = "7b0f31805982e74c3e693fd60ad42ec2", - ["log.lua"] = "ffe073da229ae489cc72e576c0ab6bee", - ["mark.lua"] = "135f7a32a6f1031ea0eb80688997f3d3", - parser = { - ["ast_parser.lua"] = "230087c74af6009d8a858259808f3e51", - ["ast_utils.lua"] = "7013bc099f5ed408c4cd49b29e4ce63c", - ["init.lua"] = "5ae80471a9893a45b12b77a35ecc8d81", - ["neovim_ast.lua"] = "08e136ffd26023ef3172ec2aed4ad2e9", - ["neovim_parser.lua"] = "c25f144947bceed6036e3d40b70bdef0" - }, - ["path.lua"] = "3767ba134238fa42469cfcbcfdf16147", - ["pattern_tokenizer.lua"] = "f4f99d27e6a6fb5385f583abc70beaab", - ["select.lua"] = "b0a8180922f7995a86ea9df7eabb162e", - ["str.lua"] = "06645f5bc876c73af9c4fd3296d620e0", - ["table.lua"] = "f4a54a5775133c776d65643be728cfdb", - ["time.lua"] = "54483e160266c85209e4399fbfc43e1b", - ["types.lua"] = "6605cc2d2293f7080d104c63663c0dac", - ["util.lua"] = "ac9ec42f0d014d908ff24c5af8172335" - } - } - }, - ["luasnip-2.3.0-1.rockspec"] = "51f9eecc66d3003eb668326f1e4a0e68", - plugin = { - ["luasnip.lua"] = "189a598faa80a372be83a52dc57fb491", - ["luasnip.vim"] = "e3d30107f8659679f6766d579ce5bf56" - }, - syntax = { - ["snippets.vim"] = "5ea760f9406519fc824e2c941ef4d858" - } -} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/syntax/snippets.vim b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/syntax/snippets.vim deleted file mode 100644 index dcb39dd9..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/queries/tsx/luasnip/2.3.0-1/syntax/snippets.vim +++ /dev/null @@ -1,29 +0,0 @@ -" Syntax highlighting for .snippets files -" Hopefully this should make snippets a bit nicer to write! -syn match snipComment '^#.*' -syn match placeHolder '\${\d\+\(:.\{-}\)\=}' contains=snipCommand -syn match tabStop '\$\d\+' -syn match snipEscape '\\\\\|\\`' -syn match snipCommand '\%(\\\@ cover common -" cases with \t and " ". -syn match snipError "^[^#vsaep\t ].*$" - -hi link snippet Identifier -hi link snipComment Comment -hi link multiSnipText String -hi link snipKeyword Keyword -hi link snipEscape SpecialChar -hi link placeHolder Special -hi link tabStop Special -hi link snipCommand String -hi link snipError Error -hi link priority Number diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/highlight/go/workflows/format.yml b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/highlight/go/workflows/format.yml deleted file mode 100644 index be20031f..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/highlight/go/workflows/format.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Format JSON files - -# Controls when the workflow will run -on: - # Triggers the workflow on push or pull request events but only for the "main" branch - push: - branches: [ "main" ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - prettier: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - # Make sure the actual branch is checked out when running on pull requests - ref: ${{ github.head_ref }} - - - name: Format JSON - uses: creyD/prettier_action@v4.3 - with: - commit_message: "CI: format JSON files" - only_changed: true - # This part is also where you can pass other options, for example: - prettier_options: --tab-width 4 --parser json --write **/*.json diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/highlight/xml/plugin/cmp_path.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/highlight/xml/plugin/cmp_path.lua deleted file mode 100644 index 1d5de278..00000000 --- a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/highlight/xml/plugin/cmp_path.lua +++ /dev/null @@ -1 +0,0 @@ -require('cmp').register_source('path', require('cmp_path').new()) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.editorconfig b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.editorconfig new file mode 100644 index 00000000..00ea231b --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +tab_width = 8 +end_of_line = lf +insert_final_newline = true +charset = utf-8 + +[*.lua] +tab_width = 2 + +[*.py] +indent_size = 4 +tab_width = 4 + +[{Makefile,**/Makefile,runtime/doc/*.txt}] +indent_style = tab +indent_size = 8 diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/CODEOWNERS b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/CODEOWNERS new file mode 100644 index 00000000..8fcb7cd9 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/CODEOWNERS @@ -0,0 +1,7 @@ +/lua/nvim-treesitter/textobjects/ @theHamsta +/lua/nvim-treesitter/incremental_selection.lua @theHamsta + +/lua/nvim-treesitter/fold.lua @vigoux +/lua/nvim-treesitter/highlight.lua @vigoux + +/lua/nvim-treesitter/refactor/ @steelsojka diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/FUNDING.yml b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/FUNDING.yml new file mode 100644 index 00000000..b2844b21 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/FUNDING.yml @@ -0,0 +1,2 @@ +open_collective: "nvim-treesitter" +github: "nvim-treesitter" diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/ISSUE_TEMPLATE/bug_report.yml b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..f68dd248 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,58 @@ +name: Bug report +description: Create a report to help us improve +labels: [bug] + +body: + - type: markdown + attributes: + value: | + # Before reporting + Please do the following steps before reporting an issue. + + - I have updated my neovim version to latest _master_ + - I have updated my plugin to the latest version + - I have run `:TSUpdate` + - I have read the [troubleshooting section](https://github.com/nvim-treesitter/nvim-treesitter#troubleshooting) + + - type: textarea + attributes: + label: Describe the bug + description: A clear and concise description of what the bug is. + validations: + required: true + + - type: textarea + attributes: + label: To Reproduce + description: Steps to reproduce the behavior. + placeholder: | + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + validations: + required: true + + - type: textarea + attributes: + label: Expected behavior + description: A clear and concise description of what you expected to happen. + + - type: textarea + attributes: + label: Output of `:checkhealth nvim-treesitter` + render: markdown + validations: + required: true + + - type: textarea + attributes: + label: Output of `nvim --version` + render: text + validations: + required: true + + - type: textarea + attributes: + label: Additional context + description: Add any context about the problem here. diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/ISSUE_TEMPLATE/feature_request.md b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..d883b8f2 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,19 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "" +labels: enhancement +assignees: "" +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/ISSUE_TEMPLATE/highlighting_issue.yml b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/ISSUE_TEMPLATE/highlighting_issue.yml new file mode 100644 index 00000000..2713df8a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/ISSUE_TEMPLATE/highlighting_issue.yml @@ -0,0 +1,98 @@ +name: Highlighting issue +description: Missing or incorrect highlights or you want to change the way something is highlighted +labels: [highlights] + +body: + - type: markdown + attributes: + value: | + # Before reporting + Please perform the following steps before reporting an issue. + - I have updated my neovim version to latest _master_. + - I have updated my plugin to the latest version. + - I have run `:TSUpdate`. + - I have inspected the syntax tree using https://github.com/nvim-treesitter/playground and made sure + that no `ERROR` nodes are in the syntax tree. nvim-treesitter can not guarantee correct highlighting in the + presence of `ERROR`s -- in this case, please report the bug directly at corresponding parser's repository. (You can find all repository URLs in [README.md](https://github.com/nvim-treesitter/nvim-treesitter#supported-languages).) + - I have used `:TSHighlightCapturesUnderCursor` from https://github.com/nvim-treesitter/playground to inspect which highlight groups Neovim is using and that legacy syntax highlighting is not interfering (i.e., what you are observing is actual tree-sitter highlighting). + + - type: textarea + attributes: + label: Describe the highlighting problem + description: A clear and concise description of what should be highlighted in a different way. + validations: + required: true + + - type: textarea + attributes: + label: Example snippet that causes the problem + description: Please provide an example snippet in plain text that causes the problem. + validations: + required: true + + - type: textarea + attributes: + label: Tree-sitter parsing result + description: | + Please provide the output of `:TSPlaygroundToggle` from https://github.com/nvim-treesitter/playground + (screenshot or plain text) with the following options enabled (pressing the key): + - `I` (name of the parsed language) + - `t` (toggle injected languages) + - `a` (show anonymous nodes) + placeholder: | + This should look somehow like this: + ``` + preproc_ifdef [0, 0] - [4, 6] cpp + "#ifdef" [0, 0] - [0, 6] cpp + name: identifier [0, 7] - [0, 17] cpp + preproc_def [1, 0] - [2, 0] cpp + "#define" [1, 0] - [1, 7] cpp + name: identifier [1, 8] - [1, 16] cpp + value: preproc_arg [1, 16] - [1, 27] cpp + "\n" [1, 27] - [2, 0] cpp + alternative: preproc_else [2, 0] - [4, 0] cpp + "#else" [2, 0] - [2, 5] cpp + preproc_def [3, 0] - [4, 0] cpp + "#define" [3, 0] - [3, 7] cpp + name: identifier [3, 8] - [3, 16] cpp + value: preproc_arg [3, 16] - [3, 29] cpp + ``` + validations: + required: true + + - type: textarea + attributes: + label: Example screenshot + description: | + Please provide a screenshot of the current highlighting. Please also tell us the `:h colorscheme` you are using + and how to install it. If applicable, you can also upload a screenshot with the contents of + `:TSHighlightCapturesUnderCursor`. + validations: + required: true + + - type: textarea + attributes: + label: Expected behavior + description: | + A clear and concise description of what you expect to be changed. You can provide screenshot of + other editors or traditional Vim highlighting that don't show this problem or show a screenshot how + nvim-treesitter highlighting would look like when a problematic query would be removed/altered. + + - type: textarea + attributes: + label: Output of `:checkhealth nvim-treesitter` + render: markdown + validations: + required: true + + - type: textarea + attributes: + label: Output of `nvim --version` + render: text + validations: + required: true + + - type: textarea + attributes: + label: Additional context + description: Add any context about the problem here. diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/mergify.yml b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/mergify.yml new file mode 100644 index 00000000..b95a074a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/mergify.yml @@ -0,0 +1,37 @@ +pull_request_rules: + - name: Merge lockfile updates + conditions: + - "title=Update lockfile.json" + actions: + review: + type: APPROVE + message: Automatically approving lockfile updates + merge: + method: merge + + - name: Prepare for merge + conditions: + - and: + - "-draft" + - "#approved-reviews-by=1" + - "#review-requested=0" + actions: + comment: + message: | + This PR is ready to be merged, and will be in 1 day if nothing happens before. + If you want other people to review your PR, request their reviews. + If you don't want this PR to be merged now, mark it as a Draft. + + - name: Merge on approval + conditions: + - and: + - or: + - "#approved-reviews-by>=2" + - and: + - "#approved-reviews-by=1" + - "updated-at>=1 day ago" + - "-draft" + - "#review-requested=0" + actions: + merge: + method: rebase diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/lint.yml b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/lint.yml new file mode 100644 index 00000000..a643f796 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/lint.yml @@ -0,0 +1,33 @@ +name: Linting and style checking + +on: + push: + pull_request: + +jobs: + luacheck: + name: Luacheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Prepare + run: | + sudo apt-get update + sudo apt-get install luarocks -y + sudo luarocks install luacheck + + - name: Run Luacheck + run: luacheck . + + stylua: + name: StyLua + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Lint with stylua + uses: JohnnyMorganz/stylua-action@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: latest + args: --check . diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/release.yml b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/release.yml new file mode 100644 index 00000000..11f3ffc1 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/release.yml @@ -0,0 +1,24 @@ +name: "release" +on: + push: + tags: # Will upload to luarocks.org + - "*" + pull_request: # Will test a local install without uploading to luarocks.org + paths: + - 'contrib/*.rockspec' + - .github/workflows/release.yml + +jobs: + luarocks-upload: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: nvim-neorocks/luarocks-tag-release@v5 + env: + LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} + with: + name: nvim-treesitter + detailed_description: | + The goal of nvim-treesitter is both to provide a simple and easy way to use the interface for tree-sitter in Neovim + and to provide some basic functionality such as highlighting based on it. + template: contrib/nvim-treesitter-luarocks.template diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/test-queries.yml b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/test-queries.yml new file mode 100644 index 00000000..768bab08 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/test-queries.yml @@ -0,0 +1,87 @@ +name: Test queries + +on: + push: + branches: + - "master" + pull_request: + branches: + - "master" + +# Cancel any in-progress CI runs for a PR if it is updated +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + +defaults: + run: + shell: bash + +jobs: + check_compilation: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-2022, macos-latest] + cc: [gcc, clang] + nvim_tag: [stable] + exclude: + - os: ubuntu-latest + cc: clang + nvim_tag: stable + + - os: macos-latest + cc: gcc + nvim_tag: stable + + - os: windows-2022 + cc: clang + nvim_tag: stable + + include: + - os: windows-2022 + cc: cl + nvim_tag: stable + + - os: ubuntu-latest + cc: gcc + nvim_tag: nightly + + name: Parser compilation + runs-on: ${{ matrix.os }} + env: + CC: ${{ matrix.cc }} + NVIM: ${{ matrix.os == 'windows-2022' && 'nvim-win64\\bin\\nvim.exe' || 'nvim' }} + ALLOWED_INSTALLATION_FAILURES: ${{ matrix.os == 'windows-2022' && 'rnoweb' }} + steps: + - uses: actions/checkout@v4 + - uses: ilammy/msvc-dev-cmd@v1 + - uses: actions/setup-node@v4 + + - name: Install tree-sitter CLI + run: npm i -g tree-sitter-cli + + - name: Install and prepare Neovim + env: + NVIM_TAG: ${{ matrix.nvim_tag }} + run: | + bash ./scripts/ci-install-${{ matrix.os }}.sh + + - name: Setup Parsers Cache + id: parsers-cache + uses: actions/cache@v3 + with: + path: | + ./parser/ + ~/AppData/Local/nvim/pack/nvim-treesitter/start/nvim-treesitter/parser/ + key: ${{ matrix.os }}-${{ matrix.cc }}-${{ matrix.nvim_tag }}-parsers-v1-${{ hashFiles('./lockfile.json', './lua/nvim-treesitter/parsers.lua', './lua/nvim-treesitter/install.lua', './lua/nvim-treesitter/shell_command_selectors.lua') }} + + - name: Compile parsers + run: $NVIM --headless -c "lua require'nvim-treesitter.install'.prefer_git=false" -c "TSInstallSync all" -c "q" + + - name: Post compile Windows + if: matrix.os == 'windows-2022' + run: cp -r ~/AppData/Local/nvim/pack/nvim-treesitter/start/nvim-treesitter/parser/* parser + + - name: Check query files + run: $NVIM -l scripts/check-queries.lua diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/tests.yml b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/tests.yml new file mode 100644 index 00000000..3beda463 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/tests.yml @@ -0,0 +1,65 @@ +name: Tests + +on: + push: + branches: + - "master" + pull_request: + branches: + - "master" + +# Cancel any in-progress CI runs for a PR if it is updated +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + +jobs: + check_compilation: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + cc: [gcc] + + name: Run tests + runs-on: ${{ matrix.os }} + env: + CC: ${{ matrix.cc }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + + - name: Install tree-sitter CLI + run: npm i -g tree-sitter-cli + + - name: Test Dependencies + run: | + mkdir -p ~/.local/share/nvim/site/pack/plenary.nvim/start + cd ~/.local/share/nvim/site/pack/plenary.nvim/start + git clone https://github.com/nvim-lua/plenary.nvim + curl -L https://github.com/theHamsta/highlight-assertions/releases/download/v0.1.6/highlight-assertions_v0.1.6_x86_64-unknown-linux-gnu.tar.gz | tar -xz + cp highlight-assertions /usr/local/bin + + - name: Install and prepare Neovim + env: + NVIM_TAG: stable + TREE_SITTER_CLI_TAG: v0.20.8 + run: | + bash ./scripts/ci-install-${{ matrix.os }}.sh + + - name: Setup Parsers Cache + id: parsers-cache + uses: actions/cache@v3 + with: + path: | + ./parser/ + ~/AppData/Local/nvim/pack/nvim-treesitter/start/nvim-treesitter/parser/ + key: ${{ matrix.os }}-${{ matrix.cc }}-parsers-v1-${{ hashFiles('./lockfile.json', './lua/nvim-treesitter/parsers.lua', './lua/nvim-treesitter/install.lua', './lua/nvim-treesitter/shell_selectors.lua') }} + + - name: Compile parsers Unix like + if: ${{ matrix.os != 'windows-latest' && steps.parsers-cache.outputs.cache-hit != 'true' }} + run: | + nvim --headless -c "TSInstallSync all" -c "q" + + - name: Tests + run: PATH=/usr/local/bin:$PATH ./scripts/run_tests.sh diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/update-lockfile.yml b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/update-lockfile.yml new file mode 100644 index 00000000..e44d7c95 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/update-lockfile.yml @@ -0,0 +1,52 @@ +name: Update lockfile + +on: + schedule: + - cron: "30 6 * * *" + workflow_dispatch: + +jobs: + update-lockfile: + name: Update lockfile + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: master + + - name: Prepare + env: + NVIM_TAG: stable + run: | + wget https://github.com/josephburnett/jd/releases/download/v1.7.1/jd-amd64-linux + mv jd-amd64-linux /tmp/jd + chmod +x /tmp/jd + bash scripts/ci-install-ubuntu-latest.sh + + - name: Update parsers + env: + SKIP_LOCKFILE_UPDATE_FOR_LANGS: "" + run: | + cp lockfile.json /tmp/old_lockfile.json + nvim -l scripts/write-lockfile.lua + # Pretty print + cp lockfile.json /tmp/lockfile.json + cat /tmp/lockfile.json | jq --sort-keys > lockfile.json + + - name: Commit changes + run: | + git config user.name 'GitHub' + git config user.email 'noreply@github.com' + git add lockfile.json + UPDATED_PARSERS=$(/tmp/jd -f merge /tmp/old_lockfile.json lockfile.json | jq -r 'keys | join(", ")') + echo "UPDATED_PARSERS=$UPDATED_PARSERS" >> $GITHUB_ENV + git commit -m "Update parsers: $UPDATED_PARSERS" || echo 'No commit necessary!' + git clean -xf + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + title: "Update lockfile.json: ${{ env.UPDATED_PARSERS }}" + branch: update-lockfile-pr + base: ${{ github.head_ref }} + draft: true diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/update-readme.yml b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/update-readme.yml new file mode 100644 index 00000000..6708ad10 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.github/workflows/update-readme.yml @@ -0,0 +1,38 @@ +name: Update README + +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + update-readme: + name: Update README + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Prepare + env: + NVIM_TAG: stable + run: | + bash ./scripts/ci-install-ubuntu-latest.sh + + - name: Check README + run: | + git config user.email 'actions@github' + git config user.name 'Github Actions' + nvim -l scripts/update-readme.lua || echo 'Needs update' + git add README.md + git commit -m 'Update README' || echo 'No commit necessary!' + git clean -xf + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + commit-message: Update README + title: Update README + branch: update-readme-pr + base: ${{ github.head_ref }} + draft: true diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.gitignore b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.gitignore new file mode 100644 index 00000000..0ac164cd --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.gitignore @@ -0,0 +1,7 @@ +doc/tags +.luacheckcache +/tags +nvim.appimage +nvim-linux64* +nvim-macos* +nvim-win64* diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.luacheckrc b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.luacheckrc new file mode 100644 index 00000000..b0ee19d8 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.luacheckrc @@ -0,0 +1,21 @@ +-- Rerun tests only if their modification time changed. +cache = true +codes = true + +exclude_files = { + "tests/indent/lua/" +} + +-- Glorious list of warnings: https://luacheck.readthedocs.io/en/stable/warnings.html +ignore = { + "212", -- Unused argument, In the case of callback function, _arg_name is easier to understand than _, so this option is set to off. + "411", -- Redefining a local variable. + "412", -- Redefining an argument. + "422", -- Shadowing an argument + "122" -- Indirectly setting a readonly global +} + +-- Global objects defined by the C code +read_globals = { + "vim", +} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.luarc.json b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.luarc.json new file mode 100644 index 00000000..8dc06050 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.luarc.json @@ -0,0 +1,25 @@ +{ + "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json", + "runtime": { + "version": "LuaJIT" + }, + "workspace": { + "library": [ + "lua", + "$VIMRUNTIME", + "${3rd}/luv/library" + ], + "checkThirdParty": false + }, + "diagnostics": { + "groupFileStatus": { + "strict": "Opened", + "strong": "Opened" + }, + "groupSeverity": { + "strong": "Warning", + "strict": "Warning" + }, + "unusedLocalExclude": [ "_*" ] + } +} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.stylua.toml b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.stylua.toml new file mode 100644 index 00000000..ecb6dca5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.styluaignore b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.styluaignore new file mode 100644 index 00000000..2b6c4c6a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/.styluaignore @@ -0,0 +1 @@ +tests/indent/lua/ diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/CONTRIBUTING.md b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/CONTRIBUTING.md new file mode 100644 index 00000000..43beeb04 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/CONTRIBUTING.md @@ -0,0 +1,360 @@ +# Contributing to `nvim-treesitter` + +First of all, thank you very much for contributing to `nvim-treesitter`. + +If you haven't already, you should really come and reach out to us on our +[Matrix channel], so we can help you with any question you might have! + +As you know, `nvim-treesitter` is roughly split in two parts: + +- Parser configurations : for various things like `locals`, `highlights` +- What we like to call _modules_ : tiny lua modules that provide a given feature, based on parser configurations + +Depending on which part of the plugin you want to contribute to, please read the appropriate section. + +## Style Checks and Tests + +We haven't implemented any functional tests yet. Feel free to contribute. +However, we check code style with `luacheck` and `stylua`! +Please install luacheck and activate our `pre-push` hook to automatically check style before +every push: + +```bash +luarocks install luacheck +cargo install stylua +ln -s ../../scripts/pre-push .git/hooks/pre-push +``` + +## Adding new modules + +If you want to see a new functionality added to `nvim-treesitter` feel free to first open an issue +to that we can track our solution! +Thus far, there is basically two types of modules: + +- Little modules (like `incremental selection`) that are built in `nvim-treesitter`, we call them + `builtin modules`. +- Bigger modules (like `completion-treesitter`, or `nvim-tree-docs`), or modules that integrate + with other plugins, that we call `remote modules`. + +In any case, you can build your own module! To help you started in the process, we have a template +repository designed to build new modules [here](https://github.com/nvim-treesitter/module-template). +Feel free to use it, and contact us over on our +on the "Neovim tree-sitter" [Matrix channel]. + +## Parser configurations + +Contributing to parser configurations is basically modifying one of the `queries/*/*.scm`. +Each of these `scheme` files contains a _tree-sitter query_ for a given purpose. +Before going any further, we highly suggest that you [read more about tree-sitter queries](https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries). + +Each query has an appropriate name, which is then used by modules to extract data from the syntax tree. +For now these are the types of queries used by `nvim-treesitter`: + +- `highlights.scm`: used for syntax highlighting, using the `highlight` module. +- `locals.scm`: used to extract keyword definitions, scopes, references, etc, using the `locals` module. +- `textobjects.scm`: used to define text objects. +- `folds.scm`: used to define folds. +- `injections.scm`: used to define injections. + +For these types there is a _norm_ you will have to follow so that features work fine. +Here are some global advices: + +- If your language is listed [here](https://github.com/nvim-treesitter/nvim-treesitter#supported-languages), + you can install the [playground plugin](https://github.com/nvim-treesitter/playground). +- If your language is listed [here](https://github.com/nvim-treesitter/nvim-treesitter#supported-languages), + you can debug and experiment with your queries there. +- If not, you should consider installing the [tree-sitter cli](https://github.com/tree-sitter/tree-sitter/tree/master/cli), + you should then be able to open a local playground using `tree-sitter build-wasm && tree-sitter web-ui` within the + parsers repo. +- Examples of queries can be found in [queries/](queries/) +- Matches in the bottom will override queries that are above of them. + +If your language is an extension of a language (TypeScript is an extension of JavaScript for +example), you can include the queries from your base language by adding the following _as the first +line of your file_. + +```query +; inherits: lang1,(optionallang) +``` + +If you want to inherit a language, but don't want the languages inheriting from yours to inherit it, +you can mark the language as optional (by putting it between parenthesis). + +### Highlights + +As languages differ quite a lot, here is a set of captures available to you when building a `highlights.scm` query. Note that your colorscheme needs to define (or link) these captures as highlight groups. + +#### Misc + +```scheme +@comment ; line and block comments +@comment.documentation ; comments documenting code +@error ; syntax/parser errors +@none ; completely disable the highlight +@preproc ; various preprocessor directives & shebangs +@define ; preprocessor definition directives +@operator ; symbolic operators (e.g. `+` / `*`) +``` + +#### Punctuation + +```scheme +@punctuation.delimiter ; delimiters (e.g. `;` / `.` / `,`) +@punctuation.bracket ; brackets (e.g. `()` / `{}` / `[]`) +@punctuation.special ; special symbols (e.g. `{}` in string interpolation) +``` + +#### Literals + +```scheme +@string ; string literals +@string.documentation ; string documenting code (e.g. Python docstrings) +@string.regex ; regular expressions +@string.escape ; escape sequences +@string.special ; other special strings (e.g. dates) + +@character ; character literals +@character.special ; special characters (e.g. wildcards) + +@boolean ; boolean literals +@number ; numeric literals +@float ; floating-point number literals +``` + +#### Functions + +```scheme +@function ; function definitions +@function.builtin ; built-in functions +@function.call ; function calls +@function.macro ; preprocessor macros + +@method ; method definitions +@method.call ; method calls + +@constructor ; constructor calls and definitions +@parameter ; parameters of a function +``` + +#### Keywords + +```scheme +@keyword ; various keywords +@keyword.coroutine ; keywords related to coroutines (e.g. `go` in Go, `async/await` in Python) +@keyword.function ; keywords that define a function (e.g. `func` in Go, `def` in Python) +@keyword.operator ; operators that are English words (e.g. `and` / `or`) +@keyword.return ; keywords like `return` and `yield` + +@conditional ; keywords related to conditionals (e.g. `if` / `else`) +@conditional.ternary ; ternary operator (e.g. `?` / `:`) + +@repeat ; keywords related to loops (e.g. `for` / `while`) +@debug ; keywords related to debugging +@label ; GOTO and other labels (e.g. `label:` in C) +@include ; keywords for including modules (e.g. `import` / `from` in Python) +@exception ; keywords related to exceptions (e.g. `throw` / `catch`) +``` + +#### Types + +```scheme +@type ; type or class definitions and annotations +@type.builtin ; built-in types +@type.definition ; identifiers in type definitions (e.g. `typedef ` in C) +@type.qualifier ; type qualifiers (e.g. `const`) + +@storageclass ; modifiers that affect storage in memory or life-time +@attribute ; attribute annotations (e.g. Python decorators) +@field ; object and struct fields +@property ; similar to `@field` +``` + +#### Identifiers + +```scheme +@variable ; various variable names +@variable.builtin ; built-in variable names (e.g. `this`) + +@constant ; constant identifiers +@constant.builtin ; built-in constant values +@constant.macro ; constants defined by the preprocessor + +@namespace ; modules or namespaces +@symbol ; symbols or atoms +``` + +#### Text + +Mainly for markup languages. + +```scheme +@text ; non-structured text +@text.strong ; bold text +@text.emphasis ; text with emphasis +@text.underline ; underlined text +@text.strike ; strikethrough text +@text.title ; text that is part of a title +@text.quote ; text quotations +@text.uri ; URIs (e.g. hyperlinks) +@text.math ; math environments (e.g. `$ ... $` in LaTeX) +@text.environment ; text environments of markup languages +@text.environment.name ; text indicating the type of an environment +@text.reference ; text references, footnotes, citations, etc. + +@text.literal ; literal or verbatim text (e.g., inline code) +@text.literal.block ; literal or verbatim text as a stand-alone block + ; (use priority 90 for blocks with injections) + +@text.todo ; todo notes +@text.note ; info notes +@text.warning ; warning notes +@text.danger ; danger/error notes + +@text.diff.add ; added text (for diff files) +@text.diff.delete ; deleted text (for diff files) +``` + +#### Tags + +Used for XML-like tags. + +```scheme +@tag ; XML tag names +@tag.attribute ; XML tag attributes +@tag.delimiter ; XML tag delimiters +``` + +#### Conceal + +```scheme +@conceal ; for captures that are only used for concealing +``` + +`@conceal` must be followed by `(#set! conceal "")`. + +#### Spell + +```scheme +@spell ; for defining regions to be spellchecked +@nospell ; for defining regions that should NOT be spellchecked +``` + +The main types of nodes which are spell checked are: +- Comments +- Strings; where it makes sense. Strings that have interpolation or are typically used for non text purposes are not spell checked (e.g. bash). + +#### Priority + +Captures can be assigned a priority to control precedence of highlights via the +`#set! "priority" ` directive (see `:h treesitter-highlight-priority`). +The default priority for treesitter highlights is `100`; queries should only +set priorities between `90` and `120`, to avoid conflict with other sources of +highlighting (such as diagnostics or LSP semantic tokens). + +### Locals + +Note: pay specific attention to the captures here as they are a bit different to +those listed in the upstream [Local Variables +docs](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables). +Some of these docs didn't exist when `nvim-treesitter` was created and the +upstream captures are more limiting than what we have here. + +```scheme +@definition ; various definitions +@definition.constant ; constants +@definition.function ; functions +@definition.method ; methods +@definition.var ; variables +@definition.parameter ; parameters +@definition.macro ; preprocessor macros +@definition.type ; types or classes +@definition.field ; fields or properties +@definition.enum ; enumerations +@definition.namespace ; modules or namespaces +@definition.import ; imported names +@definition.associated ; the associated type of a variable + +@scope ; scope block +@reference ; identifier reference +``` + +#### Definition Scope + +You can set the scope of a definition by setting the `scope` property on the definition. + +For example, a JavaScript function declaration creates a scope. The function name is captured as the definition. +This means that the function definition would only be available WITHIN the scope of the function, which is not the case. +The definition can be used in the scope the function was defined in. + +```javascript +function doSomething() {} + +doSomething(); // Should point to the declaration as the definition +``` + +```query +(function_declaration + ((identifier) @definition.var) + (#set! "definition.var.scope" "parent")) +``` + +Possible scope values are: + +- `parent`: The definition is valid in the containing scope and one more scope above that scope +- `global`: The definition is valid in the root scope +- `local`: The definition is valid in the containing scope. This is the default behavior + +### Folds + +You can define folds for a given language by adding a `folds.scm` query : + +```scheme +@fold ; fold this node +``` + +If the `folds.scm` query is not present, this will fall back to the `@scope` captures in the `locals` +query. + +### Injections + +Some captures are related to language injection (like markdown code blocks). They are used in `injections.scm`. + +If you want to dynamically detect the language (e.g. for Markdown blocks) use the `@injection.language` to capture +the node describing the language and `@injection.content` to describe the injection region. + +```scheme +@injection.language ; dynamic detection of the injection language (i.e. the text of the captured node describes the language) +@injection.content ; region for the dynamically detected language +``` + +For example, to inject javascript into HTML's ` +``` + +```query +(script_element + (raw_text) @injection.content + (#set! injection.language "javascript")) ; set the parser language for @injection.content region to javascript +``` + +For regions that don't have a corresponding `@injection.language`, you need to manually set the language +through `(#set injection.language "lang_name")` + +To combine all matches of a pattern as one single block of content, add `(#set! injection.combined)` to such pattern + +### Indents + +```scheme +@indent.begin ; indent children when matching this node +@indent.end ; marks the end of indented block +@indent.align ; behaves like python aligned/hanging indent +@indent.dedent ; dedent children when matching this node +@indent.branch ; dedent itself when matching this node +@indent.ignore ; do not indent in this node +@indent.auto ; behaves like 'autoindent' buffer option +@indent.zero ; sets this node at position 0 (no indent) +``` + +[Matrix channel]: https://matrix.to/#/#nvim-treesitter:matrix.org diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/LICENSE b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/Makefile b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/Makefile new file mode 100644 index 00000000..338c7546 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/Makefile @@ -0,0 +1,7 @@ +# https://github.com/luarocks/luarocks/wiki/Creating-a-Makefile-that-plays-nice-with-LuaRocks +build: + echo "Do nothing" + +install: + mkdir -p $(INST_LUADIR) + cp -r lua/* $(INST_LUADIR) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/README.md b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/README.md new file mode 100644 index 00000000..675add8b --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/README.md @@ -0,0 +1,778 @@ +
+

nvim-treesitter

+

+ + Matrix Chat + + + Linting and Style + + + Syntax files + +

+
+ +
+

+ Logo +

+

+ Treesitter + configurations and abstraction layer for + Neovim. +

+

+ + Logo by @steelsojka + +

+
+ +The goal of `nvim-treesitter` is both to provide a simple and easy way to use the interface for [tree-sitter](https://github.com/tree-sitter/tree-sitter) in Neovim and to provide some basic functionality such as highlighting based on it: + +![example-cpp](https://user-images.githubusercontent.com/2361214/202753610-e923bf4e-e88f-494b-bb1e-d22a7688446f.png) + +Traditional highlighting (left) vs Treesitter-based highlighting (right). +More examples can be found in [our gallery](https://github.com/nvim-treesitter/nvim-treesitter/wiki/Gallery). + +**Warning: Treesitter and nvim-treesitter highlighting are an experimental feature of Neovim. +Please consider the experience with this plug-in as experimental until Tree-Sitter support in Neovim is stable! +We recommend using the nightly builds of Neovim if possible. +You can find the current roadmap [here](https://github.com/nvim-treesitter/nvim-treesitter/projects/1). +The roadmap and all features of this plugin are open to change, and any suggestion will be highly appreciated!** + +Nvim-treesitter is based on three interlocking features: [**language parsers**](#language-parsers), [**queries**](#adding-queries), and [**modules**](#available-modules), where _modules_ provide features – e.g., highlighting – based on _queries_ for syntax objects extracted from a given buffer by _language parsers_. +Users will generally only need to interact with parsers and modules as explained in the next section. +For more detailed information on setting these up, see ["Advanced setup"](#advanced-setup). + +--- + +### Table of contents + +- [Quickstart](#quickstart) +- [Supported languages](#supported-languages) +- [Available modules](#available-modules) +- [Advanced setup](#advanced-setup) +- [Extra features](#extra-features) +- [Troubleshooting](#troubleshooting) + +--- + +# Quickstart + +## Requirements + +- **Neovim 0.9.1** or later ([nightly](https://github.com/neovim/neovim#install-from-source) recommended) +- `tar` and `curl` in your path (or alternatively `git`) +- A C compiler in your path and libstdc++ installed ([Windows users please read this!](https://github.com/nvim-treesitter/nvim-treesitter/wiki/Windows-support)). + +## Installation + +You can install `nvim-treesitter` with your favorite package manager (or using the native `package` feature of vim, see `:h packages`). + +**NOTE: This plugin is only guaranteed to work with specific versions of language parsers** (as specified in the `lockfile.json`). **When upgrading the plugin, you must make sure that all installed parsers are updated to the latest version** via `:TSUpdate`. +It is strongly recommended to automate this; e.g., if you are using [vim-plug](https://github.com/junegunn/vim-plug), put this in your `init.vim` file: + +```vim +Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} +``` + +For other plugin managers such as `packer.nvim`, see this [Installation page from the wiki](https://github.com/nvim-treesitter/nvim-treesitter/wiki/Installation) (Note that this page is community maintained). + +## Language parsers + +Treesitter uses a different _parser_ for every language, which needs to be generated via `tree-sitter-cli` from a `grammar.js` file, then compiled to a `.so` library that needs to be placed in neovim's `runtimepath` (typically under `parser/{language}.so`). +To simplify this, `nvim-treesitter` provides commands to automate this process. +If the language is already [supported by `nvim-treesitter`](#supported-languages), you can install it with + +```vim +:TSInstall +``` + +This command supports tab expansion. +You can also get a list of all available languages and their installation status with `:TSInstallInfo`. +Parsers not on this list can be added manually by following the steps described under ["Adding parsers"](#adding-parsers) below. + +To make sure a parser is at the latest compatible version (as specified in `nvim-treesitter`'s `lockfile.json`), use `:TSUpdate {language}`. To update all parsers unconditionally, use `:TSUpdate all` or just `:TSUpdate`. + +## Modules + +Each module provides a distinct tree-sitter-based feature such as [highlighting](#highlight), [indentation](#indentation), or [folding](#folding); see [`:h nvim-treesitter-modules`](doc/nvim-treesitter.txt) or ["Available modules"](#available-modules) below for a list of modules and their options. + +Following examples assume that you are configuring neovim with lua. If you are using vimscript, see `:h lua-heredoc`. +All modules are disabled by default and need to be activated explicitly in your `init.lua`, e.g., via + +```lua +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { "c", "lua", "vim", "vimdoc", "query" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + -- List of parsers to ignore installing (or "all") + ignore_install = { "javascript" }, + + ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) + -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! + + highlight = { + enable = true, + + -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to + -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is + -- the name of the parser) + -- list of language that will be disabled + disable = { "c", "rust" }, + -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files + disable = function(lang, buf) + local max_filesize = 100 * 1024 -- 100 KB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + return true + end + end, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +} +``` + +Each module can also be enabled or disabled interactively through the following commands: + +```vim +:TSBufEnable {module} " enable module on current buffer +:TSBufDisable {module} " disable module on current buffer +:TSEnable {module} [{ft}] " enable module on every buffer. If filetype is specified, enable only for this filetype. +:TSDisable {module} [{ft}] " disable module on every buffer. If filetype is specified, disable only for this filetype. +:TSModuleInfo [{module}] " list information about modules state for each filetype +``` + +Check [`:h nvim-treesitter-commands`](doc/nvim-treesitter.txt) for a list of all available commands. +It may be necessary to reload the buffer (e.g., via `:e`) after enabling a module interactively. + +# Supported languages + +For `nvim-treesitter` to support a specific feature for a specific language requires both a parser for that language and an appropriate language-specific query file for that feature. + +The following is a list of languages for which a parser can be installed through `:TSInstall`; a checked box means that `nvim-treesitter` also contains queries at least for the `highlight` module. + +Experimental parsers are parsers that have a maintainer but are not stable enough for +daily use yet. + +We are looking for maintainers to add more parsers and to write query files for their languages. Check our [tracking issue](https://github.com/nvim-treesitter/nvim-treesitter/issues/2282) for open language requests. + + + +- [x] [ada](https://github.com/briot/tree-sitter-ada) (maintained by @briot) +- [x] [agda](https://github.com/tree-sitter/tree-sitter-agda) (maintained by @Decodetalkers) +- [ ] [angular](https://github.com/steelsojka/tree-sitter-angular) (experimental) +- [x] [apex](https://github.com/aheber/tree-sitter-sfapex) (maintained by @aheber) +- [x] [arduino](https://github.com/ObserverOfTime/tree-sitter-arduino) (maintained by @ObserverOfTime) +- [x] [astro](https://github.com/virchau13/tree-sitter-astro) (maintained by @virchau13) +- [x] [authzed](https://github.com/mleonidas/tree-sitter-authzed) (maintained by @mattpolzin) +- [ ] [awk](https://github.com/Beaglefoot/tree-sitter-awk) +- [x] [bash](https://github.com/tree-sitter/tree-sitter-bash) (maintained by @TravonteD) +- [x] [bass](https://github.com/amaanq/tree-sitter-bass) (maintained by @amaanq) +- [x] [beancount](https://github.com/polarmutex/tree-sitter-beancount) (maintained by @polarmutex) +- [x] [bibtex](https://github.com/latex-lsp/tree-sitter-bibtex) (maintained by @theHamsta, @clason) +- [x] [bicep](https://github.com/amaanq/tree-sitter-bicep) (maintained by @amaanq) +- [x] [bitbake](https://github.com/amaanq/tree-sitter-bitbake) (maintained by @amaanq) +- [x] [blueprint](https://gitlab.com/gabmus/tree-sitter-blueprint.git) (experimental, maintained by @gabmus) +- [x] [c](https://github.com/tree-sitter/tree-sitter-c) (maintained by @amaanq) +- [x] [c_sharp](https://github.com/tree-sitter/tree-sitter-c-sharp) (maintained by @Luxed) +- [x] [cairo](https://github.com/amaanq/tree-sitter-cairo) (maintained by @amaanq) +- [x] [capnp](https://github.com/amaanq/tree-sitter-capnp) (maintained by @amaanq) +- [x] [chatito](https://github.com/ObserverOfTime/tree-sitter-chatito) (maintained by @ObserverOfTime) +- [x] [clojure](https://github.com/sogaiu/tree-sitter-clojure) (maintained by @NoahTheDuke) +- [x] [cmake](https://github.com/uyha/tree-sitter-cmake) (maintained by @uyha) +- [x] [comment](https://github.com/stsewd/tree-sitter-comment) (maintained by @stsewd) +- [x] [commonlisp](https://github.com/theHamsta/tree-sitter-commonlisp) (maintained by @theHamsta) +- [x] [cooklang](https://github.com/addcninblue/tree-sitter-cooklang) (maintained by @addcninblue) +- [x] [corn](https://github.com/jakestanger/tree-sitter-corn) (maintained by @jakestanger) +- [x] [cpon](https://github.com/amaanq/tree-sitter-cpon) (maintained by @amaanq) +- [x] [cpp](https://github.com/tree-sitter/tree-sitter-cpp) (maintained by @theHamsta) +- [x] [css](https://github.com/tree-sitter/tree-sitter-css) (maintained by @TravonteD) +- [x] [csv](https://github.com/amaanq/tree-sitter-csv) (maintained by @amaanq) +- [x] [cuda](https://github.com/theHamsta/tree-sitter-cuda) (maintained by @theHamsta) +- [x] [cue](https://github.com/eonpatapon/tree-sitter-cue) (maintained by @amaanq) +- [x] [d](https://github.com/CyberShadow/tree-sitter-d) (experimental, maintained by @nawordar) +- [x] [dart](https://github.com/UserNobody14/tree-sitter-dart) (maintained by @akinsho) +- [x] [devicetree](https://github.com/joelspadin/tree-sitter-devicetree) (maintained by @jedrzejboczar) +- [x] [dhall](https://github.com/jbellerb/tree-sitter-dhall) (maintained by @amaanq) +- [x] [diff](https://github.com/the-mikedavis/tree-sitter-diff) (maintained by @gbprod) +- [x] [dockerfile](https://github.com/camdencheek/tree-sitter-dockerfile) (maintained by @camdencheek) +- [x] [dot](https://github.com/rydesun/tree-sitter-dot) (maintained by @rydesun) +- [x] [doxygen](https://github.com/amaanq/tree-sitter-doxygen) (maintained by @amaanq) +- [x] [dtd](https://github.com/ObserverOfTime/tree-sitter-xml) (maintained by @ObserverOfTime) +- [x] [ebnf](https://github.com/RubixDev/ebnf) (experimental, maintained by @RubixDev) +- [x] [eds](https://github.com/uyha/tree-sitter-eds) (maintained by @uyha) +- [x] [eex](https://github.com/connorlay/tree-sitter-eex) (maintained by @connorlay) +- [x] [elixir](https://github.com/elixir-lang/tree-sitter-elixir) (maintained by @connorlay) +- [x] [elm](https://github.com/elm-tooling/tree-sitter-elm) (maintained by @zweimach) +- [x] [elsa](https://github.com/glapa-grossklag/tree-sitter-elsa) (maintained by @glapa-grossklag, @amaanq) +- [x] [elvish](https://github.com/elves/tree-sitter-elvish) (maintained by @elves) +- [ ] [embedded_template](https://github.com/tree-sitter/tree-sitter-embedded-template) +- [x] [erlang](https://github.com/WhatsApp/tree-sitter-erlang) (maintained by @filmor) +- [x] [facility](https://github.com/FacilityApi/tree-sitter-facility) (maintained by @bryankenote) +- [x] [fennel](https://github.com/travonted/tree-sitter-fennel) (maintained by @TravonteD) +- [x] [firrtl](https://github.com/amaanq/tree-sitter-firrtl) (maintained by @amaanq) +- [x] [fish](https://github.com/ram02z/tree-sitter-fish) (maintained by @ram02z) +- [x] [foam](https://github.com/FoamScience/tree-sitter-foam) (experimental, maintained by @FoamScience) +- [x] [forth](https://github.com/AlexanderBrevig/tree-sitter-forth) (maintained by @amaanq) +- [x] [fortran](https://github.com/stadelmanma/tree-sitter-fortran) (maintained by @amaanq) +- [x] [fsh](https://github.com/mgramigna/tree-sitter-fsh) (maintained by @mgramigna) +- [x] [func](https://github.com/amaanq/tree-sitter-func) (maintained by @amaanq) +- [x] [fusion](https://gitlab.com/jirgn/tree-sitter-fusion.git) (maintained by @jirgn) +- [x] [Godot (gdscript)](https://github.com/PrestonKnopp/tree-sitter-gdscript) (maintained by @PrestonKnopp) +- [x] [git_config](https://github.com/the-mikedavis/tree-sitter-git-config) (maintained by @amaanq) +- [x] [git_rebase](https://github.com/the-mikedavis/tree-sitter-git-rebase) (maintained by @gbprod) +- [x] [gitattributes](https://github.com/ObserverOfTime/tree-sitter-gitattributes) (maintained by @ObserverOfTime) +- [x] [gitcommit](https://github.com/gbprod/tree-sitter-gitcommit) (maintained by @gbprod) +- [x] [gitignore](https://github.com/shunsambongi/tree-sitter-gitignore) (maintained by @theHamsta) +- [x] [gleam](https://github.com/gleam-lang/tree-sitter-gleam) (maintained by @amaanq) +- [x] [Glimmer and Ember](https://github.com/alexlafroscia/tree-sitter-glimmer) (maintained by @NullVoxPopuli) +- [x] [glsl](https://github.com/theHamsta/tree-sitter-glsl) (maintained by @theHamsta) +- [x] [GN (Generate Ninja)](https://github.com/amaanq/tree-sitter-gn) (maintained by @amaanq) +- [x] [go](https://github.com/tree-sitter/tree-sitter-go) (maintained by @theHamsta, @WinWisely268) +- [x] [Godot Resources (gdresource)](https://github.com/PrestonKnopp/tree-sitter-godot-resource) (maintained by @pierpo) +- [x] [gomod](https://github.com/camdencheek/tree-sitter-go-mod) (maintained by @camdencheek) +- [x] [gosum](https://github.com/amaanq/tree-sitter-go-sum) (maintained by @amaanq) +- [x] [gowork](https://github.com/omertuc/tree-sitter-go-work) (maintained by @omertuc) +- [x] [gpg](https://github.com/ObserverOfTime/tree-sitter-gpg-config) (maintained by @ObserverOfTime) +- [x] [graphql](https://github.com/bkegley/tree-sitter-graphql) (maintained by @bkegley) +- [x] [groovy](https://github.com/Decodetalkers/tree-sitter-groovy) (maintained by @Decodetalkers) +- [x] [gstlaunch](https://github.com/theHamsta/tree-sitter-gstlaunch) (maintained by @theHamsta) +- [ ] [hack](https://github.com/slackhq/tree-sitter-hack) +- [x] [hare](https://github.com/amaanq/tree-sitter-hare) (maintained by @amaanq) +- [x] [haskell](https://github.com/tree-sitter/tree-sitter-haskell) (maintained by @mrcjkb) +- [x] [haskell_persistent](https://github.com/MercuryTechnologies/tree-sitter-haskell-persistent) (maintained by @lykahb) +- [x] [hcl](https://github.com/MichaHoffmann/tree-sitter-hcl) (maintained by @MichaHoffmann) +- [x] [heex](https://github.com/connorlay/tree-sitter-heex) (maintained by @connorlay) +- [x] [hjson](https://github.com/winston0410/tree-sitter-hjson) (maintained by @winston0410) +- [x] [hlsl](https://github.com/theHamsta/tree-sitter-hlsl) (maintained by @theHamsta) +- [x] [hocon](https://github.com/antosha417/tree-sitter-hocon) (maintained by @antosha417) +- [x] [hoon](https://github.com/urbit-pilled/tree-sitter-hoon) (experimental, maintained by @urbit-pilled) +- [x] [html](https://github.com/tree-sitter/tree-sitter-html) (maintained by @TravonteD) +- [x] [htmldjango](https://github.com/interdependence/tree-sitter-htmldjango) (experimental, maintained by @ObserverOfTime) +- [x] [http](https://github.com/rest-nvim/tree-sitter-http) (maintained by @amaanq) +- [x] [hurl](https://github.com/pfeiferj/tree-sitter-hurl) (maintained by @pfeiferj) +- [x] [ini](https://github.com/justinmk/tree-sitter-ini) (experimental, maintained by @theHamsta) +- [x] [ispc](https://github.com/fab4100/tree-sitter-ispc) (maintained by @fab4100) +- [x] [janet_simple](https://github.com/sogaiu/tree-sitter-janet-simple) (maintained by @sogaiu) +- [x] [java](https://github.com/tree-sitter/tree-sitter-java) (maintained by @p00f) +- [x] [javascript](https://github.com/tree-sitter/tree-sitter-javascript) (maintained by @steelsojka) +- [x] [jq](https://github.com/flurie/tree-sitter-jq) (maintained by @ObserverOfTime) +- [x] [jsdoc](https://github.com/tree-sitter/tree-sitter-jsdoc) (maintained by @steelsojka) +- [x] [json](https://github.com/tree-sitter/tree-sitter-json) (maintained by @steelsojka) +- [x] [json5](https://github.com/Joakker/tree-sitter-json5) (maintained by @Joakker) +- [x] [JSON with comments](https://gitlab.com/WhyNotHugo/tree-sitter-jsonc.git) (maintained by @WhyNotHugo) +- [x] [jsonnet](https://github.com/sourcegraph/tree-sitter-jsonnet) (maintained by @nawordar) +- [x] [julia](https://github.com/tree-sitter/tree-sitter-julia) (maintained by @theHamsta) +- [x] [kconfig](https://github.com/amaanq/tree-sitter-kconfig) (maintained by @amaanq) +- [x] [kdl](https://github.com/amaanq/tree-sitter-kdl) (maintained by @amaanq) +- [x] [kotlin](https://github.com/fwcd/tree-sitter-kotlin) (maintained by @SalBakraa) +- [x] [kusto](https://github.com/Willem-J-an/tree-sitter-kusto) (maintained by @Willem-J-an) +- [x] [lalrpop](https://github.com/traxys/tree-sitter-lalrpop) (maintained by @traxys) +- [x] [latex](https://github.com/latex-lsp/tree-sitter-latex) (maintained by @theHamsta, @clason) +- [x] [ledger](https://github.com/cbarrete/tree-sitter-ledger) (maintained by @cbarrete) +- [x] [leo](https://github.com/r001/tree-sitter-leo) (maintained by @r001) +- [x] [linkerscript](https://github.com/amaanq/tree-sitter-linkerscript) (maintained by @amaanq) +- [x] [liquidsoap](https://github.com/savonet/tree-sitter-liquidsoap) (maintained by @toots) +- [x] [llvm](https://github.com/benwilliamgraham/tree-sitter-llvm) (maintained by @benwilliamgraham) +- [x] [lua](https://github.com/MunifTanjim/tree-sitter-lua) (maintained by @muniftanjim) +- [x] [luadoc](https://github.com/amaanq/tree-sitter-luadoc) (maintained by @amaanq) +- [x] [lua patterns](https://github.com/amaanq/tree-sitter-luap) (maintained by @amaanq) +- [x] [luau](https://github.com/amaanq/tree-sitter-luau) (maintained by @amaanq) +- [x] [m68k](https://github.com/grahambates/tree-sitter-m68k) (maintained by @grahambates) +- [x] [make](https://github.com/alemuller/tree-sitter-make) (maintained by @lewis6991) +- [x] [markdown (basic highlighting)](https://github.com/MDeiml/tree-sitter-markdown) (experimental, maintained by @MDeiml) +- [x] [markdown_inline (needed for full highlighting)](https://github.com/MDeiml/tree-sitter-markdown) (experimental, maintained by @MDeiml) +- [x] [matlab](https://github.com/acristoffers/tree-sitter-matlab) (maintained by @acristoffers) +- [x] [menhir](https://github.com/Kerl13/tree-sitter-menhir) (maintained by @Kerl13) +- [ ] [mermaid](https://github.com/monaqa/tree-sitter-mermaid) (experimental) +- [x] [meson](https://github.com/Decodetalkers/tree-sitter-meson) (maintained by @Decodetalkers) +- [x] [mlir](https://github.com/artagnon/tree-sitter-mlir) (experimental, maintained by @artagnon) +- [x] [nasm](https://github.com/naclsn/tree-sitter-nasm) (maintained by @ObserverOfTime) +- [ ] [nickel](https://github.com/nickel-lang/tree-sitter-nickel) +- [x] [nim](https://github.com/alaviss/tree-sitter-nim) (maintained by @aMOPel) +- [x] [nim_format_string](https://github.com/aMOPel/tree-sitter-nim-format-string) (maintained by @aMOPel) +- [x] [ninja](https://github.com/alemuller/tree-sitter-ninja) (maintained by @alemuller) +- [x] [nix](https://github.com/cstrahan/tree-sitter-nix) (maintained by @leo60228) +- [x] [norg](https://github.com/nvim-neorg/tree-sitter-norg) (maintained by @JoeyGrajciar, @vhyrro) +- [x] [nqc](https://github.com/amaanq/tree-sitter-nqc) (maintained by @amaanq) +- [x] [objc](https://github.com/amaanq/tree-sitter-objc) (maintained by @amaanq) +- [x] [objdump](https://github.com/ColinKennedy/tree-sitter-objdump) (maintained by @ColinKennedy) +- [x] [ocaml](https://github.com/tree-sitter/tree-sitter-ocaml) (maintained by @undu) +- [x] [ocaml_interface](https://github.com/tree-sitter/tree-sitter-ocaml) (maintained by @undu) +- [x] [ocamllex](https://github.com/atom-ocaml/tree-sitter-ocamllex) (maintained by @undu) +- [x] [odin](https://github.com/amaanq/tree-sitter-odin) (maintained by @amaanq) +- [ ] [org](https://github.com/milisims/tree-sitter-org) +- [x] [pascal](https://github.com/Isopod/tree-sitter-pascal.git) (maintained by @Isopod) +- [x] [passwd](https://github.com/ath3/tree-sitter-passwd) (maintained by @amaanq) +- [x] [pem](https://github.com/ObserverOfTime/tree-sitter-pem) (maintained by @ObserverOfTime) +- [x] [perl](https://github.com/tree-sitter-perl/tree-sitter-perl) (maintained by @RabbiVeesh, @LeoNerd) +- [x] [php](https://github.com/tree-sitter/tree-sitter-php) (maintained by @tk-shirasaka) +- [x] [phpdoc](https://github.com/claytonrcarter/tree-sitter-phpdoc) (experimental, maintained by @mikehaertl) +- [x] [pioasm](https://github.com/leo60228/tree-sitter-pioasm) (maintained by @leo60228) +- [x] [po](https://github.com/erasin/tree-sitter-po) (maintained by @amaanq) +- [x] [pod](https://github.com/tree-sitter-perl/tree-sitter-pod) (maintained by @RabbiVeesh, @LeoNerd) +- [x] [Path of Exile item filter](https://github.com/ObserverOfTime/tree-sitter-poe-filter) (experimental, maintained by @ObserverOfTime) +- [x] [pony](https://github.com/amaanq/tree-sitter-pony) (maintained by @amaanq, @mfelsche) +- [x] [prisma](https://github.com/victorhqc/tree-sitter-prisma) (maintained by @elianiva) +- [x] [promql](https://github.com/MichaHoffmann/tree-sitter-promql) (maintained by @MichaHoffmann) +- [x] [properties](https://github.com/ObserverOfTime/tree-sitter-properties) (maintained by @ObserverOfTime) +- [x] [proto](https://github.com/treywood/tree-sitter-proto) (maintained by @treywood) +- [x] [prql](https://github.com/PRQL/tree-sitter-prql) (maintained by @matthias-Q) +- [x] [psv](https://github.com/amaanq/tree-sitter-csv) (maintained by @amaanq) +- [x] [pug](https://github.com/zealot128/tree-sitter-pug) (experimental, maintained by @zealot128) +- [x] [puppet](https://github.com/amaanq/tree-sitter-puppet) (maintained by @amaanq) +- [x] [purescript](https://github.com/postsolar/tree-sitter-purescript) (maintained by @postsolar) +- [x] [PyPA manifest](https://github.com/ObserverOfTime/tree-sitter-pymanifest) (maintained by @ObserverOfTime) +- [x] [python](https://github.com/tree-sitter/tree-sitter-python) (maintained by @stsewd, @theHamsta) +- [x] [ql](https://github.com/tree-sitter/tree-sitter-ql) (maintained by @pwntester) +- [x] [qmldir](https://github.com/Decodetalkers/tree-sitter-qmldir) (maintained by @amaanq) +- [x] [qmljs](https://github.com/yuja/tree-sitter-qmljs) (maintained by @Decodetalkers) +- [x] [Tree-Sitter query language](https://github.com/nvim-treesitter/tree-sitter-query) (maintained by @steelsojka) +- [x] [r](https://github.com/r-lib/tree-sitter-r) (maintained by @echasnovski) +- [ ] [racket](https://github.com/6cdh/tree-sitter-racket) +- [x] [rasi](https://github.com/Fymyte/tree-sitter-rasi) (maintained by @Fymyte) +- [x] [rbs](https://github.com/joker1007/tree-sitter-rbs) (maintained by @joker1007) +- [x] [re2c](https://github.com/amaanq/tree-sitter-re2c) (maintained by @amaanq) +- [x] [regex](https://github.com/tree-sitter/tree-sitter-regex) (maintained by @theHamsta) +- [x] [rego](https://github.com/FallenAngel97/tree-sitter-rego) (maintained by @FallenAngel97) +- [x] [pip requirements](https://github.com/ObserverOfTime/tree-sitter-requirements) (maintained by @ObserverOfTime) +- [x] [rnoweb](https://github.com/bamonroe/tree-sitter-rnoweb) (maintained by @bamonroe) +- [x] [robot](https://github.com/Hubro/tree-sitter-robot) (maintained by @Hubro) +- [x] [ron](https://github.com/amaanq/tree-sitter-ron) (maintained by @amaanq) +- [x] [rst](https://github.com/stsewd/tree-sitter-rst) (maintained by @stsewd) +- [x] [ruby](https://github.com/tree-sitter/tree-sitter-ruby) (maintained by @TravonteD) +- [x] [rust](https://github.com/tree-sitter/tree-sitter-rust) (maintained by @amaanq) +- [x] [scala](https://github.com/tree-sitter/tree-sitter-scala) (maintained by @stevanmilic) +- [x] [scfg](https://git.sr.ht/~rockorager/tree-sitter-scfg) (maintained by @WhyNotHugo) +- [ ] [scheme](https://github.com/6cdh/tree-sitter-scheme) +- [x] [scss](https://github.com/serenadeai/tree-sitter-scss) (maintained by @elianiva) +- [x] [slang](https://github.com/theHamsta/tree-sitter-slang) (experimental, maintained by @theHamsta) +- [x] [slint](https://github.com/jrmoulton/tree-sitter-slint) (experimental, maintained by @jrmoulton) +- [x] [smali](https://git.sr.ht/~yotam/tree-sitter-smali) (maintained by @amaanq) +- [x] [smithy](https://github.com/indoorvivants/tree-sitter-smithy) (maintained by @amaanq, @keynmol) +- [ ] [snakemake](https://github.com/osthomas/tree-sitter-snakemake) (experimental) +- [x] [solidity](https://github.com/JoranHonig/tree-sitter-solidity) (maintained by @amaanq) +- [x] [soql](https://github.com/aheber/tree-sitter-sfapex) (maintained by @aheber) +- [x] [sosl](https://github.com/aheber/tree-sitter-sfapex) (maintained by @aheber) +- [x] [sparql](https://github.com/BonaBeavis/tree-sitter-sparql) (maintained by @BonaBeavis) +- [x] [sql](https://github.com/derekstride/tree-sitter-sql) (maintained by @derekstride) +- [x] [squirrel](https://github.com/amaanq/tree-sitter-squirrel) (maintained by @amaanq) +- [x] [ssh_config](https://github.com/ObserverOfTime/tree-sitter-ssh-config) (maintained by @ObserverOfTime) +- [x] [starlark](https://github.com/amaanq/tree-sitter-starlark) (maintained by @amaanq) +- [x] [strace](https://github.com/sigmaSd/tree-sitter-strace) (maintained by @amaanq) +- [x] [styled](https://github.com/mskelton/tree-sitter-styled) (maintained by @mskelton) +- [x] [supercollider](https://github.com/madskjeldgaard/tree-sitter-supercollider) (maintained by @madskjeldgaard) +- [x] [surface](https://github.com/connorlay/tree-sitter-surface) (maintained by @connorlay) +- [x] [svelte](https://github.com/Himujjal/tree-sitter-svelte) (maintained by @elianiva) +- [x] [swift](https://github.com/alex-pinkus/tree-sitter-swift) (maintained by @alex-pinkus) +- [x] [sxhkdrc](https://github.com/RaafatTurki/tree-sitter-sxhkdrc) (maintained by @RaafatTurki) +- [x] [systemtap](https://github.com/ok-ryoko/tree-sitter-systemtap) (maintained by @ok-ryoko) +- [x] [t32](https://gitlab.com/xasc/tree-sitter-t32.git) (maintained by @xasc) +- [x] [tablegen](https://github.com/amaanq/tree-sitter-tablegen) (maintained by @amaanq) +- [x] [teal](https://github.com/euclidianAce/tree-sitter-teal) (maintained by @euclidianAce) +- [x] [templ](https://github.com/vrischmann/tree-sitter-templ) (maintained by @vrischmann) +- [x] [terraform](https://github.com/MichaHoffmann/tree-sitter-hcl) (maintained by @MichaHoffmann) +- [x] [textproto](https://github.com/PorterAtGoogle/tree-sitter-textproto) (maintained by @Porter) +- [x] [thrift](https://github.com/duskmoon314/tree-sitter-thrift) (maintained by @amaanq, @duskmoon314) +- [x] [tiger](https://github.com/ambroisie/tree-sitter-tiger) (maintained by @ambroisie) +- [x] [tlaplus](https://github.com/tlaplus-community/tree-sitter-tlaplus) (maintained by @ahelwer, @susliko) +- [x] [todotxt](https://github.com/arnarg/tree-sitter-todotxt.git) (experimental, maintained by @arnarg) +- [x] [toml](https://github.com/ikatyang/tree-sitter-toml) (maintained by @tk-shirasaka) +- [x] [tsv](https://github.com/amaanq/tree-sitter-csv) (maintained by @amaanq) +- [x] [tsx](https://github.com/tree-sitter/tree-sitter-typescript) (maintained by @steelsojka) +- [x] [turtle](https://github.com/BonaBeavis/tree-sitter-turtle) (maintained by @BonaBeavis) +- [x] [twig](https://github.com/gbprod/tree-sitter-twig) (maintained by @gbprod) +- [x] [typescript](https://github.com/tree-sitter/tree-sitter-typescript) (maintained by @steelsojka) +- [x] [typoscript](https://github.com/Teddytrombone/tree-sitter-typoscript) (maintained by @Teddytrombone) +- [x] [udev](https://github.com/ObserverOfTime/tree-sitter-udev) (maintained by @ObserverOfTime) +- [x] [ungrammar](https://github.com/Philipp-M/tree-sitter-ungrammar) (maintained by @Philipp-M, @amaanq) +- [x] [unison](https://github.com/kylegoetz/tree-sitter-unison) (maintained by @tapegram) +- [x] [usd](https://github.com/ColinKennedy/tree-sitter-usd) (maintained by @ColinKennedy) +- [x] [uxn tal](https://github.com/amaanq/tree-sitter-uxntal) (maintained by @amaanq) +- [x] [v](https://github.com/v-analyzer/v-analyzer) (maintained by @kkharji, @amaanq) +- [x] [vala](https://github.com/vala-lang/tree-sitter-vala) (maintained by @Prince781) +- [x] [verilog](https://github.com/tree-sitter/tree-sitter-verilog) (maintained by @zegervdv) +- [x] [vhs](https://github.com/charmbracelet/tree-sitter-vhs) (maintained by @caarlos0) +- [x] [vim](https://github.com/neovim/tree-sitter-vim) (maintained by @clason) +- [x] [vimdoc](https://github.com/neovim/tree-sitter-vimdoc) (maintained by @clason) +- [x] [vue](https://github.com/ikatyang/tree-sitter-vue) (maintained by @WhyNotHugo) +- [x] [wgsl](https://github.com/szebniok/tree-sitter-wgsl) (maintained by @szebniok) +- [x] [wgsl_bevy](https://github.com/theHamsta/tree-sitter-wgsl-bevy) (maintained by @theHamsta) +- [x] [wing](https://github.com/winglang/wing) (experimental, maintained by @gshpychka, @MarkMcCulloh) +- [x] [xcompose](https://github.com/ObserverOfTime/tree-sitter-xcompose) (maintained by @ObserverOfTime) +- [x] [xml](https://github.com/ObserverOfTime/tree-sitter-xml) (maintained by @ObserverOfTime) +- [x] [yaml](https://github.com/ikatyang/tree-sitter-yaml) (maintained by @stsewd) +- [x] [yang](https://github.com/Hubro/tree-sitter-yang) (maintained by @Hubro) +- [x] [yuck](https://github.com/Philipp-M/tree-sitter-yuck) (maintained by @Philipp-M, @amaanq) +- [x] [zig](https://github.com/maxxnino/tree-sitter-zig) (maintained by @maxxnino) + + +For related information on the supported languages, including related plugins, see [this wiki page](https://github.com/nvim-treesitter/nvim-treesitter/wiki/Supported-Languages-Information). + +# Available modules + +Modules provide the top-level features of `nvim-treesitter`. +The following is a list of modules included in `nvim-treesitter` and their configuration via `init.lua` (where multiple modules can be combined in a single call to `setup`). +Note that not all modules work for all languages (depending on the queries available for them). +Additional modules can be provided as [external plugins](https://github.com/nvim-treesitter/nvim-treesitter/wiki/Extra-modules-and-plugins). + +#### Highlight + +Consistent syntax highlighting. + +```lua +require'nvim-treesitter.configs'.setup { + highlight = { + enable = true, + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +} +``` + +To customize the syntax highlighting of a capture, simply define or link a highlight group of the same name: + +```lua +-- Highlight the @foo.bar capture group with the "Identifier" highlight group +vim.api.nvim_set_hl(0, "@foo.bar", { link = "Identifier" }) +``` + +For a language-specific highlight, append the name of the language: + +```lua +-- Highlight @foo.bar as "Identifier" only in Lua files +vim.api.nvim_set_hl(0, "@foo.bar.lua", { link = "Identifier" }) +``` + +See `:h treesitter-highlight-groups` for details. + +#### Incremental selection + +Incremental selection based on the named nodes from the grammar. + +```lua +require'nvim-treesitter.configs'.setup { + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", -- set to `false` to disable one of the mappings + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", + }, + }, +} +``` + +#### Indentation + +Indentation based on treesitter for the `=` operator. +**NOTE: This is an experimental feature**. + +```lua +require'nvim-treesitter.configs'.setup { + indent = { + enable = true + } +} +``` + +#### Folding + +Tree-sitter based folding. _(Technically not a module because it's per windows and not per buffer.)_ + +```vim +set foldmethod=expr +set foldexpr=nvim_treesitter#foldexpr() +set nofoldenable " Disable folding at startup. +``` + +This will respect your `foldminlines` and `foldnestmax` settings. + +# Advanced setup + +## Changing the parser install directory + +If you want to install the parsers to a custom directory you can specify this +directory with `parser_install_dir` option in that is passed to `setup`. +`nvim-treesitter` will then install the parser files into this directory. + +This directory must be writeable and must be explicitly added to the +`runtimepath`. For example: + +```lua + vim.opt.runtimepath:append("/some/path/to/store/parsers") + + require'nvim-treesitter.configs'.setup { + parser_install_dir = "/some/path/to/store/parsers", + + ... + + } +``` + +If this option is not included in the setup options, or is explicitly set to +`nil` then the default install directories will be used. If this value is set +the default directories will be ignored. + +Bear in mind that any parser installed into a parser folder on the runtime path +will still be considered installed. (For example if +"~/.local/share/nvim/site/parser/c.so" exists then the "c" parser will be +considered installed, even though it is not in `parser_install_dir`) + +The default paths are: + +1. first the package folder. Where `nvim-treesitter` is installed. +2. second the site directory. This is the "site" subdirectory of `stdpath("data")`. + +## Adding parsers + +If you have a parser that is not on the list of supported languages (either as a repository on Github or in a local directory), you can add it manually for use by `nvim-treesitter` as follows: + +1. Clone the repository or [create a new project](https://tree-sitter.github.io/tree-sitter/creating-parsers#project-setup) in, say, `~/projects/tree-sitter-zimbu`. Make sure that the `tree-sitter-cli` executable is installed and in your path; see for installation instructions. +2. Run `tree-sitter generate` in this directory (followed by `tree-sitter test` for good measure). +3. Add the following snippet to your `init.lua`: + +```lua +local parser_config = require "nvim-treesitter.parsers".get_parser_configs() +parser_config.zimbu = { + install_info = { + url = "~/projects/tree-sitter-zimbu", -- local path or git repo + files = {"src/parser.c"}, -- note that some parsers also require src/scanner.c or src/scanner.cc + -- optional entries: + branch = "main", -- default branch in case of git repo if different from master + generate_requires_npm = false, -- if stand-alone parser without npm dependencies + requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c + }, + filetype = "zu", -- if filetype does not match the parser name +} +``` + +If you wish to set a specific parser for a filetype, you should use `vim.treesitter.language.register()`: + +```lua +vim.treesitter.language.register('python', 'someft') -- the someft filetype will use the python parser and queries. +``` + +Note this requires Nvim v0.9. + +4. Start `nvim` and `:TSInstall zimbu`. + +You can also skip step 2 and use `:TSInstallFromGrammar zimbu` to install directly from a `grammar.js` in the top-level directory specified by `url`. +Once the parser is installed, you can update it (from the latest revision of the `main` branch if `url` is a Github repository) with `:TSUpdate zimbu`. + +Note that neither `:TSInstall` nor `:TSInstallFromGrammar` copy query files from the grammar repository. +If you want your installed grammar to be useful, you must manually [add query files](#adding-queries) to your local nvim-treesitter installation. +Note also that module functionality is only triggered if your language's filetype is correctly identified. +If Neovim does not detect your language's filetype by default, you can use [Neovim's `vim.filetype.add()`]() to add a custom detection rule. + +If you use a git repository for your parser and want to use a specific version, you can set the `revision` key +in the `install_info` table for you parser config. + +## Adding queries + +Queries are what `nvim-treesitter` uses to extract information from the syntax tree; +they are located in the `queries/{language}/*` runtime directories (see `:h rtp`), +like the `queries` folder of this plugin, e.g. `queries/{language}/{locals,highlights,textobjects}.scm`. +Other modules may require additional queries such as `folding.scm`. You can find a +list of all supported capture names in [CONTRIBUTING.md](https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations). + +All queries found in the runtime directories will be combined. +By convention, if you want to write a query, use the `queries/` directory, +but if you want to extend a query use the `after/queries/` directory. + +If you want to completely override a query, you can use `:h set_query()`. +For example, to override the `injections` queries from `c` with your own: + +```lua +require("vim.treesitter.query").set_query("c", "injections", "(comment) @comment") +``` + +Note: when using `set_query`, all queries in the runtime directories will be ignored. + +## Adding modules + +If you wish you write your own module, you need to support + +- tree-sitter language detection support; +- attaching and detaching to buffers; +- all nvim-treesitter commands. + +At the top level, you can use the `define_modules` function to define one or more modules or module groups: + +```lua +require'nvim-treesitter'.define_modules { + my_cool_plugin = { + attach = function(bufnr, lang) + -- Do cool stuff here + end, + detach = function(bufnr) + -- Undo cool stuff here + end, + is_supported = function(lang) + -- Check if the language is supported + end + } +} +``` + +with the following properties: + +- `module_path` specifies a require path (string) that exports a module with an `attach` and `detach` function. This is not required if the functions are on this definition. +- `enable` determines if the module is enabled by default. This is usually overridden by the user. +- `disable` takes a list of languages that this module is disabled for. This is usually overridden by the user. +- `is_supported` takes a function that takes a language and determines if this module supports that language. +- `attach` takes a function that attaches to a buffer. This is required if `module_path` is not provided. +- `detach` takes a function that detaches from a buffer. This is required if `module_path` is not provided. + +# Extra features + +### Statusline indicator + +```vim +echo nvim_treesitter#statusline(90) " 90 can be any length +module->expression_statement->call->identifier +``` + +### Utilities + +You can get some utility functions with + +```lua +local ts_utils = require 'nvim-treesitter.ts_utils' +``` + +Check [`:h nvim-treesitter-utils`](doc/nvim-treesitter.txt) for more information. + +# Troubleshooting + +Before doing anything, make sure you have the latest version of this plugin and run `:checkhealth nvim-treesitter`. +It can also help to update the parsers via `:TSUpdate`. + +#### Feature `X` does not work for `{language}`... + +First, check the `health#nvim_treesitter#check` and the `health#treesitter#check` sections of `:checkhealth` for any warning. +If there is one, it's highly likely that this is the cause of the problem. + +Next check the `## Parser/Features` subsection of the `health#nvim_treesitter#check` section of `:checkhealth` to ensure the desired module is enabled for your language. +If not, you might be missing query files; see [Adding queries](#adding-queries). + +Finally, ensure Neovim is correctly identifying your language's filetype using the `:echo &filetype` command while one of your language's files is open in Neovim. +If not, add a short Vimscript file to nvim-treesitter's `ftdetect` runtime directory following [Neovim's documentation](https://neovim.io/doc/user/filetype.html#new-filetype) on filetype detection. +You can also quickly & temporarily set the filetype for a single buffer with the `:set filetype=langname` command to test whether it fixes the problem. + +If everything is okay, then it might be an actual error. +In that case, feel free to [open an issue here](https://github.com/nvim-treesitter/nvim-treesitter/issues/new/choose). + +#### I get `module 'vim.treesitter.query' not found` + +Make sure you have the latest version of Neovim. + +#### I get `Error detected while processing .../plugin/nvim-treesitter.vim` every time I open Neovim + +This is probably due to a change in a parser's grammar or its queries. +Try updating the parser that you suspect has changed (`:TSUpdate {language}`) or all of them (`:TSUpdate`). +If the error persists after updating all parsers, +please [open an issue](https://github.com/nvim-treesitter/nvim-treesitter/issues/new/choose). + +#### I get `query error: invalid node type at position` + +This could be due a query file outside this plugin using outdated nodes, +or due to an outdated parser. + +- Make sure you have the parsers up to date with `:TSUpdate` +- Make sure you don't have more than one `parser` runtime directory. + You can execute this command `:echo nvim_get_runtime_file('parser', v:true)` to find all runtime directories. + If you get more than one path, remove the ones that are outside this plugin (`nvim-treesitter` directory), + so the correct version of the parser is used. + +#### I experience weird highlighting issues similar to [#78](https://github.com/nvim-treesitter/nvim-treesitter/issues/78) + +This is a well known issue, which arises when the tree and the buffer have gotten out of sync. +As this is an upstream issue, we don't have any definite fix. +To get around this, you can force reparsing the buffer with + +```vim +:write | edit | TSBufEnable highlight +``` + +This will save, restore and enable highlighting for the current buffer. + +#### I experience bugs when using `nvim-treesitter`'s `foldexpr` similar to [#194](https://github.com/nvim-treesitter/nvim-treesitter/issues/194) + +This might happen, and is known to happen, with `vim-clap`. +To avoid these kind of errors, please use `setlocal` instead of `set` for the respective filetypes. + +#### I run into errors like `module 'nvim-treesitter.configs' not found` at startup + +This is because of `rtp` management in `nvim`, adding `packadd +nvim-treesitter` should fix the issue. + +#### I want to use Git instead of curl for downloading the parsers + +In your Lua config: + +```lua +require("nvim-treesitter.install").prefer_git = true +``` + +#### I want to use a HTTP proxy for downloading the parsers + +You can either configure curl to use additional CLI arguments in your Lua config: + +```lua +require("nvim-treesitter.install").command_extra_args = { + curl = { "--proxy", "" }, +} +``` + +or you can configure git via `.gitconfig` and use git instead of curl + +```lua +require("nvim-treesitter.install").prefer_git = true +``` + +#### I want to use a mirror instead of "https://github.com/" + +In your Lua config: + +```lua +for _, config in pairs(require("nvim-treesitter.parsers").get_parser_configs()) do + config.install_info.url = config.install_info.url:gsub("https://github.com/", "something else") +end + +require'nvim-treesitter.configs'.setup { + -- + -- +} +``` + +#### Using an existing parser for another filetype + +For example, to use the `bash` tree-sitter to highlight file with +`filetype=apkbuild`, use: + +```lua +vim.treesitter.language.register("bash", "apkbuild") +``` + +The `bash` tree-sitter must be installed following the usual procedure [as +described above](#language-parsers). diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/assets/logo.png b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/assets/logo.png new file mode 100644 index 00000000..a60e536b Binary files /dev/null and b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/assets/logo.png differ diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/autoload/nvim_treesitter.vim b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/autoload/nvim_treesitter.vim new file mode 100644 index 00000000..90953985 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/autoload/nvim_treesitter.vim @@ -0,0 +1,27 @@ +function! nvim_treesitter#statusline(...) abort + return luaeval("require'nvim-treesitter.statusline'.statusline(_A)", get(a:, 1, {})) +endfunction + +function! nvim_treesitter#foldexpr() abort + return luaeval(printf('require"nvim-treesitter.fold".get_fold_indic(%d)', v:lnum)) +endfunction + +function! nvim_treesitter#installable_parsers(arglead, cmdline, cursorpos) abort + return join(luaeval("require'nvim-treesitter.parsers'.available_parsers()") + ['all'], "\n") +endfunction + +function! nvim_treesitter#installed_parsers(arglead, cmdline, cursorpos) abort + return join(luaeval("require'nvim-treesitter.info'.installed_parsers()") + ['all'], "\n") +endfunction + +function! nvim_treesitter#available_modules(arglead, cmdline, cursorpos) abort + return join(luaeval("require'nvim-treesitter.configs'.available_modules()"), "\n") +endfunction + +function! nvim_treesitter#available_query_groups(arglead, cmdline, cursorpos) abort + return join(luaeval("require'nvim-treesitter.query'.available_query_groups()"), "\n") +endfunction + +function! nvim_treesitter#indent() abort + return luaeval(printf('require"nvim-treesitter.indent".get_indent(%d)', v:lnum)) +endfunction diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/contrib/nvim-treesitter-luarocks.template b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/contrib/nvim-treesitter-luarocks.template new file mode 100644 index 00000000..8109f5f2 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/contrib/nvim-treesitter-luarocks.template @@ -0,0 +1,41 @@ +local git_ref = '$git_ref' +local modrev = '$modrev' +local specrev = '-1' + +local repo_url = '$repo_url' + +rockspec_format = '3.0' +package = '$package' +version = modrev .. specrev + +description = { + summary = 'Nvim Treesitter configurations and abstraction layer', + detailed = $detailed_description, + labels = { 'neovim' }, + homepage = 'https://github.com/nvim-treesitter/nvim-treesitter', + license = 'Apache-2.0', +} + +dependencies = { + 'lua >= 5.1', +} + +-- source = file:///. + +source = { + url = repo_url .. '/archive/' .. git_ref .. '.zip', + dir = '$repo_name-' .. '$archive_dir_suffix', +} + +build = { + type = 'make', + build_pass = false, + install_variables = { + INST_PREFIX='$(PREFIX)', + INST_BINDIR='$(BINDIR)', + INST_LIBDIR='$(LIBDIR)', + INST_LUADIR='$(LUADIR)', + INST_CONFDIR='$(CONFDIR)', + }, + copy_directories = $copy_directories, +} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/contrib/nvim-treesitter-scm-1.rockspec b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/contrib/nvim-treesitter-scm-1.rockspec new file mode 100644 index 00000000..a901c5b1 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/contrib/nvim-treesitter-scm-1.rockspec @@ -0,0 +1,36 @@ +local MODREV, SPECREV = 'scm', '-1' +rockspec_format = '3.0' +package = 'nvim-treesitter' +version = MODREV .. SPECREV + +description = { + summary = 'Nvim Treesitter configurations and abstraction layer', + labels = { 'neovim' }, + homepage = 'https://github.com/nvim-treesitter/nvim-treesitter', + license = 'Apache-2.0', +} + +dependencies = { + 'lua >= 5.1', +} + +source = { + url = 'git://github.com/nvim-treesitter/nvim-treesitter', +} + +build = { + type = 'make', + install_variables = { + INST_PREFIX='$(PREFIX)', + INST_BINDIR='$(BINDIR)', + INST_LIBDIR='$(LIBDIR)', + INST_LUADIR='$(LUADIR)', + INST_CONFDIR='$(CONFDIR)', + }, + copy_directories = { + 'autoload', + 'doc', + 'plugin', + 'queries' + } +} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/doc/nvim-treesitter.txt b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/doc/nvim-treesitter.txt new file mode 100644 index 00000000..f7a91b84 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/doc/nvim-treesitter.txt @@ -0,0 +1,590 @@ +*nvim-treesitter* Treesitter configurations and abstraction layer for Neovim. + +Minimum version of neovim: nightly + +Authors: + Kiyan Yazdani + Thomas Vigouroux + Stephan Seitz + Steven Sojka + Santos Gallegos + https://github.com/nvim-treesitter/nvim-treesitter/graphs/contributors + + Type |gO| to see the table of contents. + +============================================================================== +INTRODUCTION *nvim-treesitter-intro* + +nvim-treesitter wraps the Neovim treesitter API to provide functionalities +such as highlighting and incremental selection, and a command to easily +install parsers. + +============================================================================== +QUICK START *nvim-treesitter-quickstart* + +Install the parser for your language + +> + :TSInstall {language} +< + +To get a list of supported languages + +> + :TSInstallInfo +< + +By default, everything is disabled. +To enable supported features, put this in your `init.lua` file: + +> + require'nvim-treesitter.configs'.setup { + -- A directory to install the parsers into. + -- If this is excluded or nil parsers are installed + -- to either the package dir, or the "site" dir. + -- If a custom path is used (not nil) it must be added to the runtimepath. + parser_install_dir = "/some/path/to/store/parsers", + + -- A list of parser names, or "all" + ensure_installed = { "c", "lua", "rust" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + auto_install = false, + + -- List of parsers to ignore installing (for "all") + ignore_install = { "javascript" }, + + highlight = { + -- `false` will disable the whole extension + enable = true, + + -- list of language that will be disabled + disable = { "c", "rust" }, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + } + vim.opt.runtimepath:append("/some/path/to/store/parsers") +< + +See |nvim-treesitter-modules| for a list of all available modules and its options. + +============================================================================== +MODULES *nvim-treesitter-modules* + +|nvim-treesitter| provides several functionalities via modules (and submodules), +each module makes use of the query files defined for each language, + +All modules are disabled by default, and some provide default keymaps. +Each module corresponds to an entry in the dictionary passed to the +`nvim-treesitter.configs.setup` function, this should be in your `init.lua` file. + +> + require'nvim-treesitter.configs'.setup { + -- Modules and its options go here + highlight = { enable = true }, + incremental_selection = { enable = true }, + textobjects = { enable = true }, + } +< + +All modules share some common options, like `enable` and `disable`. +When `enable` is `true` this will enable the module for all supported languages, +if you want to disable the module for some languages you can pass a list to the `disable` option. + +> + require'nvim-treesitter.configs'.setup { + highlight = { + enable = true, + disable = { "cpp", "lua" }, + }, + } +< + +For more fine-grained control, `disable` can also take a function and +whenever it returns `true`, the module is disabled for that buffer. +The function is called once when a module starts in a buffer and receives the +language and buffer number as arguments: + +> + require'nvim-treesitter.configs'.setup { + highlight = { + enable = true, + disable = function(lang, bufnr) -- Disable in large C++ buffers + return lang == "cpp" and vim.api.nvim_buf_line_count(bufnr) > 50000 + end, + }, + } +< + +Options that define or accept a keymap use the same format you use to define +keymaps in Neovim, so you can write keymaps as `gd`, `a`, `a` +`` (control + a), `` (alt + n), `` (enter), etc. + +External plugins can provide their own modules with their own options, +those can also be configured using the `nvim-treesitter.configs.setup` +function. + +------------------------------------------------------------------------------ +HIGHLIGHT *nvim-treesitter-highlight-mod* + +Consistent syntax highlighting. + +Query files: `highlights.scm`. +Supported options: + +- enable: `true` or `false`. +- disable: list of languages. +- additional_vim_regex_highlighting: `true` or `false`, or a list of languages. + Set this to `true` if you depend on 'syntax' being enabled + (like for indentation). Using this option may slow down your editor, + and you may see some duplicate highlights. + Defaults to `false`. + +> + require'nvim-treesitter.configs'.setup { + highlight = { + enable = true, + custom_captures = { + -- Highlight the @foo.bar capture group with the "Identifier" highlight group. + ["foo.bar"] = "Identifier", + }, + -- Setting this to true or a list of languages will run `:h syntax` and tree-sitter at the same time. + additional_vim_regex_highlighting = false, + }, + } +< + +You can also set custom highlight captures +> + lua < + require'nvim-treesitter.configs'.setup { + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", + }, + }, + } +< + +------------------------------------------------------------------------------ +INDENTATION *nvim-treesitter-indentation-mod* + +Indentation based on treesitter for the |=| operator. +NOTE: this is an experimental feature. + +Query files: `indents.scm`. +Supported options: +- enable: `true` or `false`. +- disable: list of languages. +> + require'nvim-treesitter.configs'.setup { + indent = { + enable = true + }, + } + +`@indent` *nvim-treesitter-indentation-queries* +Queries can use the following captures: `@indent.begin` and `@indent.dedent`, +`@indent.branch`, `@indent.end` or `@indent.align`. An `@indent.ignore` capture tells +treesitter to ignore indentation and a `@indent.zero` capture sets +the indentation to 0. + +`@indent.begin` *nvim-treesitter-indentation-indent.begin* +The `@indent.begin` specifies that the next line should be indented. Multiple +indents on the same line get collapsed. Eg. + +> + ( + (if_statement) + (ERROR "else") @indent.begin + ) +< +Indent can also have `indent.immediate` set using a `#set!` directive, which +permits the next line to indent even when the block intended to be indented +has no content yet, improving interactive typing. + +eg for python: +> + ((if_statement) @indent.begin + (#set! indent.immediate 1)) +< + +Will allow: +> + if True: + # Auto indent to here + +`@indent.end` *nvim-treesitter-indentation-indent.end* +An `@indent.end` capture is used to specify that the indented region ends and +any text subsequent to the capture should be dedented. + +`@indent.branch` *nvim-treesitter-indentation-indent.branch* +An `@indent.branch` capture is used to specify that a dedented region starts +at the line including the captured nodes. + +`@indent.dedent` *nvim-treesitter-indentation-indent.dedent* +A `@indent.dedent` capture specifies dedenting starting on the next line. +> +`@indent.align` *nvim-treesitter-indentation-aligned_indent.align* +Aligned indent blocks may be specified with the `@indent.align` capture. +This permits + +> + foo(a, + b, + c) +< +As well as +> + foo( + a, + b, + c) +< +and finally +> + foo( + a, + b, + c + ) +< +To specify the delimiters to use `indent.open_delimiter` and +`indent.close_delimiter` should be used. Eg. +> + ((argument_list) @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) +< + +For some languages the last line of an `indent.align` block must not be +the same indent as the natural next line. + +For example in python: + +> + if (a > b and + c < d): + pass + +Is not correct, whereas +> + if (a > b and + c < d): + pass + +Would be correctly indented. This behavior may be chosen using +`indent.avoid_last_matching_next`. Eg. + +> + (if_statement + condition: (parenthesized_expression) @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")") + (#set! indent.avoid_last_matching_next 1) + ) +< +Could be used to specify that the last line of an `@indent.align` capture +should be additionally indented to avoid clashing with the indent of the first +line of the block inside an if. + +============================================================================== +COMMANDS *nvim-treesitter-commands* + + *:TSInstall* +:TSInstall {language} ...~ + +Install one or more treesitter parsers. +You can use |:TSInstall| `all` to install all parsers. Use |:TSInstall!| to +force the reinstallation of already installed parsers. + *:TSInstallSync* +:TSInstallSync {language} ...~ + +Perform the |:TSInstall| operation synchronously. + + *:TSInstallInfo* +:TSInstallInfo~ + +List information about currently installed parsers + + *:TSUpdate* +:TSUpdate {language} ...~ + +Update the installed parser for one more {language} or all installed parsers +if {language} is omitted. The specified parser is installed if it is not already +installed. + + *:TSUpdateSync* +:TSUpdateSync {language} ...~ + +Perform the |:TSUpdate| operation synchronously. + + *:TSUninstall* +:TSUninstall {language} ...~ + +Deletes the parser for one or more {language}. You can use 'all' for language +to uninstall all parsers. + + *:TSBufEnable* +:TSBufEnable {module}~ + +Enable {module} on the current buffer. +A list of modules can be found at |:TSModuleInfo| + + *:TSBufDisable* +:TSBufDisable {module}~ + +Disable {module} on the current buffer. +A list of modules can be found at |:TSModuleInfo| + + *:TSBufToggle* +:TSBufToggle {module}~ + +Toggle (enable if disabled, disable if enabled) {module} on the current +buffer. +A list of modules can be found at |:TSModuleInfo| + + *:TSEnable* +:TSEnable {module} [{language}]~ + +Enable {module} for the session. +If {language} is specified, enable module for the session only for this +particular language. +A list of modules can be found at |:TSModuleInfo| +A list of languages can be found at |:TSInstallInfo| + + *:TSDisable* +:TSDisable {module} [{language}]~ + +Disable {module} for the session. +If {language} is specified, disable module for the session only for this +particular language. +A list of modules can be found at |:TSModuleInfo| +A list of languages can be found at |:TSInstallInfo| + + *:TSToggle* +:TSToggle {module} [{language}]~ + +Toggle (enable if disabled, disable if enabled) {module} for the session. +If {language} is specified, toggle module for the session only for this +particular language. +A list of modules can be found at |:TSModuleInfo| +A list of languages can be found at |:TSInstallInfo| + + *:TSModuleInfo* +:TSModuleInfo [{module}]~ + +List the state for the given module or all modules for the current session in +a new buffer. + +These highlight groups are used by default: +> + highlight default TSModuleInfoGood guifg=LightGreen gui=bold + highlight default TSModuleInfoBad guifg=Crimson + highlight default link TSModuleInfoHeader Type + highlight default link TSModuleInfoNamespace Statement + highlight default link TSModuleInfoParser Identifier +< + + *:TSEditQuery* +:TSEditQuery {query-group} [{lang}]~ + +Edit the query file for a {query-group} (e.g. highlights, locals) for given +{lang}. If there are multiple files, the user is prompted to select one of them. +If no such file exists, a buffer for a new file in the user's config directory +is created. If {lang} is not specified, the language of the current buffer +is used. + + *:TSEditQueryUserAfter* +:TSEditQueryUserAfter {query-group} [{lang}]~ + +Same as |:TSEditQuery| but edits a file in the `after` directory of the +user's config directory. Useful to add custom extensions for the queries +provided by a plugin. + +============================================================================== +UTILS *nvim-treesitter-utils* + +Nvim treesitter has some wrapper functions that you can retrieve with: +> + local ts_utils = require 'nvim-treesitter.ts_utils' +< +Methods + *ts_utils.get_node_at_cursor* +get_node_at_cursor(winnr)~ + +`winnr` will be 0 if nil. +Returns the node under the cursor. + + *ts_utils.is_parent* +is_parent(dest, source)~ + +Determines whether `dest` is a parent of `source`. +Returns a boolean. + + *ts_utils.get_named_children* +get_named_children(node)~ + +Returns a table of named children of `node`. + + *ts_utils.get_next_node* +get_next_node(node, allow_switch_parent, allow_next_parent)~ + +Returns the next node within the same parent. +If no node is found, returns `nil`. +If `allow_switch_parent` is true, it will allow switching parent +when the node is the last node. +If `allow_next_parent` is true, it will allow next parent if +the node is the last node and the next parent doesn't have children. + + *ts_utils.get_previous_node* +get_previous_node(node, allow_switch_parents, allow_prev_parent)~ + +Returns the previous node within the same parent. +`allow_switch_parent` and `allow_prev_parent` follow the same rule +as |ts_utils.get_next_node| but if the node is the first node. + + *ts_utils.goto_node* +goto_node(node, goto_end, avoid_set_jump)~ + +Sets cursor to the position of `node` in the current windows. +If `goto_end` is truthy, the cursor is set to the end the node range. +Setting `avoid_set_jump` to `true`, avoids setting the current cursor position +to the jump list. + + *ts_utils.swap_nodes* +swap_nodes(node_or_range1, node_or_range2, bufnr, cursor_to_second)~ + +Swaps the nodes or ranges. +set `cursor_to_second` to true to move the cursor to the second node + + *ts_utils.memoize_by_buf_tick* +memoize_by_buf_tick(fn, options)~ + +Caches the return value for a function and returns the cache value if the tick +of the buffer has not changed from the previous. + + `fn`: a function that takes any arguments + and returns a value to store. + `options?`: + - `bufnr`: a function/value that extracts the bufnr from the given arguments. + - `key`: a function/value that extracts the cache key from the given arguments. + `returns`: a function to call with bufnr as argument to + retrieve the value from the cache + + *ts_utils.node_to_lsp_range* +node_to_lsp_range(node)~ + +Get an lsp formatted range from a node range + + *ts_utils.node_length* +node_length(node)~ + +Get the byte length of node range + + *ts_utils.update_selection* +update_selection(buf, node)~ + +Set the selection to the node range + + *ts_utils.highlight_range* +highlight_range(range, buf, hl_namespace, hl_group)~ + +Set a highlight that spans the given range + + *ts_utils.highlight_node* +highlight_node(node, buf, hl_namespace, hl_group)~ + +Set a highlight that spans the given node's range + +============================================================================== +FUNCTIONS *nvim-treesitter-functions* + + *nvim_treesitter#statusline()* +nvim_treesitter#statusline(opts)~ + +Returns a string describing the current position in the file. This +could be used as a statusline indicator. +Default options (lua syntax): +> + { + indicator_size = 100, + type_patterns = {'class', 'function', 'method'}, + transform_fn = function(line, _node) return line:gsub('%s*[%[%(%{]*%s*$', '') end, + separator = ' -> ', + allow_duplicates = false + } +< +- `indicator_size` - How long should the string be. If longer, it is cut from + the beginning. +- `type_patterns` - Which node type patterns to match. +- `transform_fn` - Function used to transform the single item in line. By + default it removes opening brackets and spaces from end. Takes two arguments: + the text of the line in question, and the corresponding treesitter node. +- `separator` - Separator between nodes. +- `allow_duplicates` - Whether or not to remove duplicate components. + + *nvim_treesitter#foldexpr()* +nvim_treesitter#foldexpr()~ + +Functions to be used to determine the fold level at a given line number. +To use it: > + set foldmethod=expr + set foldexpr=nvim_treesitter#foldexpr() +< + +This will respect your 'foldminlines' and 'foldnestmax' settings. + +Note: This is highly experimental, and folding can break on some types of + edits. If you encounter such breakage, hitting `zx` should fix folding. + In any case, feel free to open an issue with the reproducing steps. + +============================================================================== +PERFORMANCE *nvim-treesitter-performance* + +`nvim-treesitter` checks the 'runtimepath' on startup in order to discover +available parsers and queries and index them. As a consequence, a very long +'runtimepath' might result in delayed startup times. + + +vim:tw=78:ts=8:expandtab:noet:ft=help:norl: diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lockfile.json b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lockfile.json new file mode 100644 index 00000000..27ca33a9 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lockfile.json @@ -0,0 +1,743 @@ +{ + "ada": { + "revision": "ba0894efa03beb70780156b91e28c716b7a4764d" + }, + "agda": { + "revision": "c21c3a0f996363ed17b8ac99d827fe5a4821f217" + }, + "angular": { + "revision": "624ff108fe949727217cddb302f20e4f16997b1c" + }, + "apex": { + "revision": "ca70b2347a79615cd749517f6c6c2352e50a7ce9" + }, + "arduino": { + "revision": "ff1045f5da90344d547022c50f1756be4adaf721" + }, + "astro": { + "revision": "a092afa5c330495fdfbc652766c29c66ec6880f4" + }, + "authzed": { + "revision": "1dec7e1af96c56924e3322cd85fdce15d0a31d00" + }, + "awk": { + "revision": "4b4b46c9a44ec7fb9e8c9ce4a010295edc5be8d5" + }, + "bash": { + "revision": "7331995b19b8f8aba2d5e26deb51d2195c18bc94" + }, + "bass": { + "revision": "27f110dfe79620993f5493ffa0d0f2fe12d250ed" + }, + "beancount": { + "revision": "cd08aefa20dc0f3d5984b08b5d468f75bf4fd096" + }, + "bibtex": { + "revision": "ccfd77db0ed799b6c22c214fe9d2937f47bc8b34" + }, + "bicep": { + "revision": "3604d8c961ab129d2bfc6dfca56419c236ccdb83" + }, + "bitbake": { + "revision": "10bacac929ff36a1e8f4056503fe4f8717b21b94" + }, + "blueprint": { + "revision": "863cea9f83ad5637300478e0559262f1e791684b" + }, + "c": { + "revision": "212a80f86452bb1316324fa0db730cf52f29e05a" + }, + "c_sharp": { + "revision": "dd5e59721a5f8dae34604060833902b882023aaf" + }, + "cairo": { + "revision": "6216c6ee5e9fc0649c4bd7b1aedd884a55bdd9ef" + }, + "capnp": { + "revision": "dc28c9f4212809eab74d10996086297853eb34e5" + }, + "chatito": { + "revision": "871622a3a483f0baf94923d8495c8e0bb2c09009" + }, + "clojure": { + "revision": "6e41628e9d18b19caea1cb1d72aae4ccff5bdfe9" + }, + "cmake": { + "revision": "73ab4b8e9522f014a67f87f585e820d36fa47408" + }, + "comment": { + "revision": "aefcc2813392eb6ffe509aa0fc8b4e9b57413ee1" + }, + "commonlisp": { + "revision": "cf10fc38bc24faf0549d59217ff37c789973dfdc" + }, + "cooklang": { + "revision": "5e113412aadb78955c27010daa4dbe1d202013cf" + }, + "corn": { + "revision": "604d73c38d4c28ca68e9e441ffd405d68cb63051" + }, + "cpon": { + "revision": "f4b3cbc8b0bd4e13035d39940fef09f1392e8739" + }, + "cpp": { + "revision": "a71474021410973b29bfe99440d57bcd750246b1" + }, + "css": { + "revision": "98c7b3dceb24f1ee17f1322f3947e55638251c37" + }, + "csv": { + "revision": "6c1957405bd6f7751b050f61367f1094fab91444" + }, + "cuda": { + "revision": "2c6e806949197e7898910c78f514a3b7ff679068" + }, + "cue": { + "revision": "2df92e6755337e9234ad18ffef37f35d95e2ba9d" + }, + "d": { + "revision": "c2fbf21bd3aa45495fe13247e040ad5815250032" + }, + "dart": { + "revision": "f71e310a93010863f4b17a2a501ea8e2032c345b" + }, + "devicetree": { + "revision": "53b4137bd37e726116ea918139767f982a1584d8" + }, + "dhall": { + "revision": "affb6ee38d629c9296749767ab832d69bb0d9ea8" + }, + "diff": { + "revision": "c165725c28e69b36c5799ff0e458713a844f1aaf" + }, + "dockerfile": { + "revision": "33e22c33bcdbfc33d42806ee84cfd0b1248cc392" + }, + "dot": { + "revision": "9ab85550c896d8b294d9b9ca1e30698736f08cea" + }, + "doxygen": { + "revision": "a750758da90955c86fcc22fcbb6fa44a7d009865" + }, + "dtd": { + "revision": "dd7ef38c74d8430da729b4da815e4c40776e03bb" + }, + "ebnf": { + "revision": "8e635b0b723c620774dfb8abf382a7f531894b40" + }, + "eds": { + "revision": "fde62029d4c715562230070b9af51a9500c2ce10" + }, + "eex": { + "revision": "f742f2fe327463335e8671a87c0b9b396905d1d1" + }, + "elixir": { + "revision": "11426c5fd20eef360d5ecaf10729191f6bc5d715" + }, + "elm": { + "revision": "c26afd7f2316f689410a1622f1780eff054994b1" + }, + "elsa": { + "revision": "0a66b2b3f3c1915e67ad2ef9f7dbd2a84820d9d7" + }, + "elvish": { + "revision": "5e7210d945425b77f82cbaebc5af4dd3e1ad40f5" + }, + "embedded_template": { + "revision": "203f7bd3c1bbfbd98fc19add4b8fcb213c059205" + }, + "erlang": { + "revision": "57e69513efd831f9cc8207d65d96bad917ca4aa4" + }, + "facility": { + "revision": "a52579670e2b14ec03d410c3c980fafaf6d659c4" + }, + "fennel": { + "revision": "517195970428aacca60891b050aa53eabf4ba78d" + }, + "firrtl": { + "revision": "2b5adae629c8cba528c7b1e4aa67a8ae28934ea5" + }, + "fish": { + "revision": "f9176908c9eb2e11eb684d79e1d00f3b29bd65c9" + }, + "foam": { + "revision": "04664b40c0dadb7ef37028acf3422c63271d377b" + }, + "forth": { + "revision": "90189238385cf636b9ee99ce548b9e5b5e569d48" + }, + "fortran": { + "revision": "f73d473e3530862dee7cbb38520f28824e7804f6" + }, + "fsh": { + "revision": "fa3347712f7a59ed02ccf508284554689c6cde28" + }, + "func": { + "revision": "0834e35ecf8b23fbf9ad15b088af6a897e19d4a8" + }, + "fusion": { + "revision": "19db2f47ba4c3a0f6238d4ae0e2abfca16e61dd6" + }, + "gdscript": { + "revision": "03f20b94707a21bed90bb95101684bc4036139ce" + }, + "git_config": { + "revision": "9c2a1b7894e6d9eedfe99805b829b4ecd871375e" + }, + "git_rebase": { + "revision": "d8a4207ebbc47bd78bacdf48f883db58283f9fd8" + }, + "gitattributes": { + "revision": "19d554d39e4a8491f7a77abcdb75bfbc1c19d0b5" + }, + "gitcommit": { + "revision": "7e3ad5fdc61cd701e146ef78e4fc6dcdf6dbca0e" + }, + "gitignore": { + "revision": "f4685bf11ac466dd278449bcfe5fd014e94aa504" + }, + "gleam": { + "revision": "2b49c49ef632928b5c52bb0a7269ff797d5d1414" + }, + "glimmer": { + "revision": "f9746dc1d0707717fbba84cb5c22a71586af23e1" + }, + "glsl": { + "revision": "5bb58a6a5b0941d4e1256c6335e50d9780e74dde" + }, + "gn": { + "revision": "bc06955bc1e3c9ff8e9b2b2a55b38b94da923c05" + }, + "go": { + "revision": "ff86c7f1734873c8c4874ca4dd95603695686d7a" + }, + "godot_resource": { + "revision": "b6ef0768711086a86b3297056f9ffb5cc1d77b4a" + }, + "gomod": { + "revision": "9b86399ab733fbd548ba0e817e732cb3351082d2" + }, + "gosum": { + "revision": "e2ac513b2240c7ff1069ae33b2df29ce90777c11" + }, + "gowork": { + "revision": "949a8a470559543857a62102c84700d291fc984c" + }, + "gpg": { + "revision": "18b2690a15f061a6ff48730589f7a4039af2d002" + }, + "graphql": { + "revision": "5e66e961eee421786bdda8495ed1db045e06b5fe" + }, + "groovy": { + "revision": "7e023227f46fee428b16a0288eeb0f65ee2523ec" + }, + "gstlaunch": { + "revision": "2c0d9c94d35e37aa63fa5002163c8480985b3e5b" + }, + "hack": { + "revision": "fca1e294f6dce8ec5659233a6a21f5bd0ed5b4f2" + }, + "hare": { + "revision": "3d4af179414525a35dd069ba0208c9b71093d8b3" + }, + "haskell": { + "revision": "dd924b8df1eb76261f009e149fc6f3291c5081c2" + }, + "haskell_persistent": { + "revision": "577259b4068b2c281c9ebf94c109bd50a74d5857" + }, + "hcl": { + "revision": "e135399cb31b95fac0760b094556d1d5ce84acf0" + }, + "heex": { + "revision": "4a36c9a388505180da6ee0eda1d8afb8c83481c8" + }, + "hjson": { + "revision": "02fa3b79b3ff9a296066da6277adfc3f26cbc9e0" + }, + "hlsl": { + "revision": "8b10faba024b536dc85f76e0c678f573b1776034" + }, + "hocon": { + "revision": "c390f10519ae69fdb03b3e5764f5592fb6924bcc" + }, + "hoon": { + "revision": "0135187126370cbf112d759a50eab4a5c913a827" + }, + "html": { + "revision": "d742025fa2d8e6100f134a6ea990443aa1f074b3" + }, + "htmldjango": { + "revision": "8873e3df89f9ea1d33f6235e516b600009288557" + }, + "http": { + "revision": "6824a247d1326079aab4fa9f9164e9319678081d" + }, + "hurl": { + "revision": "cd1a0ada92cc73dd0f4d7eedc162be4ded758591" + }, + "ini": { + "revision": "bcb84a2d4bcd6f55b911c42deade75c8f90cb0c5" + }, + "ispc": { + "revision": "9b2f9aec2106b94b4e099fe75e73ebd8ae707c04" + }, + "janet_simple": { + "revision": "51271e260346878e1a1aa6c506ce6a797b7c25e2" + }, + "java": { + "revision": "2b57cd9541f9fd3a89207d054ce8fbe72657c444" + }, + "javascript": { + "revision": "f1e5a09b8d02f8209a68249c93f0ad647b228e6e" + }, + "jq": { + "revision": "13990f530e8e6709b7978503da9bc8701d366791" + }, + "jsdoc": { + "revision": "d01984de49927c979b46ea5c01b78c8ddd79baf9" + }, + "json": { + "revision": "3fef30de8aee74600f25ec2e319b62a1a870d51e" + }, + "json5": { + "revision": "c23f7a9b1ee7d45f516496b1e0e4be067264fa0d" + }, + "jsonc": { + "revision": "02b01653c8a1c198ae7287d566efa86a135b30d5" + }, + "jsonnet": { + "revision": "d34615fa12cc1d1cfc1f1f1a80acc9db80ee4596" + }, + "julia": { + "revision": "0c088d1ad270f02c4e84189247ac7001e86fe342" + }, + "kconfig": { + "revision": "aaba009ba9d7881f0f81742da588ae70b572316d" + }, + "kdl": { + "revision": "e180e05132c4cb229a8ba679b298790ef1eca77c" + }, + "kotlin": { + "revision": "0ef87892401bb01c84b40916e1f150197bc134b1" + }, + "kusto": { + "revision": "8353a1296607d6ba33db7c7e312226e5fc83e8ce" + }, + "lalrpop": { + "revision": "06ae1b6c26e23c77c7fb86d51dddad62b42e66b0" + }, + "latex": { + "revision": "2ae2021d7b224fb6aa57b760e0d146059f943bb8" + }, + "ledger": { + "revision": "8a841fb20ce683bfbb3469e6ba67f2851cfdf94a" + }, + "leo": { + "revision": "304611b5eaf53aca07459a0a03803b83b6dfd3b3" + }, + "linkerscript": { + "revision": "f99011a3554213b654985a4b0a65b3b032ec4621" + }, + "liquidsoap": { + "revision": "691484ae766c4eee2ac59ec09e621b27b9ed9add" + }, + "llvm": { + "revision": "1b96e58faf558ce057d4dc664b904528aee743cb" + }, + "lua": { + "revision": "9668709211b2e683f27f414454a8b51bf0a6bda1" + }, + "luadoc": { + "revision": "990926b13488a4bc0fc0804fc0f8400b5b0a1fb4" + }, + "luap": { + "revision": "31461ae9bd0866cb5117cfe5de71189854fd0f3e" + }, + "luau": { + "revision": "6953cd4fa5967c9aa3c769b4e4c7e69c904b9fa9" + }, + "m68k": { + "revision": "d097b123f19c6eaba2bf181c05420d88b9fc489d" + }, + "make": { + "revision": "a4b9187417d6be349ee5fd4b6e77b4172c6827dd" + }, + "markdown": { + "revision": "f9820b2db958228f9be339b67d2de874d065866e" + }, + "markdown_inline": { + "revision": "f9820b2db958228f9be339b67d2de874d065866e" + }, + "matlab": { + "revision": "6071891a8c39600203eba20513666cf93b4d650a" + }, + "menhir": { + "revision": "be8866a6bcc2b563ab0de895af69daeffa88fe70" + }, + "mermaid": { + "revision": "e26a5f8898a8174f02b4cc9a9050eb3ccfb799f3" + }, + "meson": { + "revision": "3d6dfbdb2432603bc84ca7dc009bb39ed9a8a7b1" + }, + "mlir": { + "revision": "650a8fb72013ba8d169bdb458e480d640fc545c9" + }, + "nasm": { + "revision": "3bc691d2cfba44bea339a775ad496c8bc552c60d" + }, + "nickel": { + "revision": "091b5dcc7d138901bcc162da9409c0bb626c0d27" + }, + "nim": { + "revision": "70ceee835e033acbc7092cd7f4f6a251789af121" + }, + "nim_format_string": { + "revision": "d45f75022d147cda056e98bfba68222c9c8eca3a" + }, + "ninja": { + "revision": "0a95cfdc0745b6ae82f60d3a339b37f19b7b9267" + }, + "nix": { + "revision": "763168fa916a333a459434f1424b5d30645f015d" + }, + "norg": { + "revision": "014073fe8016d1ac440c51d22c77e3765d8f6855" + }, + "nqc": { + "revision": "14e6da1627aaef21d2b2aa0c37d04269766dcc1d" + }, + "objc": { + "revision": "62e61b6f5c0289c376d61a8c91faf6435cde9012" + }, + "objdump": { + "revision": "28d3b2e25a0b1881d1b47ed1924ca276c7003d45" + }, + "ocaml": { + "revision": "4abfdc1c7af2c6c77a370aee974627be1c285b3b" + }, + "ocaml_interface": { + "revision": "4abfdc1c7af2c6c77a370aee974627be1c285b3b" + }, + "ocamllex": { + "revision": "4b9898ccbf198602bb0dec9cd67cc1d2c0a4fad2" + }, + "odin": { + "revision": "751f7796fa76075cff52edd1afff569a8a09c2a7" + }, + "org": { + "revision": "64cfbc213f5a83da17632c95382a5a0a2f3357c1" + }, + "pascal": { + "revision": "9e995404ddff8319631d72d4b46552e737206912" + }, + "passwd": { + "revision": "20239395eacdc2e0923a7e5683ad3605aee7b716" + }, + "pem": { + "revision": "e01767921df18142055d97407595329d7629e643" + }, + "perl": { + "revision": "655632fa7f9174acbdbf1ad2abdac90ad3aa57a1" + }, + "php": { + "revision": "2f791d9d83c35b11e9a14daf9a58dd7e23566041" + }, + "phpdoc": { + "revision": "915a527d5aafa81b31acf67fab31b0ac6b6319c0" + }, + "pioasm": { + "revision": "924aadaf5dea2a6074d72027b064f939acf32e20" + }, + "po": { + "revision": "d6aed225290bc71a15ab6f06305cb11419360c56" + }, + "pod": { + "revision": "39da859947b94abdee43e431368e1ae975c0a424" + }, + "poe_filter": { + "revision": "fa83292e04d27976ab5c354e0c980f2c67628a02" + }, + "pony": { + "revision": "16f930b250433cfcd4fb4144df92bb98ad344c20" + }, + "prisma": { + "revision": "eca2596a355b1a9952b4f80f8f9caed300a272b5" + }, + "promql": { + "revision": "77625d78eebc3ffc44d114a07b2f348dff3061b0" + }, + "properties": { + "revision": "97253273bdf8b63546c8006e71ba155ecc27069e" + }, + "proto": { + "revision": "e9f6b43f6844bd2189b50a422d4e2094313f6aa3" + }, + "prql": { + "revision": "09e158cd3650581c0af4c49c2e5b10c4834c8646" + }, + "psv": { + "revision": "6c1957405bd6f7751b050f61367f1094fab91444" + }, + "pug": { + "revision": "a7ff31a38908df9b9f34828d21d6ca5e12413e18" + }, + "puppet": { + "revision": "9ce9a5f7d64528572aaa8d59459ba869e634086b" + }, + "purescript": { + "revision": "85a90951c10f118f819c1137f669800246890db7" + }, + "pymanifest": { + "revision": "a77547018ada84ca4bc115c7650b19441120f065" + }, + "python": { + "revision": "4bfdd9033a2225cc95032ce77066b7aeca9e2efc" + }, + "ql": { + "revision": "bd087020f0d8c183080ca615d38de0ec827aeeaf" + }, + "qmldir": { + "revision": "6b2b5e41734bd6f07ea4c36ac20fb6f14061c841" + }, + "qmljs": { + "revision": "259133077f2fd854bcaa6f0149d3fc281fc8070b" + }, + "query": { + "revision": "3a9808b22742d5bd906ef5d1a562f2f1ae57406d" + }, + "r": { + "revision": "c55f8b4dfaa32c80ddef6c0ac0e79b05cb0cbf57" + }, + "racket": { + "revision": "e4ba1a9674a3b4dd7905d04f194ae6f8331be342" + }, + "rasi": { + "revision": "371dac6bcce0df5566c1cfebde69d90ecbeefd2d" + }, + "rbs": { + "revision": "b28e1819d434e95916d11fe48ee6e8959b69197b" + }, + "re2c": { + "revision": "47aa19cf5f7aba2ed30e2b377f7172df76e819a6" + }, + "regex": { + "revision": "2354482d7e2e8f8ff33c1ef6c8aa5690410fbc96" + }, + "rego": { + "revision": "9ac75e71b2d791e0aadeef68098319d86a2a14cf" + }, + "requirements": { + "revision": "389dd46a39075ce36af6ee3af50393d9aa506d14" + }, + "rnoweb": { + "revision": "502c1126dc6777f09af5bef16e72a42f75bd081e" + }, + "robot": { + "revision": "322e4cc65754d2b3fdef4f2f8a71e0762e3d13af" + }, + "ron": { + "revision": "ce6086b2c9e8e71065b8129d6c2289c5f66d1879" + }, + "rst": { + "revision": "3ba9eb9b5a47aadb1f2356a3cab0dd3d2bd00b4b" + }, + "ruby": { + "revision": "4d9ad3f010fdc47a8433adcf9ae30c8eb8475ae7" + }, + "rust": { + "revision": "79456e6080f50fc1ca7c21845794308fa5d35a51" + }, + "scala": { + "revision": "7891815f42dca9ed6aeb464c2edc39d479ab965c" + }, + "scfg": { + "revision": "6deae0cbb458c849a4d1e2985093e9c9c32d7fd0" + }, + "scheme": { + "revision": "85b6188fb77c03dfb01d13e58e2844450506860c" + }, + "scss": { + "revision": "c478c6868648eff49eb04a4df90d703dc45b312a" + }, + "slang": { + "revision": "ac07aa2c875ef6ada2ec468d8a4d0c7c5efd96d7" + }, + "slint": { + "revision": "00c8a2d3645766f68c0d0460086c0a994e5b0d85" + }, + "smali": { + "revision": "72e334b2630f5852825ba5ff9dfd872447175eb5" + }, + "smithy": { + "revision": "8327eb84d55639ffbe08c9dc82da7fff72a1ad07" + }, + "snakemake": { + "revision": "65a6c3b4671877821082164da0a310851b211953" + }, + "solidity": { + "revision": "168020304759ad5d8b4a88a541a699134e3730c5" + }, + "soql": { + "revision": "ca70b2347a79615cd749517f6c6c2352e50a7ce9" + }, + "sosl": { + "revision": "ca70b2347a79615cd749517f6c6c2352e50a7ce9" + }, + "sparql": { + "revision": "05f949d3c1c15e3261473a244d3ce87777374dec" + }, + "sql": { + "revision": "fd70fb358d164cd93fbe2674a9cca276dc5203f7" + }, + "squirrel": { + "revision": "e8b5835296f931bcaa1477d3c5a68a0c5c2ba034" + }, + "ssh_config": { + "revision": "096981397385f49833dfd66037fa98081bbd9ef9" + }, + "starlark": { + "revision": "c45ce2b39062bbd12ea1c210bd200db250efb24a" + }, + "strace": { + "revision": "d819cdd5dbe455bd3c859193633c8d91c0df7c36" + }, + "styled": { + "revision": "5e52758b32e02adca16bb93f95b3f9c050c72b56" + }, + "supercollider": { + "revision": "3b35bd0fded4423c8fb30e9585c7bacbcd0e8095" + }, + "surface": { + "revision": "f4586b35ac8548667a9aaa4eae44456c1f43d032" + }, + "svelte": { + "revision": "697bb515471871e85ff799ea57a76298a71a9cca" + }, + "swift": { + "revision": "f1a48a33a7ceaf8817f7a340ea4ef1b549ffa176" + }, + "sxhkdrc": { + "revision": "440d5f913d9465c9c776a1bd92334d32febcf065" + }, + "systemtap": { + "revision": "1af543a96d060b1f808982037bfc54cc02218edd" + }, + "t32": { + "revision": "b904af353fb2f1df6ac45d8d3e3a5ee85a6cc306" + }, + "tablegen": { + "revision": "300f6a490e71f895e644ed2deec6920860a2e107" + }, + "teal": { + "revision": "33482c92a0dfa694491d34e167a1d2f52b0dccb1" + }, + "templ": { + "revision": "f8fbc1558e45b72c05cd55a02907ba9bc0df505a" + }, + "terraform": { + "revision": "e135399cb31b95fac0760b094556d1d5ce84acf0" + }, + "textproto": { + "revision": "8dacf02aa402892c91079f8577998ed5148c0496" + }, + "thrift": { + "revision": "d4deb1bd9e848f2dbe81103a151d99e8546de480" + }, + "tiger": { + "revision": "a7f11d946b44244f71df41d2a78af0665d618dae" + }, + "tlaplus": { + "revision": "aaf5bb5c1df0a6e583bb51efa519a9ac788b2ad8" + }, + "todotxt": { + "revision": "0207f6a4ab6aeafc4b091914d31d8235049a2578" + }, + "toml": { + "revision": "8bd2056818b21860e3d756b5a58c4f6e05fb744e" + }, + "tsv": { + "revision": "6c1957405bd6f7751b050f61367f1094fab91444" + }, + "tsx": { + "revision": "d847898fec3fe596798c9fda55cb8c05a799001a" + }, + "turtle": { + "revision": "085437f5cb117703b7f520dd92161140a684f092" + }, + "twig": { + "revision": "eaf80e6af969e25993576477a9dbdba3e48c1305" + }, + "typescript": { + "revision": "d847898fec3fe596798c9fda55cb8c05a799001a" + }, + "typoscript": { + "revision": "43b221c0b76e77244efdaa9963e402a17c930fbc" + }, + "udev": { + "revision": "baeac48a999abb9384cdcce320f0182937aec8ba" + }, + "ungrammar": { + "revision": "debd26fed283d80456ebafa33a06957b0c52e451" + }, + "unison": { + "revision": "a69d087590f2ca057d1ef1a393de7e22869bb557" + }, + "usd": { + "revision": "ab8c30bde2df0e58c4b3f01f220fb0125ecb57a7" + }, + "uxntal": { + "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" + }, + "v": { + "revision": "9ac84e62396bb13c8f1d11f967f0c0f2dec1a448" + }, + "vala": { + "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" + }, + "verilog": { + "revision": "902031343056bc0b11f3e47b33f036a9cf59f58d" + }, + "vhs": { + "revision": "9534865e614c95eb9418e5e73f061c32fa4d9540" + }, + "vim": { + "revision": "32c76f150347c1cd044e90b8e2bc73c00677fa55" + }, + "vimdoc": { + "revision": "4f8ba9e39c8b3fbaf0bb5f70ac255474a9099359" + }, + "vue": { + "revision": "91fe2754796cd8fba5f229505a23fa08f3546c06" + }, + "wgsl": { + "revision": "40259f3c77ea856841a4e0c4c807705f3e4a2b65" + }, + "wgsl_bevy": { + "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" + }, + "wing": { + "revision": "8d6b514bdc76dfc96827a62150bf85098c3fe429" + }, + "xcompose": { + "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" + }, + "xml": { + "revision": "dd7ef38c74d8430da729b4da815e4c40776e03bb" + }, + "yaml": { + "revision": "0e36bed171768908f331ff7dff9d956bae016efb" + }, + "yang": { + "revision": "2c0e6be8dd4dcb961c345fa35c309ad4f5bd3502" + }, + "yuck": { + "revision": "c348825d3f86dec71dee0e1223c6bd73114e3579" + }, + "zig": { + "revision": "0d08703e4c3f426ec61695d7617415fff97029bd" + } +} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter.lua new file mode 100644 index 00000000..963fe730 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter.lua @@ -0,0 +1,22 @@ +local install = require "nvim-treesitter.install" +local utils = require "nvim-treesitter.utils" +local info = require "nvim-treesitter.info" +local configs = require "nvim-treesitter.configs" +local statusline = require "nvim-treesitter.statusline" + +-- Registers all query predicates +require "nvim-treesitter.query_predicates" + +local M = {} + +function M.setup() + utils.setup_commands("install", install.commands) + utils.setup_commands("info", info.commands) + utils.setup_commands("configs", configs.commands) + configs.init() +end + +M.define_modules = configs.define_modules +M.statusline = statusline.statusline + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/caching.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/caching.lua new file mode 100644 index 00000000..7733202e --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/caching.lua @@ -0,0 +1,71 @@ +local api = vim.api + +local M = {} + +-- Creates a cache table for buffers keyed by a type name. +-- Cache entries attach to the buffer and cleanup entries +-- as buffers are detached. +function M.create_buffer_cache() + local cache = {} + + ---@type table> + local items = setmetatable({}, { + __index = function(tbl, key) + rawset(tbl, key, {}) + return rawget(tbl, key) + end, + }) + + ---@type table + local loaded_buffers = {} + + ---@param type_name string + ---@param bufnr integer + ---@param value any + function cache.set(type_name, bufnr, value) + if not loaded_buffers[bufnr] then + loaded_buffers[bufnr] = true + -- Clean up the cache if the buffer is detached + -- to avoid memory leaks + api.nvim_buf_attach(bufnr, false, { + on_detach = function() + cache.clear_buffer(bufnr) + loaded_buffers[bufnr] = nil + return true + end, + on_reload = function() end, -- this is needed to prevent on_detach being called on buffer reload + }) + end + + items[bufnr][type_name] = value + end + + ---@param type_name string + ---@param bufnr integer + ---@return any + function cache.get(type_name, bufnr) + return items[bufnr][type_name] + end + + ---@param type_name string + ---@param bufnr integer + ---@return boolean + function cache.has(type_name, bufnr) + return cache.get(type_name, bufnr) ~= nil + end + + ---@param type_name string + ---@param bufnr integer + function cache.remove(type_name, bufnr) + items[bufnr][type_name] = nil + end + + ---@param bufnr integer + function cache.clear_buffer(bufnr) + items[bufnr] = nil + end + + return cache +end + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/compat.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/compat.lua new file mode 100644 index 00000000..c56e12b1 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/compat.lua @@ -0,0 +1,27 @@ +-- Shim module to address deprecations across nvim versions +local ts = vim.treesitter +local tsq = ts.query + +local M = {} + +function M.get_query_files(lang, query_group, is_included) + return (tsq.get_files or tsq.get_query_files)(lang, query_group, is_included) +end + +function M.get_query(lang, query_name) + return (tsq.get or tsq.get_query)(lang, query_name) +end + +function M.parse_query(lang, query) + return (tsq.parse or tsq.parse_query)(lang, query) +end + +function M.get_range(node, source, metadata) + return (ts.get_range or tsq.get_range)(node, source, metadata) +end + +function M.get_node_text(node, bufnr) + return (ts.get_node_text or tsq.get_node_text)(node, bufnr) +end + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/configs.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/configs.lua new file mode 100644 index 00000000..a3ec30fb --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/configs.lua @@ -0,0 +1,616 @@ +local api = vim.api + +local queries = require "nvim-treesitter.query" +local ts = require "nvim-treesitter.compat" +local parsers = require "nvim-treesitter.parsers" +local utils = require "nvim-treesitter.utils" +local caching = require "nvim-treesitter.caching" + +local M = {} + +---@class TSConfig +---@field modules {[string]:TSModule} +---@field sync_install boolean +---@field ensure_installed string[]|string +---@field ignore_install string[] +---@field auto_install boolean +---@field parser_install_dir string|nil + +---@type TSConfig +local config = { + modules = {}, + sync_install = false, + ensure_installed = {}, + auto_install = false, + ignore_install = {}, + parser_install_dir = nil, +} + +-- List of modules that need to be setup on initialization. +---@type TSModule[][] +local queued_modules_defs = {} +-- Whether we've initialized the plugin yet. +local is_initialized = false + +---@class TSModule +---@field module_path string +---@field enable boolean|string[]|function(string): boolean +---@field disable boolean|string[]|function(string): boolean +---@field keymaps table +---@field is_supported function(string): boolean +---@field attach function(string) +---@field detach function(string) +---@field enabled_buffers table +---@field additional_vim_regex_highlighting boolean|string[] + +---@type {[string]: TSModule} +local builtin_modules = { + highlight = { + module_path = "nvim-treesitter.highlight", + -- @deprecated: use `highlight.set_custom_captures` instead + custom_captures = {}, + enable = false, + is_supported = function(lang) + return queries.has_highlights(lang) + end, + additional_vim_regex_highlighting = false, + }, + incremental_selection = { + module_path = "nvim-treesitter.incremental_selection", + enable = false, + keymaps = { + init_selection = "gnn", -- set to `false` to disable one of the mappings + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", + }, + is_supported = function() + return true + end, + }, + indent = { + module_path = "nvim-treesitter.indent", + enable = false, + is_supported = queries.has_indents, + }, +} + +local attached_buffers_by_module = caching.create_buffer_cache() + +---Resolves a module by requiring the `module_path` or using the module definition. +---@param mod_name string +---@return TSModule|nil +local function resolve_module(mod_name) + local config_mod = M.get_module(mod_name) + + if not config_mod then + return + end + + if type(config_mod.attach) == "function" and type(config_mod.detach) == "function" then + return config_mod + elseif type(config_mod.module_path) == "string" then + return require(config_mod.module_path) + end +end + +---Enables and attaches the module to a buffer for lang. +---@param mod string path to module +---@param bufnr integer|nil buffer number, defaults to current buffer +---@param lang string|nil language, defaults to current language +local function enable_module(mod, bufnr, lang) + local module = M.get_module(mod) + if not module then + return + end + + bufnr = bufnr or api.nvim_get_current_buf() + lang = lang or parsers.get_buf_lang(bufnr) + + if not module.enable then + if module.enabled_buffers then + module.enabled_buffers[bufnr] = true + else + module.enabled_buffers = { [bufnr] = true } + end + end + + M.attach_module(mod, bufnr, lang) +end + +---Enables autocomands for the module. +---After the module is loaded `loaded` will be set to true for the module. +---@param mod string path to module +local function enable_mod_conf_autocmd(mod) + local config_mod = M.get_module(mod) + if not config_mod or config_mod.loaded then + return + end + + api.nvim_create_autocmd("FileType", { + group = api.nvim_create_augroup("NvimTreesitter-" .. mod, {}), + callback = function(args) + require("nvim-treesitter.configs").reattach_module(mod, args.buf) + end, + desc = "Reattach module", + }) + + config_mod.loaded = true +end + +---Enables the module globally and for all current buffers. +---After enabled, `enable` will be set to true for the module. +---@param mod string path to module +local function enable_all(mod) + local config_mod = M.get_module(mod) + if not config_mod then + return + end + + enable_mod_conf_autocmd(mod) + config_mod.enable = true + config_mod.enabled_buffers = nil + + for _, bufnr in pairs(api.nvim_list_bufs()) do + enable_module(mod, bufnr) + end +end + +---Disables and detaches the module for a buffer. +---@param mod string path to module +---@param bufnr integer buffer number, defaults to current buffer +local function disable_module(mod, bufnr) + local module = M.get_module(mod) + if not module then + return + end + + bufnr = bufnr or api.nvim_get_current_buf() + if module.enabled_buffers then + module.enabled_buffers[bufnr] = false + end + M.detach_module(mod, bufnr) +end + +---Disables autocomands for the module. +---After the module is unloaded `loaded` will be set to false for the module. +---@param mod string path to module +local function disable_mod_conf_autocmd(mod) + local config_mod = M.get_module(mod) + if not config_mod or not config_mod.loaded then + return + end + api.nvim_clear_autocmds { event = "FileType", group = "NvimTreesitter-" .. mod } + config_mod.loaded = false +end + +---Disables the module globally and for all current buffers. +---After disabled, `enable` will be set to false for the module. +---@param mod string path to module +local function disable_all(mod) + local config_mod = M.get_module(mod) + if not config_mod then + return + end + + config_mod.enabled_buffers = nil + disable_mod_conf_autocmd(mod) + config_mod.enable = false + + for _, bufnr in pairs(api.nvim_list_bufs()) do + disable_module(mod, bufnr) + end +end + +---Toggles a module for a buffer +---@param mod string path to module +---@param bufnr integer buffer number, defaults to current buffer +---@param lang string language, defaults to current language +local function toggle_module(mod, bufnr, lang) + bufnr = bufnr or api.nvim_get_current_buf() + lang = lang or parsers.get_buf_lang(bufnr) + + if attached_buffers_by_module.has(mod, bufnr) then + disable_module(mod, bufnr) + else + enable_module(mod, bufnr, lang) + end +end + +-- Toggles the module globally and for all current buffers. +-- @param mod path to module +local function toggle_all(mod) + local config_mod = M.get_module(mod) + if not config_mod then + return + end + + if config_mod.enable then + disable_all(mod) + else + enable_all(mod) + end +end + +---Recurses through all modules including submodules +---@param accumulator function called for each module +---@param root {[string]: TSModule}|nil root configuration table to start at +---@param path string|nil prefix path +local function recurse_modules(accumulator, root, path) + root = root or config.modules + + for name, module in pairs(root) do + local new_path = path and (path .. "." .. name) or name + + if M.is_module(module) then + accumulator(name, module, new_path, root) + elseif type(module) == "table" then + recurse_modules(accumulator, module, new_path) + end + end +end + +-- Shows current configuration of all nvim-treesitter modules +---@param process_function function used as the `process` parameter +--- for vim.inspect (https://github.com/kikito/inspect.lua#optionsprocess) +local function config_info(process_function) + process_function = process_function + or function(item, path) + if path[#path] == vim.inspect.METATABLE then + return + end + if path[#path] == "is_supported" then + return + end + return item + end + print(vim.inspect(config, { process = process_function })) +end + +---@param query_group string +---@param lang string +function M.edit_query_file(query_group, lang) + lang = lang or parsers.get_buf_lang() + local files = ts.get_query_files(lang, query_group, true) + if #files == 0 then + utils.notify "No query file found! Creating a new one!" + M.edit_query_file_user_after(query_group, lang) + elseif #files == 1 then + vim.cmd(":edit " .. files[1]) + else + vim.ui.select(files, { prompt = "Select a file:" }, function(file) + if file then + vim.cmd(":edit " .. file) + end + end) + end +end + +---@param query_group string +---@param lang string +function M.edit_query_file_user_after(query_group, lang) + lang = lang or parsers.get_buf_lang() + local folder = utils.join_path(vim.fn.stdpath "config", "after", "queries", lang) + local file = utils.join_path(folder, query_group .. ".scm") + if vim.fn.isdirectory(folder) ~= 1 then + vim.ui.select({ "Yes", "No" }, { prompt = '"' .. folder .. '" does not exist. Create it?' }, function(choice) + if choice == "Yes" then + vim.fn.mkdir(folder, "p", "0755") + vim.cmd(":edit " .. file) + end + end) + else + vim.cmd(":edit " .. file) + end +end + +M.commands = { + TSBufEnable = { + run = enable_module, + args = { + "-nargs=1", + "-complete=custom,nvim_treesitter#available_modules", + }, + }, + TSBufDisable = { + run = disable_module, + args = { + "-nargs=1", + "-complete=custom,nvim_treesitter#available_modules", + }, + }, + TSBufToggle = { + run = toggle_module, + args = { + "-nargs=1", + "-complete=custom,nvim_treesitter#available_modules", + }, + }, + TSEnable = { + run = enable_all, + args = { + "-nargs=+", + "-complete=custom,nvim_treesitter#available_modules", + }, + }, + TSDisable = { + run = disable_all, + args = { + "-nargs=+", + "-complete=custom,nvim_treesitter#available_modules", + }, + }, + TSToggle = { + run = toggle_all, + args = { + "-nargs=+", + "-complete=custom,nvim_treesitter#available_modules", + }, + }, + TSConfigInfo = { + run = config_info, + args = { + "-nargs=0", + }, + }, + TSEditQuery = { + run = M.edit_query_file, + args = { + "-nargs=+", + "-complete=custom,nvim_treesitter#available_query_groups", + }, + }, + TSEditQueryUserAfter = { + run = M.edit_query_file_user_after, + args = { + "-nargs=+", + "-complete=custom,nvim_treesitter#available_query_groups", + }, + }, +} + +---@param mod string module +---@param lang string the language of the buffer +---@param bufnr integer the buffer +function M.is_enabled(mod, lang, bufnr) + if not parsers.has_parser(lang) then + return false + end + + local module_config = M.get_module(mod) + if not module_config then + return false + end + + local buffer_enabled = module_config.enabled_buffers and module_config.enabled_buffers[bufnr] + local config_enabled = module_config.enable or buffer_enabled + if not config_enabled or not module_config.is_supported(lang) then + return false + end + + local disable = module_config.disable + if type(disable) == "function" then + if disable(lang, bufnr) then + return false + end + elseif type(disable) == "table" then + -- Otherwise it's a list of languages + for _, parser in pairs(disable) do + if lang == parser then + return false + end + end + end + + return true +end + +---Setup call for users to override module configurations. +---@param user_data TSConfig module overrides +function M.setup(user_data) + config.modules = vim.tbl_deep_extend("force", config.modules, user_data) + config.ignore_install = user_data.ignore_install or {} + config.parser_install_dir = user_data.parser_install_dir or nil + if config.parser_install_dir then + config.parser_install_dir = vim.fn.expand(config.parser_install_dir, ":p") + end + + config.auto_install = user_data.auto_install or false + if config.auto_install then + require("nvim-treesitter.install").setup_auto_install() + end + + local ensure_installed = user_data.ensure_installed or {} + if #ensure_installed > 0 then + if user_data.sync_install then + require("nvim-treesitter.install").ensure_installed_sync(ensure_installed) + else + require("nvim-treesitter.install").ensure_installed(ensure_installed) + end + end + + config.modules.ensure_installed = nil + config.ensure_installed = ensure_installed + + recurse_modules(function(_, _, new_path) + local data = utils.get_at_path(config.modules, new_path) + if data.enable then + enable_all(new_path) + end + end, config.modules) +end + +-- Defines a table of modules that can be attached/detached to buffers +-- based on language support. A module consist of the following properties: +---* @enable Whether the modules is enabled. Can be true or false. +---* @disable A list of languages to disable the module for. Only relevant if enable is true. +---* @keymaps A list of user mappings for a given module if relevant. +---* @is_supported A function which, given a ft, will return true if the ft works on the module. +---* @module_path A string path to a module file using `require`. The exported module must contain +--- an `attach` and `detach` function. This path is not required if `attach` and `detach` +--- functions are provided directly on the module definition. +---* @attach An attach function that is called for each buffer that the module is enabled for. This is required +--- if a `module_path` is not specified. +---* @detach A detach function that is called for each buffer that the module is enabled for. This is required +--- if a `module_path` is not specified. +-- +-- Modules are not setup until `init` is invoked by the plugin. This allows modules to be defined in any order +-- and can be loaded lazily. +-- +---* @example +---require"nvim-treesitter".define_modules { +--- my_cool_module = { +--- attach = function() +--- do_some_cool_setup() +--- end, +--- detach = function() +--- do_some_cool_teardown() +--- end +--- } +---} +---@param mod_defs TSModule[] +function M.define_modules(mod_defs) + if not is_initialized then + table.insert(queued_modules_defs, mod_defs) + return + end + + recurse_modules(function(key, mod, _, group) + group[key] = vim.tbl_extend("keep", mod, { + enable = false, + disable = {}, + is_supported = function() + return true + end, + }) + end, mod_defs) + + config.modules = vim.tbl_deep_extend("keep", config.modules, mod_defs) + + for _, mod in ipairs(M.available_modules(mod_defs)) do + local module_config = M.get_module(mod) + if module_config and module_config.enable then + enable_mod_conf_autocmd(mod) + end + end +end + +---Attaches a module to a buffer +---@param mod_name string the module name +---@param bufnr integer the buffer +---@param lang string the language of the buffer +function M.attach_module(mod_name, bufnr, lang) + bufnr = bufnr or api.nvim_get_current_buf() + lang = lang or parsers.get_buf_lang(bufnr) + local resolved_mod = resolve_module(mod_name) + + if resolved_mod and not attached_buffers_by_module.has(mod_name, bufnr) and M.is_enabled(mod_name, lang, bufnr) then + attached_buffers_by_module.set(mod_name, bufnr, true) + resolved_mod.attach(bufnr, lang) + end +end + +-- Detaches a module to a buffer +---@param mod_name string the module name +---@param bufnr integer the buffer +function M.detach_module(mod_name, bufnr) + local resolved_mod = resolve_module(mod_name) + bufnr = bufnr or api.nvim_get_current_buf() + + if resolved_mod and attached_buffers_by_module.has(mod_name, bufnr) then + attached_buffers_by_module.remove(mod_name, bufnr) + resolved_mod.detach(bufnr) + end +end + +-- Same as attach_module, but if the module is already attached, detach it first. +---@param mod_name string the module name +---@param bufnr integer the buffer +---@param lang string the language of the buffer +function M.reattach_module(mod_name, bufnr, lang) + M.detach_module(mod_name, bufnr) + M.attach_module(mod_name, bufnr, lang) +end + +-- Gets available modules +---@param root {[string]:TSModule}|nil table to find modules +---@return string[] modules list of module paths +function M.available_modules(root) + local modules = {} + + recurse_modules(function(_, _, path) + table.insert(modules, path) + end, root) + + return modules +end + +---Gets a module config by path +---@param mod_path string path to the module +---@return TSModule|nil: the module or nil +function M.get_module(mod_path) + local mod = utils.get_at_path(config.modules, mod_path) + + return M.is_module(mod) and mod or nil +end + +-- Determines whether the provided table is a module. +-- A module should contain an attach and detach function. +---@param mod table|nil the module table +---@return boolean +function M.is_module(mod) + return type(mod) == "table" + and ((type(mod.attach) == "function" and type(mod.detach) == "function") or type(mod.module_path) == "string") +end + +-- Initializes built-in modules and any queued modules +-- registered by plugins or the user. +function M.init() + is_initialized = true + M.define_modules(builtin_modules) + + for _, mod_def in ipairs(queued_modules_defs) do + M.define_modules(mod_def) + end +end + +-- If parser_install_dir is not nil is used or created. +-- If parser_install_dir is nil try the package dir of the nvim-treesitter +-- plugin first, followed by the "site" dir from "runtimepath". "site" dir will +-- be created if it doesn't exist. Using only the package dir won't work when +-- the plugin is installed with Nix, since the "/nix/store" is read-only. +---@param folder_name string|nil +---@return string|nil, string|nil +function M.get_parser_install_dir(folder_name) + folder_name = folder_name or "parser" + + local install_dir = config.parser_install_dir or utils.get_package_path() + local parser_dir = utils.join_path(install_dir, folder_name) + + return utils.create_or_reuse_writable_dir( + parser_dir, + utils.join_space("Could not create parser dir '", parser_dir, "': "), + utils.join_space( + "Parser dir '", + parser_dir, + "' should be read/write (see README on how to configure an alternative install location)" + ) + ) +end + +function M.get_parser_info_dir() + return M.get_parser_install_dir "parser-info" +end + +function M.get_ignored_parser_installs() + return config.ignore_install or {} +end + +function M.get_ensure_installed_parsers() + if type(config.ensure_installed) == "string" then + return { config.ensure_installed } + end + return config.ensure_installed or {} +end + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/fold.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/fold.lua new file mode 100644 index 00000000..75959987 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/fold.lua @@ -0,0 +1,123 @@ +local api = vim.api +local tsutils = require "nvim-treesitter.ts_utils" +local query = require "nvim-treesitter.query" +local parsers = require "nvim-treesitter.parsers" + +local M = {} + +-- This is cached on buf tick to avoid computing that multiple times +-- Especially not for every line in the file when `zx` is hit +local folds_levels = tsutils.memoize_by_buf_tick(function(bufnr) + local max_fold_level = api.nvim_win_get_option(0, "foldnestmax") + local trim_level = function(level) + if level > max_fold_level then + return max_fold_level + end + return level + end + + local parser = parsers.get_parser(bufnr) + + if not parser then + return {} + end + + local matches = query.get_capture_matches_recursively(bufnr, function(lang) + if query.has_folds(lang) then + return "@fold", "folds" + elseif query.has_locals(lang) then + return "@scope", "locals" + end + end) + + -- start..stop is an inclusive range + + ---@type table + local start_counts = {} + ---@type table + local stop_counts = {} + + local prev_start = -1 + local prev_stop = -1 + + local min_fold_lines = api.nvim_win_get_option(0, "foldminlines") + + for _, match in ipairs(matches) do + local start, stop, stop_col ---@type integer, integer, integer + if match.metadata and match.metadata.range then + start, _, stop, stop_col = unpack(match.metadata.range) ---@type integer, integer, integer, integer + else + start, _, stop, stop_col = match.node:range() ---@type integer, integer, integer, integer + end + + if stop_col == 0 then + stop = stop - 1 + end + + local fold_length = stop - start + 1 + local should_fold = fold_length > min_fold_lines + + -- Fold only multiline nodes that are not exactly the same as previously met folds + -- Checking against just the previously found fold is sufficient if nodes + -- are returned in preorder or postorder when traversing tree + if should_fold and not (start == prev_start and stop == prev_stop) then + start_counts[start] = (start_counts[start] or 0) + 1 + stop_counts[stop] = (stop_counts[stop] or 0) + 1 + prev_start = start + prev_stop = stop + end + end + + ---@type string[] + local levels = {} + local current_level = 0 + + -- We now have the list of fold opening and closing, fill the gaps and mark where fold start + for lnum = 0, api.nvim_buf_line_count(bufnr) do + local prefix = "" + + local last_trimmed_level = trim_level(current_level) + current_level = current_level + (start_counts[lnum] or 0) + local trimmed_level = trim_level(current_level) + current_level = current_level - (stop_counts[lnum] or 0) + local next_trimmed_level = trim_level(current_level) + + -- Determine if it's the start/end of a fold + -- NB: vim's fold-expr interface does not have a mechanism to indicate that + -- two (or more) folds start at this line, so it cannot distinguish between + -- ( \n ( \n )) \n (( \n ) \n ) + -- versus + -- ( \n ( \n ) \n ( \n ) \n ) + -- If it did have such a mechanism, (trimmed_level - last_trimmed_level) + -- would be the correct number of starts to pass on. + if trimmed_level - last_trimmed_level > 0 then + prefix = ">" + elseif trimmed_level - next_trimmed_level > 0 then + -- Ending marks tend to confuse vim more than it helps, particularly when + -- the fold level changes by at least 2; we can uncomment this if + -- vim's behavior gets fixed. + -- prefix = "<" + prefix = "" + end + + levels[lnum + 1] = prefix .. tostring(trimmed_level) + end + + return levels +end) + +---@param lnum integer +---@return string +function M.get_fold_indic(lnum) + if not parsers.has_parser() or not lnum then + return "0" + end + + local buf = api.nvim_get_current_buf() + + local levels = folds_levels(buf) or {} + + return levels[lnum] or "0" +end + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/health.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/health.lua new file mode 100644 index 00000000..a71cbf5c --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/health.lua @@ -0,0 +1,176 @@ +local api = vim.api +local fn = vim.fn + +local queries = require "nvim-treesitter.query" +local info = require "nvim-treesitter.info" +local shell = require "nvim-treesitter.shell_command_selectors" +local install = require "nvim-treesitter.install" +local utils = require "nvim-treesitter.utils" +local ts = require "nvim-treesitter.compat" + +local health = vim.health or require "health" + +-- "report_" prefix has been deprecated, use the recommended replacements if they exist. +local _start = health.start or health.report_start +local _ok = health.ok or health.report_ok +local _warn = health.warn or health.report_warn +local _error = health.error or health.report_error + +local M = {} + +local NVIM_TREESITTER_MINIMUM_ABI = 13 + +local function install_health() + _start "Installation" + + if fn.has "nvim-0.9.1" ~= 1 then + _error "Nvim-treesitter requires Neovim 0.9.1+" + end + + if fn.executable "tree-sitter" == 0 then + _warn( + "`tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar," + .. " not required for :TSInstall)" + ) + else + _ok( + "`tree-sitter` found " + .. (utils.ts_cli_version() or "(unknown version)") + .. " (parser generator, only needed for :TSInstallFromGrammar)" + ) + end + + if fn.executable "node" == 0 then + _warn("`node` executable not found (only needed for :TSInstallFromGrammar," .. " not required for :TSInstall)") + else + local handle = io.popen "node --version" + local result = handle:read "*a" + handle:close() + local version = vim.split(result, "\n")[1] + _ok("`node` found " .. version .. " (only needed for :TSInstallFromGrammar)") + end + + if fn.executable "git" == 0 then + _error("`git` executable not found.", { + "Install it with your package manager.", + "Check that your `$PATH` is set correctly.", + }) + else + _ok "`git` executable found." + end + + local cc = shell.select_executable(install.compilers) + if not cc then + _error("`cc` executable not found.", { + "Check that any of " + .. vim.inspect(install.compilers) + .. " is in your $PATH" + .. ' or set the environment variable CC or `require"nvim-treesitter.install".compilers` explicitly!', + }) + else + local version = vim.fn.systemlist(cc .. (cc == "cl" and "" or " --version"))[1] + _ok( + "`" + .. cc + .. "` executable found. Selected from " + .. vim.inspect(install.compilers) + .. (version and ("\nVersion: " .. version) or "") + ) + end + if vim.treesitter.language_version then + if vim.treesitter.language_version >= NVIM_TREESITTER_MINIMUM_ABI then + _ok( + "Neovim was compiled with tree-sitter runtime ABI version " + .. vim.treesitter.language_version + .. " (required >=" + .. NVIM_TREESITTER_MINIMUM_ABI + .. "). Parsers must be compatible with runtime ABI." + ) + else + _error( + "Neovim was compiled with tree-sitter runtime ABI version " + .. vim.treesitter.language_version + .. ".\n" + .. "nvim-treesitter expects at least ABI version " + .. NVIM_TREESITTER_MINIMUM_ABI + .. "\n" + .. "Please make sure that Neovim is linked against are recent tree-sitter runtime when building" + .. " or raise an issue at your Neovim packager. Parsers must be compatible with runtime ABI." + ) + end + end + + _start("OS Info:\n" .. vim.inspect(vim.loop.os_uname())) +end + +local function query_status(lang, query_group) + local ok, err = pcall(queries.get_query, lang, query_group) + if not ok then + return "x", err + elseif not err then + return "." + else + return "✓" + end +end + +function M.check() + local error_collection = {} + -- Installation dependency checks + install_health() + queries.invalidate_query_cache() + -- Parser installation checks + local parser_installation = { "Parser/Features" .. string.rep(" ", 9) .. "H L F I J" } + for _, parser_name in pairs(info.installed_parsers()) do + local installed = #api.nvim_get_runtime_file("parser/" .. parser_name .. ".so", false) + + -- Only append information about installed parsers + if installed >= 1 then + local multiple_parsers = installed > 1 and "+" or "" + local out = " - " .. parser_name .. multiple_parsers .. string.rep(" ", 20 - (#parser_name + #multiple_parsers)) + for _, query_group in pairs(queries.built_in_query_groups) do + local status, err = query_status(parser_name, query_group) + out = out .. status .. " " + if err then + table.insert(error_collection, { parser_name, query_group, err }) + end + end + table.insert(parser_installation, vim.fn.trim(out, " ", 2)) + end + end + local legend = [[ + + Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections + +) multiple parsers found, only one will be used + x) errors found in the query, try to run :TSUpdate {lang}]] + table.insert(parser_installation, legend) + -- Finally call the report function + _start(table.concat(parser_installation, "\n")) + if #error_collection > 0 then + _start "The following errors have been detected:" + for _, p in ipairs(error_collection) do + local lang, type, err = unpack(p) + local lines = {} + table.insert(lines, lang .. "(" .. type .. "): " .. err) + local files = ts.get_query_files(lang, type) + if #files > 0 then + table.insert(lines, lang .. "(" .. type .. ") is concatenated from the following files:") + for _, file in ipairs(files) do + local fd = io.open(file, "r") + if fd then + local ok, file_err = pcall(ts.parse_query, lang, fd:read "*a") + if ok then + table.insert(lines, '| [OK]:"' .. file .. '"') + else + table.insert(lines, '| [ERROR]:"' .. file .. '", failed to load: ' .. file_err) + end + fd:close() + end + end + end + _error(table.concat(lines, "\n")) + end + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/highlight.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/highlight.lua new file mode 100644 index 00000000..5a3cc2e8 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/highlight.lua @@ -0,0 +1,49 @@ +local configs = require "nvim-treesitter.configs" + +local M = {} + +---@param config TSModule +---@param lang string +---@return boolean +local function should_enable_vim_regex(config, lang) + local additional_hl = config.additional_vim_regex_highlighting + local is_table = type(additional_hl) == "table" + + ---@diagnostic disable-next-line: param-type-mismatch + return additional_hl and (not is_table or vim.tbl_contains(additional_hl, lang)) +end + +---@param bufnr integer +---@param lang string +function M.attach(bufnr, lang) + local config = configs.get_module "highlight" + vim.treesitter.start(bufnr, lang) + if config and should_enable_vim_regex(config, lang) then + vim.bo[bufnr].syntax = "ON" + end +end + +---@param bufnr integer +function M.detach(bufnr) + vim.treesitter.stop(bufnr) +end + +---@deprecated +function M.start(...) + vim.notify( + "`nvim-treesitter.highlight.start` is deprecated: use `nvim-treesitter.highlight.attach` or `vim.treesitter.start`", + vim.log.levels.WARN + ) + M.attach(...) +end + +---@deprecated +function M.stop(...) + vim.notify( + "`nvim-treesitter.highlight.stop` is deprecated: use `nvim-treesitter.highlight.detach` or `vim.treesitter.stop`", + vim.log.levels.WARN + ) + M.detach(...) +end + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/incremental_selection.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/incremental_selection.lua new file mode 100644 index 00000000..b0fd7b65 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/incremental_selection.lua @@ -0,0 +1,176 @@ +local api = vim.api + +local configs = require "nvim-treesitter.configs" +local ts_utils = require "nvim-treesitter.ts_utils" +local locals = require "nvim-treesitter.locals" +local parsers = require "nvim-treesitter.parsers" +local queries = require "nvim-treesitter.query" + +local M = {} + +---@type table> +local selections = {} + +function M.init_selection() + local buf = api.nvim_get_current_buf() + local node = ts_utils.get_node_at_cursor() + selections[buf] = { [1] = node } + ts_utils.update_selection(buf, node) +end + +-- Get the range of the current visual selection. +-- +-- The range starts with 1 and the ending is inclusive. +---@return integer, integer, integer, integer +local function visual_selection_range() + local _, csrow, cscol, _ = unpack(vim.fn.getpos "'<") ---@type integer, integer, integer, integer + local _, cerow, cecol, _ = unpack(vim.fn.getpos "'>") ---@type integer, integer, integer, integer + + local start_row, start_col, end_row, end_col ---@type integer, integer, integer, integer + + if csrow < cerow or (csrow == cerow and cscol <= cecol) then + start_row = csrow + start_col = cscol + end_row = cerow + end_col = cecol + else + start_row = cerow + start_col = cecol + end_row = csrow + end_col = cscol + end + + return start_row, start_col, end_row, end_col +end + +---@param node TSNode +---@return boolean +local function range_matches(node) + local csrow, cscol, cerow, cecol = visual_selection_range() + local srow, scol, erow, ecol = ts_utils.get_vim_range { node:range() } + return srow == csrow and scol == cscol and erow == cerow and ecol == cecol +end + +---@param get_parent fun(node: TSNode): TSNode|nil +---@return fun():nil +local function select_incremental(get_parent) + return function() + local buf = api.nvim_get_current_buf() + local nodes = selections[buf] + + local csrow, cscol, cerow, cecol = visual_selection_range() + -- Initialize incremental selection with current selection + if not nodes or #nodes == 0 or not range_matches(nodes[#nodes]) then + local root = parsers.get_parser():parse()[1]:root() + local node = root:named_descendant_for_range(csrow - 1, cscol - 1, cerow - 1, cecol) + ts_utils.update_selection(buf, node) + if nodes and #nodes > 0 then + table.insert(selections[buf], node) + else + selections[buf] = { [1] = node } + end + return + end + + -- Find a node that changes the current selection. + local node = nodes[#nodes] ---@type TSNode + while true do + local parent = get_parent(node) + if not parent or parent == node then + -- Keep searching in the main tree + -- TODO: we should search on the parent tree of the current node. + local root = parsers.get_parser():parse()[1]:root() + parent = root:named_descendant_for_range(csrow - 1, cscol - 1, cerow - 1, cecol) + if not parent or root == node or parent == node then + ts_utils.update_selection(buf, node) + return + end + end + node = parent + local srow, scol, erow, ecol = ts_utils.get_vim_range { node:range() } + local same_range = (srow == csrow and scol == cscol and erow == cerow and ecol == cecol) + if not same_range then + table.insert(selections[buf], node) + if node ~= nodes[#nodes] then + table.insert(nodes, node) + end + ts_utils.update_selection(buf, node) + return + end + end + end +end + +M.node_incremental = select_incremental(function(node) + return node:parent() or node +end) + +M.scope_incremental = select_incremental(function(node) + local lang = parsers.get_buf_lang() + if queries.has_locals(lang) then + return locals.containing_scope(node:parent() or node) + else + return node + end +end) + +function M.node_decremental() + local buf = api.nvim_get_current_buf() + local nodes = selections[buf] + if not nodes or #nodes < 2 then + return + end + + table.remove(selections[buf]) + local node = nodes[#nodes] ---@type TSNode + ts_utils.update_selection(buf, node) +end + +local FUNCTION_DESCRIPTIONS = { + init_selection = "Start selecting nodes with nvim-treesitter", + node_incremental = "Increment selection to named node", + scope_incremental = "Increment selection to surrounding scope", + node_decremental = "Shrink selection to previous named node", +} + +---@param bufnr integer +function M.attach(bufnr) + local config = configs.get_module "incremental_selection" + for funcname, mapping in pairs(config.keymaps) do + if mapping then + ---@type string, string|function + local mode, rhs + if funcname == "init_selection" then + mode = "n" + ---@type function + rhs = M[funcname] + else + mode = "x" + -- We need to move to command mode to access marks '< (visual area start) and '> (visual area end) which are not + -- properly accessible in visual mode. + rhs = string.format(":lua require'nvim-treesitter.incremental_selection'.%s()", funcname) + end + vim.keymap.set( + mode, + mapping, + rhs, + { buffer = bufnr, silent = true, noremap = true, desc = FUNCTION_DESCRIPTIONS[funcname] } + ) + end + end +end + +function M.detach(bufnr) + local config = configs.get_module "incremental_selection" + for f, mapping in pairs(config.keymaps) do + if mapping then + if f == "init_selection" then + vim.keymap.del("n", mapping, { buffer = bufnr }) + else + vim.keymap.del("x", mapping, { buffer = bufnr }) + end + end + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/indent.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/indent.lua new file mode 100644 index 00000000..18d23957 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/indent.lua @@ -0,0 +1,359 @@ +local ts = vim.treesitter +local parsers = require "nvim-treesitter.parsers" + +local M = {} + +M.avoid_force_reparsing = { + yaml = true, +} + +M.comment_parsers = { + comment = true, + jsdoc = true, + phpdoc = true, +} + +local function getline(lnum) + return vim.api.nvim_buf_get_lines(0, lnum - 1, lnum, false)[1] or "" +end + +---@param root TSNode +---@param lnum integer +---@param col? integer +---@return TSNode +local function get_first_node_at_line(root, lnum, col) + col = col or vim.fn.indent(lnum) + return root:descendant_for_range(lnum - 1, col, lnum - 1, col + 1) +end + +---@param root TSNode +---@param lnum integer +---@param col? integer +---@return TSNode +local function get_last_node_at_line(root, lnum, col) + col = col or (#getline(lnum) - 1) + return root:descendant_for_range(lnum - 1, col, lnum - 1, col + 1) +end + +---@param node TSNode +---@return number +local function node_length(node) + local _, _, start_byte = node:start() + local _, _, end_byte = node:end_() + return end_byte - start_byte +end + +---@param bufnr integer +---@param node TSNode +---@param delimiter string +---@return TSNode|nil child +---@return boolean|nil is_end +local function find_delimiter(bufnr, node, delimiter) + for child, _ in node:iter_children() do + if child:type() == delimiter then + local linenr = child:start() + local line = vim.api.nvim_buf_get_lines(bufnr, linenr, linenr + 1, false)[1] + local end_char = { child:end_() } + local trimmed_after_delim + local escaped_delimiter = delimiter:gsub("[%-%.%+%[%]%(%)%$%^%%%?%*]", "%%%1") + trimmed_after_delim, _ = line:sub(end_char[2] + 1):gsub("[%s" .. escaped_delimiter .. "]*", "") + return child, #trimmed_after_delim == 0 + end + end +end + +---Memoize a function using hash_fn to hash the arguments. +---@generic F: function +---@param fn F +---@param hash_fn fun(...): any +---@return F +local function memoize(fn, hash_fn) + local cache = setmetatable({}, { __mode = "kv" }) ---@type table + + return function(...) + local key = hash_fn(...) + if cache[key] == nil then + local v = fn(...) ---@type any + cache[key] = v ~= nil and v or vim.NIL + end + + local v = cache[key] + return v ~= vim.NIL and v or nil + end +end + +local get_indents = memoize(function(bufnr, root, lang) + local map = { + ["indent.auto"] = {}, + ["indent.begin"] = {}, + ["indent.end"] = {}, + ["indent.dedent"] = {}, + ["indent.branch"] = {}, + ["indent.ignore"] = {}, + ["indent.align"] = {}, + ["indent.zero"] = {}, + } + + --TODO(clason): remove when dropping Nvim 0.8 compat + local query = (ts.query.get or ts.get_query)(lang, "indents") + if not query then + return map + end + for id, node, metadata in query:iter_captures(root, bufnr) do + if query.captures[id]:sub(1, 1) ~= "_" then + map[query.captures[id]][node:id()] = metadata or {} + end + end + + return map +end, function(bufnr, root, lang) + return tostring(bufnr) .. root:id() .. "_" .. lang +end) + +---@param lnum number (1-indexed) +function M.get_indent(lnum) + local bufnr = vim.api.nvim_get_current_buf() + local parser = parsers.get_parser(bufnr) + if not parser or not lnum then + return -1 + end + + --TODO(clason): replace when dropping Nvim 0.8 compat + local root_lang = parsers.get_buf_lang(bufnr) + + -- some languages like Python will actually have worse results when re-parsing at opened new line + if not M.avoid_force_reparsing[root_lang] then + -- Reparse in case we got triggered by ":h indentkeys" + parser:parse { vim.fn.line "w0" - 1, vim.fn.line "w$" } + end + + -- Get language tree with smallest range around node that's not a comment parser + local root, lang_tree ---@type TSNode, LanguageTree + parser:for_each_tree(function(tstree, tree) + if not tstree or M.comment_parsers[tree:lang()] then + return + end + local local_root = tstree:root() + if ts.is_in_node_range(local_root, lnum - 1, 0) then + if not root or node_length(root) >= node_length(local_root) then + root = local_root + lang_tree = tree + end + end + end) + + -- Not likely, but just in case... + if not root then + return 0 + end + + local q = get_indents(vim.api.nvim_get_current_buf(), root, lang_tree:lang()) + local is_empty_line = string.match(getline(lnum), "^%s*$") ~= nil + local node ---@type TSNode + if is_empty_line then + local prevlnum = vim.fn.prevnonblank(lnum) + local indent = vim.fn.indent(prevlnum) + local prevline = vim.trim(getline(prevlnum)) + -- The final position can be trailing spaces, which should not affect indentation + node = get_last_node_at_line(root, prevlnum, indent + #prevline - 1) + if node:type():match "comment" then + -- The final node we capture of the previous line can be a comment node, which should also be ignored + -- Unless the last line is an entire line of comment, ignore the comment range and find the last node again + local first_node = get_first_node_at_line(root, prevlnum, indent) + local _, scol, _, _ = node:range() + if first_node:id() ~= node:id() then + -- In case the last captured node is a trailing comment node, re-trim the string + prevline = vim.trim(prevline:sub(1, scol - indent)) + -- Add back indent as indent of prevline was trimmed away + local col = indent + #prevline - 1 + node = get_last_node_at_line(root, prevlnum, col) + end + end + if q["indent.end"][node:id()] then + node = get_first_node_at_line(root, lnum) + end + else + node = get_first_node_at_line(root, lnum) + end + + local indent_size = vim.fn.shiftwidth() + local indent = 0 + local _, _, root_start = root:start() + if root_start ~= 0 then + -- injected tree + indent = vim.fn.indent(root:start() + 1) + end + + -- tracks to ensure multiple indent levels are not applied for same line + local is_processed_by_row = {} + + if q["indent.zero"][node:id()] then + return 0 + end + + while node do + -- do 'autoindent' if not marked as @indent + if + not q["indent.begin"][node:id()] + and not q["indent.align"][node:id()] + and q["indent.auto"][node:id()] + and node:start() < lnum - 1 + and lnum - 1 <= node:end_() + then + return -1 + end + + -- Do not indent if we are inside an @ignore block. + -- If a node spans from L1,C1 to L2,C2, we know that lines where L1 < line <= L2 would + -- have their indentations contained by the node. + if + not q["indent.begin"][node:id()] + and q["indent.ignore"][node:id()] + and node:start() < lnum - 1 + and lnum - 1 <= node:end_() + then + return 0 + end + + local srow, _, erow = node:range() + + local is_processed = false + + if + not is_processed_by_row[srow] + and ((q["indent.branch"][node:id()] and srow == lnum - 1) or (q["indent.dedent"][node:id()] and srow ~= lnum - 1)) + then + indent = indent - indent_size + is_processed = true + end + + -- do not indent for nodes that starts-and-ends on same line and starts on target line (lnum) + local should_process = not is_processed_by_row[srow] + local is_in_err = false + if should_process then + local parent = node:parent() + is_in_err = parent and parent:has_error() + end + if + should_process + and ( + q["indent.begin"][node:id()] + and (srow ~= erow or is_in_err or q["indent.begin"][node:id()]["indent.immediate"]) + and (srow ~= lnum - 1 or q["indent.begin"][node:id()]["indent.start_at_same_line"]) + ) + then + indent = indent + indent_size + is_processed = true + end + + if is_in_err and not q["indent.align"][node:id()] then + -- only when the node is in error, promote the + -- first child's aligned indent to the error node + -- to work around ((ERROR "X" . (_)) @aligned_indent (#set! "delimeter" "AB")) + -- matching for all X, instead set do + -- (ERROR "X" @aligned_indent (#set! "delimeter" "AB") . (_)) + -- and we will fish it out here. + for c in node:iter_children() do + if q["indent.align"][c:id()] then + q["indent.align"][node:id()] = q["indent.align"][c:id()] + break + end + end + end + -- do not indent for nodes that starts-and-ends on same line and starts on target line (lnum) + if should_process and q["indent.align"][node:id()] and (srow ~= erow or is_in_err) and (srow ~= lnum - 1) then + local metadata = q["indent.align"][node:id()] + local o_delim_node, o_is_last_in_line ---@type TSNode|nil, boolean|nil + local c_delim_node, c_is_last_in_line ---@type TSNode|nil, boolean|nil, boolean|nil + local indent_is_absolute = false + if metadata["indent.open_delimiter"] then + o_delim_node, o_is_last_in_line = find_delimiter(bufnr, node, metadata["indent.open_delimiter"]) + else + o_delim_node = node + end + if metadata["indent.close_delimiter"] then + c_delim_node, c_is_last_in_line = find_delimiter(bufnr, node, metadata["indent.close_delimiter"]) + else + c_delim_node = node + end + + if o_delim_node then + local o_srow, o_scol = o_delim_node:start() + local c_srow = nil + if c_delim_node then + c_srow, _ = c_delim_node:start() + end + if o_is_last_in_line then + -- hanging indent (previous line ended with starting delimiter) + -- should be processed like indent + if should_process then + indent = indent + indent_size * 1 + if c_is_last_in_line then + -- If current line is outside the range of a node marked with `@aligned_indent` + -- Then its indent level shouldn't be affected by `@aligned_indent` node + if c_srow and c_srow < lnum - 1 then + indent = math.max(indent - indent_size, 0) + end + end + end + else + -- aligned indent + if c_is_last_in_line and c_srow and o_srow ~= c_srow and c_srow < lnum - 1 then + -- If current line is outside the range of a node marked with `@aligned_indent` + -- Then its indent level shouldn't be affected by `@aligned_indent` node + indent = math.max(indent - indent_size, 0) + else + indent = o_scol + (metadata["indent.increment"] or 1) + indent_is_absolute = true + end + end + -- deal with the final line + local avoid_last_matching_next = false + if c_srow and c_srow ~= o_srow and c_srow == lnum - 1 then + -- delims end on current line, and are not open and closed same line. + -- then this last line may need additional indent to avoid clashes + -- with the next. `indent.avoid_last_matching_next` controls this behavior, + -- for example this is needed for function parameters. + avoid_last_matching_next = metadata["indent.avoid_last_matching_next"] or false + end + if avoid_last_matching_next then + -- last line must be indented more in cases where + -- it would be same indent as next line (we determine this as one + -- width more than the open indent to avoid confusing with any + -- hanging indents) + if indent <= vim.fn.indent(o_srow + 1) + indent_size then + indent = indent + indent_size * 1 + else + indent = indent + end + end + is_processed = true + if indent_is_absolute then + -- don't allow further indenting by parent nodes, this is an absolute position + return indent + end + end + end + + is_processed_by_row[srow] = is_processed_by_row[srow] or is_processed + + node = node:parent() + end + + return indent +end + +---@type table +local indent_funcs = {} + +---@param bufnr integer +function M.attach(bufnr) + indent_funcs[bufnr] = vim.bo.indentexpr + vim.bo.indentexpr = "nvim_treesitter#indent()" +end + +function M.detach(bufnr) + vim.bo.indentexpr = indent_funcs[bufnr] +end + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/info.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/info.lua new file mode 100644 index 00000000..6e94b357 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/info.lua @@ -0,0 +1,190 @@ +local api = vim.api +local configs = require "nvim-treesitter.configs" +local parsers = require "nvim-treesitter.parsers" + +local M = {} + +local function install_info() + local max_len = 0 + for _, ft in pairs(parsers.available_parsers()) do + if #ft > max_len then + max_len = #ft + end + end + + local parser_list = parsers.available_parsers() + table.sort(parser_list) + for _, lang in pairs(parser_list) do + local is_installed = #api.nvim_get_runtime_file("parser/" .. lang .. ".so", false) > 0 + api.nvim_out_write(lang .. string.rep(" ", max_len - #lang + 1)) + if is_installed then + api.nvim_out_write "[✓] installed\n" + elseif pcall(vim.treesitter.inspect_lang, lang) then + api.nvim_out_write "[✗] not installed (but still loaded. Restart Neovim!)\n" + else + api.nvim_out_write "[✗] not installed\n" + end + end +end + +-- Sort a list of modules into namespaces. +-- {'mod1', 'mod2.sub1', 'mod2.sub2', 'mod3'} +-- -> +-- { default = {'mod1', 'mod3'}, mod2 = {'sub1', 'sub2'}} +---@param modulelist string[] +---@return table +local function namespace_modules(modulelist) + local modules = {} + for _, module in ipairs(modulelist) do + if module:find "%." then + local namespace, submodule = module:match "^(.*)%.(.*)$" + if not modules[namespace] then + modules[namespace] = {} + end + table.insert(modules[namespace], submodule) + else + if not modules.default then + modules.default = {} + end + table.insert(modules.default, module) + end + end + return modules +end + +---@param list string[] +---@return integer length +local function longest_string_length(list) + local length = 0 + for _, value in ipairs(list) do + if #value > length then + length = #value + end + end + return length +end + +---@param curbuf integer +---@param origbuf integer +---@param parserlist string[] +---@param namespace string +---@param modulelist string[] +local function append_module_table(curbuf, origbuf, parserlist, namespace, modulelist) + local maxlen_parser = longest_string_length(parserlist) + table.sort(modulelist) + + -- header + local header = ">> " .. namespace .. string.rep(" ", maxlen_parser - #namespace - 1) + for _, module in pairs(modulelist) do + header = header .. module .. " " + end + api.nvim_buf_set_lines(curbuf, -1, -1, true, { header }) + + -- actual table + for _, parser in ipairs(parserlist) do + local padding = string.rep(" ", maxlen_parser - #parser + 2) + local line = parser .. padding + local namespace_prefix = (namespace == "default") and "" or namespace .. "." + for _, module in pairs(modulelist) do + local modlen = #module + module = namespace_prefix .. module + if configs.is_enabled(module, parser, origbuf) then + line = line .. "✓" + else + line = line .. "✗" + end + line = line .. string.rep(" ", modlen + 1) + end + api.nvim_buf_set_lines(curbuf, -1, -1, true, { line }) + end + + api.nvim_buf_set_lines(curbuf, -1, -1, true, { "" }) +end + +local function print_info_modules(parserlist, module) + local origbuf = api.nvim_get_current_buf() + api.nvim_command "enew" + local curbuf = api.nvim_get_current_buf() + + local modules + if module then + modules = namespace_modules { module } + else + modules = namespace_modules(configs.available_modules()) + end + + ---@type string[] + local namespaces = {} + for k, _ in pairs(modules) do + table.insert(namespaces, k) + end + table.sort(namespaces) + + table.sort(parserlist) + for _, namespace in ipairs(namespaces) do + append_module_table(curbuf, origbuf, parserlist, namespace, modules[namespace]) + end + + api.nvim_buf_set_option(curbuf, "modified", false) + api.nvim_buf_set_option(curbuf, "buftype", "nofile") + vim.cmd [[ + syntax match TSModuleInfoGood /✓/ + syntax match TSModuleInfoBad /✗/ + syntax match TSModuleInfoHeader /^>>.*$/ contains=TSModuleInfoNamespace + syntax match TSModuleInfoNamespace /^>> \w*/ contained + syntax match TSModuleInfoParser /^[^> ]*\ze / + ]] + + local highlights = { + TSModuleInfoGood = { fg = "LightGreen", bold = true, default = true }, + TSModuleInfoBad = { fg = "Crimson", default = true }, + TSModuleInfoHeader = { link = "Type", default = true }, + TSModuleInfoNamespace = { link = "Statement", default = true }, + TSModuleInfoParser = { link = "Identifier", default = true }, + } + for k, v in pairs(highlights) do + api.nvim_set_hl(0, k, v) + end +end + +local function module_info(module) + if module and not configs.get_module(module) then + return + end + + local parserlist = parsers.available_parsers() + if module then + print_info_modules(parserlist, module) + else + print_info_modules(parserlist) + end +end + +---@return string[] +function M.installed_parsers() + local installed = {} + for _, p in pairs(parsers.available_parsers()) do + if parsers.has_parser(p) then + table.insert(installed, p) + end + end + return installed +end + +M.commands = { + TSInstallInfo = { + run = install_info, + args = { + "-nargs=0", + }, + }, + TSModuleInfo = { + run = module_info, + args = { + "-nargs=?", + "-complete=custom,nvim_treesitter#available_modules", + }, + }, +} + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/install.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/install.lua new file mode 100644 index 00000000..82d233e2 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/install.lua @@ -0,0 +1,773 @@ +local api = vim.api +local fn = vim.fn +local luv = vim.loop + +local utils = require "nvim-treesitter.utils" +local parsers = require "nvim-treesitter.parsers" +local info = require "nvim-treesitter.info" +local configs = require "nvim-treesitter.configs" +local shell = require "nvim-treesitter.shell_command_selectors" + +local M = {} + +---@class LockfileInfo +---@field revision string + +---@type table +local lockfile = {} + +M.compilers = { vim.fn.getenv "CC", "cc", "gcc", "clang", "cl", "zig" } +M.prefer_git = fn.has "win32" == 1 +M.command_extra_args = {} +M.ts_generate_args = nil + +local started_commands = 0 +local finished_commands = 0 +local failed_commands = 0 +local complete_std_output = {} +local complete_error_output = {} + +local function reset_progress_counter() + if started_commands ~= finished_commands then + return + end + started_commands = 0 + finished_commands = 0 + failed_commands = 0 + complete_std_output = {} + complete_error_output = {} +end + +local function get_job_status() + return "[nvim-treesitter] [" + .. finished_commands + .. "/" + .. started_commands + .. (failed_commands > 0 and ", failed: " .. failed_commands or "") + .. "]" +end + +---@param lang string +---@return function +local function reattach_if_possible_fn(lang, error_on_fail) + return function() + for _, buf in ipairs(vim.api.nvim_list_bufs()) do + if parsers.get_buf_lang(buf) == lang then + vim._ts_remove_language(lang) + local ok, err + if vim.treesitter.language.add then + local ft = vim.bo[buf].filetype + ok, err = pcall(vim.treesitter.language.add, lang, { filetype = ft }) + else + ok, err = pcall(vim.treesitter.language.require_language, lang) + end + if not ok and error_on_fail then + vim.notify("Could not load parser for " .. lang .. ": " .. vim.inspect(err)) + end + for _, mod in ipairs(require("nvim-treesitter.configs").available_modules()) do + if ok then + require("nvim-treesitter.configs").reattach_module(mod, buf, lang) + else + require("nvim-treesitter.configs").detach_module(mod, buf) + end + end + end + end + end +end + +---@param lang string +---@param validate boolean|nil +---@return InstallInfo +local function get_parser_install_info(lang, validate) + local parser_config = parsers.get_parser_configs()[lang] + + if not parser_config then + error('Parser not available for language "' .. lang .. '"') + end + + local install_info = parser_config.install_info + + if validate then + vim.validate { + url = { install_info.url, "string" }, + files = { install_info.files, "table" }, + } + end + + return install_info +end + +local function load_lockfile() + local filename = utils.join_path(utils.get_package_path(), "lockfile.json") + lockfile = vim.fn.filereadable(filename) == 1 and vim.fn.json_decode(vim.fn.readfile(filename)) or {} +end + +local function is_ignored_parser(lang) + return vim.tbl_contains(configs.get_ignored_parser_installs(), lang) +end + +---@param lang string +---@return string|nil +local function get_revision(lang) + if #lockfile == 0 then + load_lockfile() + end + + local install_info = get_parser_install_info(lang) + if install_info.revision then + return install_info.revision + end + + if lockfile[lang] then + return lockfile[lang].revision + end +end + +---@param lang string +---@return string|nil +local function get_installed_revision(lang) + local lang_file = utils.join_path(configs.get_parser_info_dir(), lang .. ".revision") + if vim.fn.filereadable(lang_file) == 1 then + return vim.fn.readfile(lang_file)[1] + end +end + +-- Clean path for use in a prefix comparison +---@param input string +---@return string +local function clean_path(input) + local pth = vim.fn.fnamemodify(input, ":p") + if fn.has "win32" == 1 then + pth = pth:gsub("/", "\\") + end + return pth +end + +-- Checks if parser is installed with nvim-treesitter +---@param lang string +---@return boolean +local function is_installed(lang) + local matched_parsers = vim.api.nvim_get_runtime_file("parser/" .. lang .. ".so", true) or {} + local install_dir = configs.get_parser_install_dir() + if not install_dir then + return false + end + install_dir = clean_path(install_dir) + for _, path in ipairs(matched_parsers) do + local abspath = clean_path(path) + if vim.startswith(abspath, install_dir) then + return true + end + end + return false +end + +---@param lang string +---@return boolean +local function needs_update(lang) + local revision = get_revision(lang) + return not revision or revision ~= get_installed_revision(lang) +end + +---@return string[] +local function outdated_parsers() + return vim.tbl_filter(function(lang) ---@param lang string + return is_installed(lang) and needs_update(lang) + end, info.installed_parsers()) +end + +---@param handle userdata +---@param is_stderr boolean +local function onread(handle, is_stderr) + return function(_, data) + if data then + if is_stderr then + complete_error_output[handle] = (complete_error_output[handle] or "") .. data + else + complete_std_output[handle] = (complete_std_output[handle] or "") .. data + end + end + end +end + +function M.iter_cmd(cmd_list, i, lang, success_message) + if i == 1 then + started_commands = started_commands + 1 + end + if i == #cmd_list + 1 then + finished_commands = finished_commands + 1 + return print(get_job_status() .. " " .. success_message) + end + + local attr = cmd_list[i] + if attr.info then + print(get_job_status() .. " " .. attr.info) + end + + if attr.opts and attr.opts.args and M.command_extra_args[attr.cmd] then + vim.list_extend(attr.opts.args, M.command_extra_args[attr.cmd]) + end + + if type(attr.cmd) == "function" then + local ok, err = pcall(attr.cmd) + if ok then + M.iter_cmd(cmd_list, i + 1, lang, success_message) + else + failed_commands = failed_commands + 1 + finished_commands = finished_commands + 1 + return api.nvim_err_writeln( + (attr.err or ("Failed to execute the following command:\n" .. vim.inspect(attr))) .. "\n" .. vim.inspect(err) + ) + end + else + local handle + local stdout = luv.new_pipe(false) + local stderr = luv.new_pipe(false) + attr.opts.stdio = { nil, stdout, stderr } + ---@type userdata + handle = luv.spawn( + attr.cmd, + attr.opts, + vim.schedule_wrap(function(code) + if code ~= 0 then + stdout:read_stop() + stderr:read_stop() + end + stdout:close() + stderr:close() + handle:close() + if code ~= 0 then + failed_commands = failed_commands + 1 + finished_commands = finished_commands + 1 + if complete_std_output[handle] and complete_std_output[handle] ~= "" then + print(complete_std_output[handle]) + end + + local err_msg = complete_error_output[handle] or "" + api.nvim_err_writeln( + "nvim-treesitter[" + .. lang + .. "]: " + .. (attr.err or ("Failed to execute the following command:\n" .. vim.inspect(attr))) + .. "\n" + .. err_msg + ) + return + end + M.iter_cmd(cmd_list, i + 1, lang, success_message) + end) + ) + luv.read_start(stdout, onread(handle, false)) + luv.read_start(stderr, onread(handle, true)) + end +end + +---@param cmd Command +---@return string command +local function get_command(cmd) + local options = "" + if cmd.opts and cmd.opts.args then + if M.command_extra_args[cmd.cmd] then + vim.list_extend(cmd.opts.args, M.command_extra_args[cmd.cmd]) + end + for _, opt in ipairs(cmd.opts.args) do + options = string.format("%s %s", options, opt) + end + end + + local command = string.format("%s %s", cmd.cmd, options) + if cmd.opts and cmd.opts.cwd then + command = shell.make_directory_change_for_command(cmd.opts.cwd, command) + end + return command +end + +---@param cmd_list Command[] +---@return boolean +local function iter_cmd_sync(cmd_list) + for _, cmd in ipairs(cmd_list) do + if cmd.info then + print(cmd.info) + end + + if type(cmd.cmd) == "function" then + cmd.cmd() + else + local ret = vim.fn.system(get_command(cmd)) + if vim.v.shell_error ~= 0 then + print(ret) + api.nvim_err_writeln( + (cmd.err and cmd.err .. "\n" or "") .. "Failed to execute the following command:\n" .. vim.inspect(cmd) + ) + return false + end + end + end + + return true +end + +---@param cache_folder string +---@param install_folder string +---@param lang string +---@param repo InstallInfo +---@param with_sync boolean +---@param generate_from_grammar boolean +local function run_install(cache_folder, install_folder, lang, repo, with_sync, generate_from_grammar) + parsers.reset_cache() + + local path_sep = utils.get_path_sep() + + local project_name = "tree-sitter-" .. lang + local maybe_local_path = vim.fn.expand(repo.url) + local from_local_path = vim.fn.isdirectory(maybe_local_path) == 1 + if from_local_path then + repo.url = maybe_local_path + end + + ---@type string compile_location only needed for typescript installs. + local compile_location + if from_local_path then + compile_location = repo.url + if repo.location then + compile_location = utils.join_path(compile_location, repo.location) + end + else + local repo_location = project_name + if repo.location then + repo_location = repo_location .. "/" .. repo.location + end + repo_location = repo_location:gsub("/", path_sep) + compile_location = utils.join_path(cache_folder, repo_location) + end + local parser_lib_name = utils.join_path(install_folder, lang) .. ".so" + + generate_from_grammar = repo.requires_generate_from_grammar or generate_from_grammar + + if generate_from_grammar and vim.fn.executable "tree-sitter" ~= 1 then + api.nvim_err_writeln "tree-sitter CLI not found: `tree-sitter` is not executable!" + if repo.requires_generate_from_grammar then + api.nvim_err_writeln( + "tree-sitter CLI is needed because `" + .. lang + .. "` is marked that it needs " + .. "to be generated from the grammar definitions to be compatible with nvim!" + ) + end + return + else + if not M.ts_generate_args then + local ts_cli_version = utils.ts_cli_version() + if ts_cli_version and vim.split(ts_cli_version, " ")[1] > "0.20.2" then + M.ts_generate_args = { "generate", "--abi", vim.treesitter.language_version } + else + M.ts_generate_args = { "generate" } + end + end + end + if generate_from_grammar and vim.fn.executable "node" ~= 1 then + api.nvim_err_writeln "Node JS not found: `node` is not executable!" + return + end + local cc = shell.select_executable(M.compilers) + if not cc then + api.nvim_err_writeln('No C compiler found! "' .. table.concat( + vim.tbl_filter(function(c) ---@param c string + return type(c) == "string" + end, M.compilers), + '", "' + ) .. '" are not executable.') + return + end + + local revision = repo.revision + if not revision then + revision = get_revision(lang) + end + + ---@class Command + ---@field cmd string + ---@field info string + ---@field err string + ---@field opts CmdOpts + + ---@class CmdOpts + ---@field args string[] + ---@field cwd string + + ---@type Command[] + local command_list = {} + if not from_local_path then + vim.list_extend(command_list, { shell.select_install_rm_cmd(cache_folder, project_name) }) + vim.list_extend( + command_list, + shell.select_download_commands(repo, project_name, cache_folder, revision, M.prefer_git) + ) + end + if generate_from_grammar then + if repo.generate_requires_npm then + if vim.fn.executable "npm" ~= 1 then + api.nvim_err_writeln("`" .. lang .. "` requires NPM to be installed from grammar.js") + return + end + vim.list_extend(command_list, { + { + cmd = "npm", + info = "Installing NPM dependencies of " .. lang .. " parser", + err = "Error during `npm install` (required for parser generation of " .. lang .. " with npm dependencies)", + opts = { + args = { "install" }, + cwd = compile_location, + }, + }, + }) + end + vim.list_extend(command_list, { + { + cmd = vim.fn.exepath "tree-sitter", + info = "Generating source files from grammar.js...", + err = 'Error during "tree-sitter generate"', + opts = { + args = M.ts_generate_args, + cwd = compile_location, + }, + }, + }) + end + vim.list_extend(command_list, { + shell.select_compile_command(repo, cc, compile_location), + shell.select_mv_cmd("parser.so", parser_lib_name, compile_location), + { + cmd = function() + vim.fn.writefile({ revision or "" }, utils.join_path(configs.get_parser_info_dir() or "", lang .. ".revision")) + end, + }, + { -- auto-attach modules after installation + cmd = reattach_if_possible_fn(lang, true), + }, + }) + if not from_local_path then + vim.list_extend(command_list, { shell.select_install_rm_cmd(cache_folder, project_name) }) + end + + if with_sync then + if iter_cmd_sync(command_list) == true then + print("Treesitter parser for " .. lang .. " has been installed") + end + else + M.iter_cmd(command_list, 1, lang, "Treesitter parser for " .. lang .. " has been installed") + end +end + +---@param lang string +---@param ask_reinstall boolean|string +---@param cache_folder string +---@param install_folder string +---@param with_sync boolean +---@param generate_from_grammar boolean +local function install_lang(lang, ask_reinstall, cache_folder, install_folder, with_sync, generate_from_grammar) + if is_installed(lang) and ask_reinstall ~= "force" then + if not ask_reinstall then + return + end + + local yesno = fn.input(lang .. " parser already available: would you like to reinstall ? y/n: ") + print "\n " + if not string.match(yesno, "^y.*") then + return + end + end + + local ok, install_info = pcall(get_parser_install_info, lang, true) + if not ok then + vim.notify("Installation not possible: " .. install_info, vim.log.levels.ERROR) + if not parsers.get_parser_configs()[lang] then + vim.notify( + "See https://github.com/nvim-treesitter/nvim-treesitter/#adding-parsers on how to add a new parser!", + vim.log.levels.INFO + ) + end + return + end + + run_install(cache_folder, install_folder, lang, install_info, with_sync, generate_from_grammar) +end + +---@class InstallOptions +---@field with_sync boolean +---@field ask_reinstall boolean|string +---@field generate_from_grammar boolean +---@field exclude_configured_parsers boolean + +-- Install a parser +---@param options? InstallOptions +---@return function +local function install(options) + options = options or {} + local with_sync = options.with_sync + local ask_reinstall = options.ask_reinstall + local generate_from_grammar = options.generate_from_grammar + local exclude_configured_parsers = options.exclude_configured_parsers + + return function(...) + if fn.executable "git" == 0 then + return api.nvim_err_writeln "Git is required on your system to run this command" + end + + local cache_folder, err = utils.get_cache_dir() + if err then + return api.nvim_err_writeln(err) + end + assert(cache_folder) + + local install_folder + install_folder, err = configs.get_parser_install_dir() + if err then + return api.nvim_err_writeln(err) + end + assert(install_folder) + + local languages ---@type string[] + local ask ---@type boolean|string + if ... == "all" then + languages = parsers.available_parsers() + ask = false + else + languages = vim.tbl_flatten { ... } + ask = ask_reinstall + end + + if exclude_configured_parsers then + languages = utils.difference(languages, configs.get_ignored_parser_installs()) + end + + if #languages > 1 then + reset_progress_counter() + end + + for _, lang in ipairs(languages) do + install_lang(lang, ask, cache_folder, install_folder, with_sync, generate_from_grammar) + end + end +end + +function M.setup_auto_install() + vim.api.nvim_create_autocmd("FileType", { + pattern = { "*" }, + callback = function() + local lang = parsers.get_buf_lang() + if parsers.get_parser_configs()[lang] and not is_installed(lang) and not is_ignored_parser(lang) then + install() { lang } + end + end, + }) +end + +function M.update(options) + options = options or {} + return function(...) + M.lockfile = {} + reset_progress_counter() + if ... and ... ~= "all" then + ---@type string[] + local languages = vim.tbl_flatten { ... } + local installed = 0 + for _, lang in ipairs(languages) do + if (not is_installed(lang)) or (needs_update(lang)) then + installed = installed + 1 + install { + ask_reinstall = "force", + with_sync = options.with_sync, + }(lang) + end + end + if installed == 0 then + utils.notify "Parsers are up-to-date!" + end + else + local parsers_to_update = outdated_parsers() or info.installed_parsers() + if #parsers_to_update == 0 then + utils.notify "All parsers are up-to-date!" + end + for _, lang in pairs(parsers_to_update) do + install { + ask_reinstall = "force", + exclude_configured_parsers = true, + with_sync = options.with_sync, + }(lang) + end + end + end +end + +function M.uninstall(...) + if vim.tbl_contains({ "all" }, ...) then + reset_progress_counter() + local installed = info.installed_parsers() + M.uninstall(installed) + elseif ... then + local ensure_installed_parsers = configs.get_ensure_installed_parsers() + if ensure_installed_parsers == "all" then + ensure_installed_parsers = parsers.available_parsers() + end + ensure_installed_parsers = utils.difference(ensure_installed_parsers, configs.get_ignored_parser_installs()) + + ---@type string[] + local languages = vim.tbl_flatten { ... } + for _, lang in ipairs(languages) do + local install_dir, err = configs.get_parser_install_dir() + if err then + return api.nvim_err_writeln(err) + end + + if vim.tbl_contains(ensure_installed_parsers, lang) then + vim.notify( + "Uninstalling " + .. lang + .. '. But the parser is still configured in "ensure_installed" setting of nvim-treesitter.' + .. " Please consider updating your config!", + vim.log.levels.ERROR + ) + end + + local parser_lib = utils.join_path(install_dir, lang) .. ".so" + local all_parsers = vim.api.nvim_get_runtime_file("parser/" .. lang .. ".so", true) + if vim.fn.filereadable(parser_lib) == 1 then + local command_list = { + shell.select_rm_file_cmd(parser_lib, "Uninstalling parser for " .. lang), + { + cmd = function() + local all_parsers_after_deletion = vim.api.nvim_get_runtime_file("parser/" .. lang .. ".so", true) + if #all_parsers_after_deletion > 0 then + vim.notify( + "Tried to uninstall parser for " + .. lang + .. "! But the parser is still installed (not by nvim-treesitter):" + .. table.concat(all_parsers_after_deletion, ", "), + vim.log.levels.ERROR + ) + end + end, + }, + { -- auto-reattach or detach modules after uninstallation + cmd = reattach_if_possible_fn(lang, false), + }, + } + M.iter_cmd(command_list, 1, lang, "Treesitter parser for " .. lang .. " has been uninstalled") + elseif #all_parsers > 0 then + vim.notify( + "Parser for " + .. lang + .. " is installed! But not by nvim-treesitter! Please manually remove the following files: " + .. table.concat(all_parsers, ", "), + vim.log.levels.ERROR + ) + end + end + end +end + +function M.write_lockfile(verbose, skip_langs) + local sorted_parsers = {} ---@type Parser[] + -- Load previous lockfile + load_lockfile() + skip_langs = skip_langs or {} + + for k, v in pairs(parsers.get_parser_configs()) do + table.insert(sorted_parsers, { name = k, parser = v }) + end + + ---@param a Parser + ---@param b Parser + table.sort(sorted_parsers, function(a, b) + return a.name < b.name + end) + + for _, v in ipairs(sorted_parsers) do + if not vim.tbl_contains(skip_langs, v.name) then + -- I'm sure this can be done in aync way with iter_cmd + local sha ---@type string + if v.parser.install_info.branch then + sha = vim.split( + vim.fn.systemlist( + "git ls-remote " .. v.parser.install_info.url .. " | grep refs/heads/" .. v.parser.install_info.branch + )[1], + "\t" + )[1] + else + sha = vim.split(vim.fn.systemlist("git ls-remote " .. v.parser.install_info.url)[1], "\t")[1] + end + lockfile[v.name] = { revision = sha } + if verbose then + print(v.name .. ": " .. sha) + end + else + print("Skipping " .. v.name) + end + end + + if verbose then + print(vim.inspect(lockfile)) + end + vim.fn.writefile( + vim.fn.split(vim.fn.json_encode(lockfile), "\n"), + utils.join_path(utils.get_package_path(), "lockfile.json") + ) +end + +M.ensure_installed = install { exclude_configured_parsers = true } +M.ensure_installed_sync = install { with_sync = true, exclude_configured_parsers = true } + +M.commands = { + TSInstall = { + run = install { ask_reinstall = true }, + ["run!"] = install { ask_reinstall = "force" }, + args = { + "-nargs=+", + "-bang", + "-complete=custom,nvim_treesitter#installable_parsers", + }, + }, + TSInstallFromGrammar = { + run = install { generate_from_grammar = true, ask_reinstall = true }, + ["run!"] = install { generate_from_grammar = true, ask_reinstall = "force" }, + args = { + "-nargs=+", + "-bang", + "-complete=custom,nvim_treesitter#installable_parsers", + }, + }, + TSInstallSync = { + run = install { with_sync = true, ask_reinstall = true }, + ["run!"] = install { with_sync = true, ask_reinstall = "force" }, + args = { + "-nargs=+", + "-bang", + "-complete=custom,nvim_treesitter#installable_parsers", + }, + }, + TSUpdate = { + run = M.update {}, + args = { + "-nargs=*", + "-complete=custom,nvim_treesitter#installed_parsers", + }, + }, + TSUpdateSync = { + run = M.update { with_sync = true }, + args = { + "-nargs=*", + "-complete=custom,nvim_treesitter#installed_parsers", + }, + }, + TSUninstall = { + run = M.uninstall, + args = { + "-nargs=+", + "-complete=custom,nvim_treesitter#installed_parsers", + }, + }, +} + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/locals.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/locals.lua new file mode 100644 index 00000000..cc69d562 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/locals.lua @@ -0,0 +1,364 @@ +-- Functions to handle locals +-- Locals are a generalization of definition and scopes +-- its the way nvim-treesitter uses to "understand" the code + +local queries = require "nvim-treesitter.query" +local ts_utils = require "nvim-treesitter.ts_utils" +local ts = vim.treesitter +local api = vim.api + +local M = {} + +function M.collect_locals(bufnr) + return queries.collect_group_results(bufnr, "locals") +end + +-- Iterates matches from a locals query file. +-- @param bufnr the buffer +-- @param root the root node +function M.iter_locals(bufnr, root) + return queries.iter_group_results(bufnr, "locals", root) +end + +---@param bufnr integer +---@return any +function M.get_locals(bufnr) + return queries.get_matches(bufnr, "locals") +end + +-- Creates unique id for a node based on text and range +---@param scope TSNode: the scope node of the definition +---@param node_text string: the node text to use +---@return string: a string id +function M.get_definition_id(scope, node_text) + -- Add a valid starting character in case node text doesn't start with a valid one. + return table.concat({ "k", node_text or "", scope:range() }, "_") +end + +function M.get_definitions(bufnr) + local locals = M.get_locals(bufnr) + + local defs = {} + + for _, loc in ipairs(locals) do + if loc.definition then + table.insert(defs, loc.definition) + end + end + + return defs +end + +function M.get_scopes(bufnr) + local locals = M.get_locals(bufnr) + + local scopes = {} + + for _, loc in ipairs(locals) do + if loc.scope and loc.scope.node then + table.insert(scopes, loc.scope.node) + end + end + + return scopes +end + +function M.get_references(bufnr) + local locals = M.get_locals(bufnr) + + local refs = {} + + for _, loc in ipairs(locals) do + if loc.reference and loc.reference.node then + table.insert(refs, loc.reference.node) + end + end + + return refs +end + +-- Gets a table with all the scopes containing a node +-- The order is from most specific to least (bottom up) +---@param node TSNode +---@param bufnr integer +---@return TSNode[] +function M.get_scope_tree(node, bufnr) + local scopes = {} ---@type TSNode[] + + for scope in M.iter_scope_tree(node, bufnr) do + table.insert(scopes, scope) + end + + return scopes +end + +-- Iterates over a nodes scopes moving from the bottom up +---@param node TSNode +---@param bufnr integer +---@return fun(): TSNode|nil +function M.iter_scope_tree(node, bufnr) + local last_node = node + return function() + if not last_node then + return + end + + local scope = M.containing_scope(last_node, bufnr, false) or ts_utils.get_root_for_node(node) + + last_node = scope:parent() + + return scope + end +end + +-- Gets a table of all nodes and their 'kinds' from a locals list +---@param local_def any: the local list result +---@return table: a list of node entries +function M.get_local_nodes(local_def) + local result = {} + + M.recurse_local_nodes(local_def, function(def, _node, kind) + table.insert(result, vim.tbl_extend("keep", { kind = kind }, def)) + end) + + return result +end + +-- Recurse locals results until a node is found. +-- The accumulator function is given +-- * The table of the node +-- * The node +-- * The full definition match `@definition.var.something` -> 'var.something' +-- * The last definition match `@definition.var.something` -> 'something' +---@param local_def any The locals result +---@param accumulator function The accumulator function +---@param full_match? string The full match path to append to +---@param last_match? string The last match +function M.recurse_local_nodes(local_def, accumulator, full_match, last_match) + if type(local_def) ~= "table" then + return + end + + if local_def.node then + accumulator(local_def, local_def.node, full_match, last_match) + else + for match_key, def in pairs(local_def) do + M.recurse_local_nodes(def, accumulator, full_match and (full_match .. "." .. match_key) or match_key, match_key) + end + end +end + +-- Get a single dimension table to look definition nodes. +-- Keys are generated by using the range of the containing scope and the text of the definition node. +-- This makes looking up a definition for a given scope a simple key lookup. +-- +-- This is memoized by buffer tick. If the function is called in succession +-- without the buffer tick changing, then the previous result will be used +-- since the syntax tree hasn't changed. +-- +-- Usage lookups require finding the definition of the node, so `find_definition` +-- is called very frequently, which is why this lookup must be fast as possible. +-- +---@param bufnr integer: the buffer +---@return table result: a table for looking up definitions +M.get_definitions_lookup_table = ts_utils.memoize_by_buf_tick(function(bufnr) + local definitions = M.get_definitions(bufnr) + local result = {} + + for _, definition in ipairs(definitions) do + for _, node_entry in ipairs(M.get_local_nodes(definition)) do + local scopes = M.get_definition_scopes(node_entry.node, bufnr, node_entry.scope) + -- Always use the highest valid scope + local scope = scopes[#scopes] + local node_text = ts.get_node_text(node_entry.node, bufnr) + local id = M.get_definition_id(scope, node_text) + + result[id] = node_entry + end + end + + return result +end) + +-- Gets all the scopes of a definition based on the scope type +-- Scope types can be +-- +-- "parent": Uses the parent of the containing scope, basically, skipping a scope +-- "global": Uses the top most scope +-- "local": Uses the containing scope of the definition. This is the default +-- +---@param node TSNode: the definition node +---@param bufnr integer: the buffer +---@param scope_type string: the scope type +function M.get_definition_scopes(node, bufnr, scope_type) + local scopes = {} + local scope_count = 1 ---@type integer|nil + + -- Definition is valid for the containing scope + -- and the containing scope of that scope + if scope_type == "parent" then + scope_count = 2 + -- Definition is valid in all parent scopes + elseif scope_type == "global" then + scope_count = nil + end + + local i = 0 + for scope in M.iter_scope_tree(node, bufnr) do + table.insert(scopes, scope) + i = i + 1 + + if scope_count and i >= scope_count then + break + end + end + + return scopes +end + +---@param node TSNode +---@param bufnr integer +---@return TSNode node +---@return TSNode scope +---@return string|nil kind +function M.find_definition(node, bufnr) + local def_lookup = M.get_definitions_lookup_table(bufnr) + local node_text = ts.get_node_text(node, bufnr) + + for scope in M.iter_scope_tree(node, bufnr) do + local id = M.get_definition_id(scope, node_text) + + if def_lookup[id] then + local entry = def_lookup[id] + + return entry.node, scope, entry.kind + end + end + + return node, ts_utils.get_root_for_node(node), nil +end + +-- Finds usages of a node in a given scope. +---@param node TSNode the node to find usages for +---@param scope_node TSNode the node to look within +---@return TSNode[]: a list of nodes +function M.find_usages(node, scope_node, bufnr) + bufnr = bufnr or api.nvim_get_current_buf() + local node_text = ts.get_node_text(node, bufnr) + + if not node_text or #node_text < 1 then + return {} + end + + local scope_node = scope_node or ts_utils.get_root_for_node(node) + local usages = {} + + for match in M.iter_locals(bufnr, scope_node) do + if match.reference and match.reference.node and ts.get_node_text(match.reference.node, bufnr) == node_text then + local def_node, _, kind = M.find_definition(match.reference.node, bufnr) + + if kind == nil or def_node == node then + table.insert(usages, match.reference.node) + end + end + end + + return usages +end + +---@param node TSNode +---@param bufnr? integer +---@param allow_scope? boolean +---@return TSNode|nil +function M.containing_scope(node, bufnr, allow_scope) + local bufnr = bufnr or api.nvim_get_current_buf() + local allow_scope = allow_scope == nil or allow_scope == true + + local scopes = M.get_scopes(bufnr) + if not node or not scopes then + return + end + + local iter_node = node + + while iter_node ~= nil and not vim.tbl_contains(scopes, iter_node) do + iter_node = iter_node:parent() + end + + return iter_node or (allow_scope and node or nil) +end + +function M.nested_scope(node, cursor_pos) + local bufnr = api.nvim_get_current_buf() + + local scopes = M.get_scopes(bufnr) + if not node or not scopes then + return + end + + local row = cursor_pos.row ---@type integer + local col = cursor_pos.col ---@type integer + local scope = M.containing_scope(node) + + for _, child in ipairs(ts_utils.get_named_children(scope)) do + local row_, col_ = child:start() + if vim.tbl_contains(scopes, child) and ((row_ + 1 == row and col_ > col) or row_ + 1 > row) then + return child + end + end +end + +function M.next_scope(node) + local bufnr = api.nvim_get_current_buf() + + local scopes = M.get_scopes(bufnr) + if not node or not scopes then + return + end + + local scope = M.containing_scope(node) + + local parent = scope:parent() + if not parent then + return + end + + local is_prev = true + for _, child in ipairs(ts_utils.get_named_children(parent)) do + if child == scope then + is_prev = false + elseif not is_prev and vim.tbl_contains(scopes, child) then + return child + end + end +end + +---@param node TSNode +---@return TSNode|nil +function M.previous_scope(node) + local bufnr = api.nvim_get_current_buf() + + local scopes = M.get_scopes(bufnr) + if not node or not scopes then + return + end + + local scope = M.containing_scope(node) + + local parent = scope:parent() + if not parent then + return + end + + local is_prev = true + local children = ts_utils.get_named_children(parent) + for i = #children, 1, -1 do + if children[i] == scope then + is_prev = false + elseif not is_prev and vim.tbl_contains(scopes, children[i]) then + return children[i] + end + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/parsers.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/parsers.lua new file mode 100644 index 00000000..bfadf523 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/parsers.lua @@ -0,0 +1,2259 @@ +local api = vim.api +local ts = vim.treesitter + +local new_lang_api = ts.language.register ~= nil + +local filetype_to_parsername = {} + +if new_lang_api then + filetype_to_parsername = setmetatable({}, { + __newindex = function(_, k, v) + require("nvim-treesitter.utils").notify( + "filetype_to_parsername is deprecated, please use 'vim.treesitter.language.register'", + vim.log.levels.WARN + ) + ts.language.register(v, k) + end, + }) +end + +local function register_lang(lang, ft) + if new_lang_api then + ts.language.register(lang, ft) + return + end + filetype_to_parsername[ft] = lang +end + +for ft, lang in pairs { + javascriptreact = "javascript", + ecma = "javascript", + jsx = "javascript", + sh = "bash", + apkbuild = "bash", + PKGBUILD = "bash", + html_tags = "html", + ["typescript.tsx"] = "tsx", + ["html.handlebars"] = "glimmer", + systemverilog = "verilog", + cls = "latex", + sty = "latex", + pandoc = "markdown", + rmd = "markdown", + quarto = "markdown", + dosini = "ini", + confini = "ini", + svg = "xml", + xsd = "xml", + xslt = "xml", + sbt = "scala", +} do + register_lang(lang, ft) +end + +---@class InstallInfo +---@field url string +---@field branch string|nil +---@field revision string|nil +---@field files string[] +---@field generate_requires_npm boolean|nil +---@field requires_generate_from_grammar boolean|nil +---@field location string|nil +---@field use_makefile boolean|nil +---@field cxx_standard string|nil + +---@class ParserInfo +---@field install_info InstallInfo +---@field filetype string +---@field maintainers string[] +---@field experimental boolean|nil +---@field readme_name string|nil + +---@type ParserInfo[] +local list = setmetatable({}, { + __newindex = function(table, parsername, parserconfig) + rawset(table, parsername, parserconfig) + register_lang(parsername, parserconfig.filetype or parsername) + end, +}) + +list.ada = { + install_info = { + url = "https://github.com/briot/tree-sitter-ada", + files = { "src/parser.c" }, + }, + maintainers = { "@briot" }, +} + +list.agda = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-agda", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@Decodetalkers" }, +} + +list.angular = { + install_info = { + url = "https://github.com/steelsojka/tree-sitter-angular", + files = { "src/parser.c" }, + requires_generate_from_grammar = true, + }, + experimental = true, +} + +list.apex = { + install_info = { + url = "https://github.com/aheber/tree-sitter-sfapex", + files = { "src/parser.c" }, + location = "apex", + }, + maintainers = { "@aheber" }, +} + +list.arduino = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-arduino", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@ObserverOfTime" }, +} + +list.astro = { + install_info = { + url = "https://github.com/virchau13/tree-sitter-astro", + files = { "src/parser.c", "src/scanner.cc" }, + }, + maintainers = { "@virchau13" }, +} + +list.authzed = { + install_info = { + url = "https://github.com/mleonidas/tree-sitter-authzed", + files = { "src/parser.c" }, + }, + maintainers = { "@mattpolzin" }, +} + +list.awk = { + install_info = { + url = "https://github.com/Beaglefoot/tree-sitter-awk", + files = { "src/parser.c", "src/scanner.c" }, + }, +} + +list.bash = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-bash", + files = { "src/parser.c", "src/scanner.c" }, + }, + filetype = "sh", + maintainers = { "@TravonteD" }, +} + +list.bass = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-bass", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.beancount = { + install_info = { + url = "https://github.com/polarmutex/tree-sitter-beancount", + files = { "src/parser.c", "src/scanner.cc" }, + }, + maintainers = { "@polarmutex" }, +} + +list.bibtex = { + install_info = { + url = "https://github.com/latex-lsp/tree-sitter-bibtex", + files = { "src/parser.c" }, + }, + filetype = "bib", + maintainers = { "@theHamsta", "@clason" }, +} + +list.bicep = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-bicep", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.bitbake = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-bitbake", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.blueprint = { + install_info = { + url = "https://gitlab.com/gabmus/tree-sitter-blueprint.git", + files = { "src/parser.c" }, + }, + maintainers = { "@gabmus" }, + experimental = true, +} + +list.c = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-c", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.c_sharp = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-c-sharp", + files = { "src/parser.c", "src/scanner.c" }, + }, + filetype = "cs", + maintainers = { "@Luxed" }, +} + +list.cairo = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-cairo", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.capnp = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-capnp", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.chatito = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-chatito", + files = { "src/parser.c" }, + }, + maintainers = { "@ObserverOfTime" }, +} + +list.clojure = { + install_info = { + url = "https://github.com/sogaiu/tree-sitter-clojure", + files = { "src/parser.c" }, + }, + maintainers = { "@NoahTheDuke" }, +} + +list.cmake = { + install_info = { + url = "https://github.com/uyha/tree-sitter-cmake", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@uyha" }, +} + +list.comment = { + install_info = { + url = "https://github.com/stsewd/tree-sitter-comment", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@stsewd" }, +} + +list.commonlisp = { + install_info = { + url = "https://github.com/theHamsta/tree-sitter-commonlisp", + files = { "src/parser.c" }, + generate_requires_npm = true, + }, + filetype = "lisp", + maintainers = { "@theHamsta" }, +} + +list.cooklang = { + install_info = { + url = "https://github.com/addcninblue/tree-sitter-cooklang", + files = { "src/parser.c", "src/scanner.cc" }, + }, + maintainers = { "@addcninblue" }, +} + +list.corn = { + install_info = { + url = "https://github.com/jakestanger/tree-sitter-corn", + files = { "src/parser.c" }, + }, + maintainers = { "@jakestanger" }, +} + +list.cpon = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-cpon", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.cpp = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-cpp", + files = { "src/parser.c", "src/scanner.c" }, + generate_requires_npm = true, + }, + maintainers = { "@theHamsta" }, +} + +list.css = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-css", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@TravonteD" }, +} + +list.csv = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-csv", + files = { "src/parser.c" }, + location = "csv", + }, + maintainers = { "@amaanq" }, +} + +list.cuda = { + install_info = { + url = "https://github.com/theHamsta/tree-sitter-cuda", + files = { "src/parser.c", "src/scanner.c" }, + generate_requires_npm = true, + }, + maintainers = { "@theHamsta" }, +} + +list.cue = { + install_info = { + url = "https://github.com/eonpatapon/tree-sitter-cue", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.d = { + install_info = { + url = "https://github.com/CyberShadow/tree-sitter-d", + files = { "src/parser.c", "src/scanner.cc" }, + requires_generate_from_grammar = true, + }, + -- Generating grammar takes ~60s + experimental = true, + maintainers = { "@nawordar" }, +} + +list.dart = { + install_info = { + url = "https://github.com/UserNobody14/tree-sitter-dart", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@akinsho" }, +} + +list.devicetree = { + install_info = { + url = "https://github.com/joelspadin/tree-sitter-devicetree", + files = { "src/parser.c" }, + }, + filetype = "dts", + maintainers = { "@jedrzejboczar" }, +} + +list.dhall = { + install_info = { + url = "https://github.com/jbellerb/tree-sitter-dhall", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.diff = { + install_info = { + url = "https://github.com/the-mikedavis/tree-sitter-diff", + files = { "src/parser.c" }, + }, + filetype = "gitdiff", + maintainers = { "@gbprod" }, +} + +list.dockerfile = { + install_info = { + url = "https://github.com/camdencheek/tree-sitter-dockerfile", + files = { "src/parser.c" }, + }, + maintainers = { "@camdencheek" }, +} + +list.dot = { + install_info = { + url = "https://github.com/rydesun/tree-sitter-dot", + files = { "src/parser.c" }, + }, + maintainers = { "@rydesun" }, +} + +list.doxygen = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-doxygen", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.dtd = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-xml", + files = { "src/parser.c", "src/scanner.c" }, + location = "tree-sitter-dtd", + }, + maintainers = { "@ObserverOfTime" }, +} + +list.ebnf = { + install_info = { + url = "https://github.com/RubixDev/ebnf", + files = { "src/parser.c" }, + location = "crates/tree-sitter-ebnf", + }, + maintainers = { "@RubixDev" }, + experimental = true, +} + +list.eds = { + install_info = { + url = "https://github.com/uyha/tree-sitter-eds", + files = { "src/parser.c" }, + }, + maintainers = { "@uyha" }, +} + +list.eex = { + install_info = { + url = "https://github.com/connorlay/tree-sitter-eex", + files = { "src/parser.c" }, + }, + filetype = "eelixir", + maintainers = { "@connorlay" }, +} + +list.elixir = { + install_info = { + url = "https://github.com/elixir-lang/tree-sitter-elixir", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@connorlay" }, +} + +list.elm = { + install_info = { + url = "https://github.com/elm-tooling/tree-sitter-elm", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@zweimach" }, +} + +list.elsa = { + install_info = { + url = "https://github.com/glapa-grossklag/tree-sitter-elsa", + files = { "src/parser.c" }, + }, + maintainers = { "@glapa-grossklag", "@amaanq" }, +} + +list.elvish = { + install_info = { + url = "https://github.com/elves/tree-sitter-elvish", + files = { "src/parser.c" }, + }, + maintainers = { "@elves" }, +} + +list.embedded_template = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-embedded-template", + files = { "src/parser.c" }, + }, + filetype = "eruby", +} + +list.erlang = { + install_info = { + url = "https://github.com/WhatsApp/tree-sitter-erlang", + files = { "src/parser.c" }, + }, + maintainers = { "@filmor" }, +} + +list.facility = { + install_info = { + url = "https://github.com/FacilityApi/tree-sitter-facility", + files = { "src/parser.c" }, + }, + filetype = "fsd", + maintainers = { "@bryankenote" }, +} + +list.fennel = { + install_info = { + url = "https://github.com/travonted/tree-sitter-fennel", + files = { "src/parser.c" }, + }, + maintainers = { "@TravonteD" }, +} + +list.firrtl = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-firrtl", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.fish = { + install_info = { + url = "https://github.com/ram02z/tree-sitter-fish", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@ram02z" }, +} + +list.foam = { + install_info = { + url = "https://github.com/FoamScience/tree-sitter-foam", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@FoamScience" }, + -- Queries might change over time on the grammar's side + -- Otherwise everything runs fine + experimental = true, +} + +list.forth = { + install_info = { + url = "https://github.com/AlexanderBrevig/tree-sitter-forth", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.fortran = { + install_info = { + url = "https://github.com/stadelmanma/tree-sitter-fortran", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.fsh = { + install_info = { + url = "https://github.com/mgramigna/tree-sitter-fsh", + files = { "src/parser.c" }, + }, + maintainers = { "@mgramigna" }, +} + +list.func = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-func", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.fusion = { + install_info = { + url = "https://gitlab.com/jirgn/tree-sitter-fusion.git", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@jirgn" }, +} + +list.gdscript = { + install_info = { + url = "https://github.com/PrestonKnopp/tree-sitter-gdscript", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@PrestonKnopp" }, + readme_name = "Godot (gdscript)", +} + +list.git_rebase = { + install_info = { + url = "https://github.com/the-mikedavis/tree-sitter-git-rebase", + files = { "src/parser.c" }, + }, + filetype = "gitrebase", + maintainers = { "@gbprod" }, +} + +list.gitattributes = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-gitattributes", + files = { "src/parser.c" }, + }, + maintainers = { "@ObserverOfTime" }, +} + +list.gitcommit = { + install_info = { + url = "https://github.com/gbprod/tree-sitter-gitcommit", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@gbprod" }, +} + +list.git_config = { + install_info = { + url = "https://github.com/the-mikedavis/tree-sitter-git-config", + files = { "src/parser.c" }, + }, + filetype = "gitconfig", + maintainers = { "@amaanq" }, + readme_name = "git_config", +} + +list.gitignore = { + install_info = { + url = "https://github.com/shunsambongi/tree-sitter-gitignore", + files = { "src/parser.c" }, + }, + maintainers = { "@theHamsta" }, +} + +list.gleam = { + install_info = { + url = "https://github.com/gleam-lang/tree-sitter-gleam", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.glimmer = { + install_info = { + url = "https://github.com/alexlafroscia/tree-sitter-glimmer", + files = { "src/parser.c", "src/scanner.c" }, + }, + filetype = "handlebars", + maintainers = { "@NullVoxPopuli" }, + readme_name = "Glimmer and Ember", +} + +list.glsl = { + install_info = { + url = "https://github.com/theHamsta/tree-sitter-glsl", + files = { "src/parser.c" }, + generate_requires_npm = true, + }, + maintainers = { "@theHamsta" }, +} + +list.gn = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-gn", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, + readme_name = "GN (Generate Ninja)", +} + +list.go = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-go", + files = { "src/parser.c" }, + }, + maintainers = { "@theHamsta", "@WinWisely268" }, +} + +list.godot_resource = { + install_info = { + url = "https://github.com/PrestonKnopp/tree-sitter-godot-resource", + files = { "src/parser.c", "src/scanner.c" }, + }, + filetype = "gdresource", + maintainers = { "@pierpo" }, + readme_name = "Godot Resources (gdresource)", +} + +list.gomod = { + install_info = { + url = "https://github.com/camdencheek/tree-sitter-go-mod", + files = { "src/parser.c" }, + }, + maintainers = { "@camdencheek" }, +} + +list.gosum = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-go-sum", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.gowork = { + install_info = { + url = "https://github.com/omertuc/tree-sitter-go-work", + files = { "src/parser.c" }, + }, + maintainers = { "@omertuc" }, +} + +list.gpg = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-gpg-config", + files = { "src/parser.c" }, + }, + maintainers = { "@ObserverOfTime" }, +} + +list.groovy = { + install_info = { + url = "https://github.com/Decodetalkers/tree-sitter-groovy", + files = { "src/parser.c" }, + branch = "gh-pages", + }, + maintainers = { "@Decodetalkers" }, +} + +list.graphql = { + install_info = { + url = "https://github.com/bkegley/tree-sitter-graphql", + files = { "src/parser.c" }, + }, + maintainers = { "@bkegley" }, +} + +list.gstlaunch = { + install_info = { + url = "https://github.com/theHamsta/tree-sitter-gstlaunch", + files = { "src/parser.c" }, + }, + maintainers = { "@theHamsta" }, +} + +list.hack = { + install_info = { + url = "https://github.com/slackhq/tree-sitter-hack", + files = { "src/parser.c", "src/scanner.c" }, + }, +} + +list.hare = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-hare", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.haskell = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-haskell", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@mrcjkb" }, +} + +list.haskell_persistent = { + install_info = { + url = "https://github.com/MercuryTechnologies/tree-sitter-haskell-persistent", + files = { "src/parser.c", "src/scanner.c" }, + }, + filetype = "haskellpersistent", + maintainers = { "@lykahb" }, +} + +list.hcl = { + install_info = { + url = "https://github.com/MichaHoffmann/tree-sitter-hcl", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@MichaHoffmann" }, +} + +list.heex = { + install_info = { + url = "https://github.com/connorlay/tree-sitter-heex", + files = { "src/parser.c" }, + }, + maintainers = { "@connorlay" }, +} + +list.hjson = { + install_info = { + url = "https://github.com/winston0410/tree-sitter-hjson", + files = { "src/parser.c" }, + generate_requires_npm = true, + }, + maintainers = { "@winston0410" }, +} + +list.hlsl = { + install_info = { + url = "https://github.com/theHamsta/tree-sitter-hlsl", + files = { "src/parser.c", "src/scanner.c" }, + generate_requires_npm = true, + }, + maintainers = { "@theHamsta" }, +} + +list.hocon = { + install_info = { + url = "https://github.com/antosha417/tree-sitter-hocon", + files = { "src/parser.c" }, + generate_requires_npm = true, + }, + maintainers = { "@antosha417" }, +} + +list.hoon = { + install_info = { + url = "https://github.com/urbit-pilled/tree-sitter-hoon", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@urbit-pilled" }, + experimental = true, +} + +list.html = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-html", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@TravonteD" }, +} + +list.htmldjango = { + install_info = { + url = "https://github.com/interdependence/tree-sitter-htmldjango", + files = { "src/parser.c" }, + }, + maintainers = { "@ObserverOfTime" }, + experimental = true, +} + +list.http = { + install_info = { + url = "https://github.com/rest-nvim/tree-sitter-http", + files = { "src/parser.c" }, + generate_requires_npm = true, + }, + maintainers = { "@amaanq" }, +} + +list.hurl = { + install_info = { + url = "https://github.com/pfeiferj/tree-sitter-hurl", + files = { "src/parser.c" }, + }, + maintainers = { "@pfeiferj" }, +} + +list.ini = { + install_info = { + url = "https://github.com/justinmk/tree-sitter-ini", + files = { "src/parser.c" }, + }, + maintainers = { "@theHamsta" }, + experimental = true, +} + +list.ispc = { + install_info = { + url = "https://github.com/fab4100/tree-sitter-ispc", + files = { "src/parser.c" }, + generate_requires_npm = true, + }, + maintainers = { "@fab4100" }, +} + +list.janet_simple = { + install_info = { + url = "https://github.com/sogaiu/tree-sitter-janet-simple", + files = { "src/parser.c", "src/scanner.c" }, + }, + filetype = "janet", + maintainers = { "@sogaiu" }, +} + +list.java = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-java", + files = { "src/parser.c" }, + }, + maintainers = { "@p00f" }, +} + +list.javascript = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-javascript", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@steelsojka" }, +} + +list.jq = { + install_info = { + url = "https://github.com/flurie/tree-sitter-jq", + files = { "src/parser.c" }, + }, + maintainers = { "@ObserverOfTime" }, +} + +list.jsdoc = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-jsdoc", + files = { "src/parser.c" }, + }, + maintainers = { "@steelsojka" }, +} + +list.json = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-json", + files = { "src/parser.c" }, + }, + maintainers = { "@steelsojka" }, +} + +list.json5 = { + install_info = { + url = "https://github.com/Joakker/tree-sitter-json5", + files = { "src/parser.c" }, + }, + maintainers = { "@Joakker" }, +} + +list.jsonc = { + install_info = { + url = "https://gitlab.com/WhyNotHugo/tree-sitter-jsonc.git", + files = { "src/parser.c" }, + generate_requires_npm = true, + }, + maintainers = { "@WhyNotHugo" }, + readme_name = "JSON with comments", +} + +list.jsonnet = { + install_info = { + url = "https://github.com/sourcegraph/tree-sitter-jsonnet", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@nawordar" }, +} + +list.julia = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-julia", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@theHamsta" }, +} + +list.kconfig = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-kconfig", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.kdl = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-kdl", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.kotlin = { + install_info = { + url = "https://github.com/fwcd/tree-sitter-kotlin", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@SalBakraa" }, +} + +list.kusto = { + install_info = { + url = "https://github.com/Willem-J-an/tree-sitter-kusto", + files = { "src/parser.c" }, + }, + maintainers = { "@Willem-J-an" }, +} + +list.lalrpop = { + install_info = { + url = "https://github.com/traxys/tree-sitter-lalrpop", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@traxys" }, +} + +list.latex = { + install_info = { + url = "https://github.com/latex-lsp/tree-sitter-latex", + files = { "src/parser.c", "src/scanner.c" }, + }, + filetype = "tex", + maintainers = { "@theHamsta", "@clason" }, +} + +list.ledger = { + install_info = { + url = "https://github.com/cbarrete/tree-sitter-ledger", + files = { "src/parser.c" }, + }, + maintainers = { "@cbarrete" }, +} + +list.leo = { + install_info = { + url = "https://github.com/r001/tree-sitter-leo", + files = { "src/parser.c" }, + }, + maintainers = { "@r001" }, +} + +list.llvm = { + install_info = { + url = "https://github.com/benwilliamgraham/tree-sitter-llvm", + files = { "src/parser.c" }, + }, + maintainers = { "@benwilliamgraham" }, +} + +list.linkerscript = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-linkerscript", + files = { "src/parser.c" }, + }, + filetype = "ld", + maintainers = { "@amaanq" }, +} + +list.liquidsoap = { + install_info = { + url = "https://github.com/savonet/tree-sitter-liquidsoap", + files = { "src/parser.c", "src/scanner.cc" }, + }, + maintainers = { "@toots" }, +} + +list.lua = { + install_info = { + url = "https://github.com/MunifTanjim/tree-sitter-lua", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@muniftanjim" }, +} + +list.luadoc = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-luadoc", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.luap = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-luap", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, + readme_name = "lua patterns", +} + +list.luau = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-luau", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.m68k = { + install_info = { + url = "https://github.com/grahambates/tree-sitter-m68k", + files = { "src/parser.c" }, + }, + filetype = "asm68k", + maintainers = { "@grahambates" }, +} + +list.make = { + install_info = { + url = "https://github.com/alemuller/tree-sitter-make", + files = { "src/parser.c" }, + }, + maintainers = { "@lewis6991" }, +} + +list.markdown = { + install_info = { + url = "https://github.com/MDeiml/tree-sitter-markdown", + location = "tree-sitter-markdown", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@MDeiml" }, + readme_name = "markdown (basic highlighting)", + experimental = true, +} + +list.markdown_inline = { + install_info = { + url = "https://github.com/MDeiml/tree-sitter-markdown", + location = "tree-sitter-markdown-inline", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@MDeiml" }, + readme_name = "markdown_inline (needed for full highlighting)", + experimental = true, +} + +list.matlab = { + install_info = { + url = "https://github.com/acristoffers/tree-sitter-matlab", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@acristoffers" }, +} + +list.menhir = { + install_info = { + url = "https://github.com/Kerl13/tree-sitter-menhir", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@Kerl13" }, +} + +list.mermaid = { + install_info = { + url = "https://github.com/monaqa/tree-sitter-mermaid", + files = { "src/parser.c" }, + }, + experimental = true, +} + +list.meson = { + install_info = { + url = "https://github.com/Decodetalkers/tree-sitter-meson", + files = { "src/parser.c" }, + }, + maintainers = { "@Decodetalkers" }, +} + +list.mlir = { + install_info = { + url = "https://github.com/artagnon/tree-sitter-mlir", + files = { "src/parser.c" }, + requires_generate_from_grammar = true, + }, + experimental = true, + maintainers = { "@artagnon" }, +} + +list.nasm = { + install_info = { + url = "https://github.com/naclsn/tree-sitter-nasm", + files = { "src/parser.c" }, + }, + maintainers = { "@ObserverOfTime" }, +} + +list.nickel = { + install_info = { + url = "https://github.com/nickel-lang/tree-sitter-nickel", + files = { "src/parser.c", "src/scanner.cc" }, + }, +} + +list.nim = { + install_info = { + url = "https://github.com/alaviss/tree-sitter-nim", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@aMOPel" }, +} + +list.nim_format_string = { + install_info = { + url = "https://github.com/aMOPel/tree-sitter-nim-format-string", + files = { "src/parser.c" }, + }, + maintainers = { "@aMOPel" }, +} + +list.ninja = { + install_info = { + url = "https://github.com/alemuller/tree-sitter-ninja", + files = { "src/parser.c" }, + }, + maintainers = { "@alemuller" }, +} + +list.nix = { + install_info = { + url = "https://github.com/cstrahan/tree-sitter-nix", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@leo60228" }, +} + +list.norg = { + install_info = { + url = "https://github.com/nvim-neorg/tree-sitter-norg", + files = { "src/parser.c", "src/scanner.cc" }, + cxx_standard = "c++14", + use_makefile = true, + }, + maintainers = { "@JoeyGrajciar", "@vhyrro" }, +} + +list.nqc = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-nqc", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.objc = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-objc", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.objdump = { + install_info = { + url = "https://github.com/ColinKennedy/tree-sitter-objdump", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@ColinKennedy" }, +} + +list.ocaml = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-ocaml", + files = { "src/parser.c", "src/scanner.c" }, + location = "ocaml", + }, + maintainers = { "@undu" }, +} + +list.ocaml_interface = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-ocaml", + files = { "src/parser.c", "src/scanner.c" }, + location = "interface", + }, + filetype = "ocamlinterface", + maintainers = { "@undu" }, +} + +list.ocamllex = { + install_info = { + url = "https://github.com/atom-ocaml/tree-sitter-ocamllex", + files = { "src/parser.c", "src/scanner.c" }, + requires_generate_from_grammar = true, + }, + maintainers = { "@undu" }, +} + +list.odin = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-odin", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.org = { + install_info = { + url = "https://github.com/milisims/tree-sitter-org", + files = { "src/parser.c", "src/scanner.c" }, + }, +} + +list.pascal = { + install_info = { + url = "https://github.com/Isopod/tree-sitter-pascal.git", + files = { "src/parser.c" }, + }, + maintainers = { "@Isopod" }, +} + +list.passwd = { + install_info = { + url = "https://github.com/ath3/tree-sitter-passwd", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.pem = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-pem", + files = { "src/parser.c" }, + }, + maintainers = { "@ObserverOfTime" }, +} + +list.perl = { + install_info = { + url = "https://github.com/tree-sitter-perl/tree-sitter-perl", + files = { "src/parser.c", "src/scanner.c" }, + branch = "release", + }, + maintainers = { "@RabbiVeesh", "@LeoNerd" }, +} + +list.php = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-php", + location = "php", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@tk-shirasaka" }, +} + +-- Parsers for injections +list.phpdoc = { + install_info = { + url = "https://github.com/claytonrcarter/tree-sitter-phpdoc", + files = { "src/parser.c", "src/scanner.c" }, + generate_requires_npm = true, + }, + maintainers = { "@mikehaertl" }, + experimental = true, +} + +list.pioasm = { + install_info = { + url = "https://github.com/leo60228/tree-sitter-pioasm", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@leo60228" }, +} + +list.po = { + install_info = { + url = "https://github.com/erasin/tree-sitter-po", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.pod = { + install_info = { + url = "https://github.com/tree-sitter-perl/tree-sitter-pod", + files = { "src/parser.c", "src/scanner.c" }, + branch = "release", + }, + maintainers = { "@RabbiVeesh", "@LeoNerd" }, +} + +list.poe_filter = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-poe-filter", + files = { "src/parser.c" }, + }, + filetype = "poefilter", + maintainers = { "@ObserverOfTime" }, + readme_name = "Path of Exile item filter", + experimental = true, +} + +list.pony = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-pony", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq", "@mfelsche" }, +} + +list.prisma = { + install_info = { + url = "https://github.com/victorhqc/tree-sitter-prisma", + files = { "src/parser.c" }, + }, + maintainers = { "@elianiva" }, +} + +list.promql = { + install_info = { + url = "https://github.com/MichaHoffmann/tree-sitter-promql", + files = { "src/parser.c" }, + experimental = true, + }, + maintainers = { "@MichaHoffmann" }, +} + +list.properties = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-properties", + files = { "src/parser.c" }, + }, + filetype = "jproperties", + maintainers = { "@ObserverOfTime" }, +} + +list.proto = { + install_info = { + url = "https://github.com/treywood/tree-sitter-proto", + files = { "src/parser.c" }, + }, + maintainers = { "@treywood" }, +} + +list.prql = { + install_info = { + url = "https://github.com/PRQL/tree-sitter-prql", + files = { "src/parser.c" }, + }, + maintainers = { "@matthias-Q" }, +} + +list.psv = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-csv", + files = { "src/parser.c" }, + location = "psv", + }, + maintainers = { "@amaanq" }, +} + +list.pug = { + install_info = { + url = "https://github.com/zealot128/tree-sitter-pug", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@zealot128" }, + experimental = true, +} + +list.puppet = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-puppet", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.purescript = { + install_info = { + url = "https://github.com/postsolar/tree-sitter-purescript", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@postsolar" }, +} + +list.pymanifest = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-pymanifest", + files = { "src/parser.c" }, + }, + maintainers = { "@ObserverOfTime" }, + readme_name = "PyPA manifest", +} + +list.python = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-python", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@stsewd", "@theHamsta" }, +} + +list.ql = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-ql", + files = { "src/parser.c" }, + }, + maintainers = { "@pwntester" }, +} + +list.qmldir = { + install_info = { + url = "https://github.com/Decodetalkers/tree-sitter-qmldir", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.qmljs = { + install_info = { + url = "https://github.com/yuja/tree-sitter-qmljs", + files = { "src/parser.c", "src/scanner.c" }, + }, + filetype = "qml", + maintainers = { "@Decodetalkers" }, +} + +list.query = { + install_info = { + url = "https://github.com/nvim-treesitter/tree-sitter-query", + files = { "src/parser.c" }, + }, + maintainers = { "@steelsojka" }, + readme_name = "Tree-Sitter query language", +} + +list.r = { + install_info = { + url = "https://github.com/r-lib/tree-sitter-r", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@echasnovski" }, +} + +list.racket = { + install_info = { + url = "https://github.com/6cdh/tree-sitter-racket", + files = { "src/parser.c", "src/scanner.c" }, + }, +} + +list.rasi = { + install_info = { + url = "https://github.com/Fymyte/tree-sitter-rasi", + files = { "src/parser.c" }, + }, + maintainers = { "@Fymyte" }, +} + +list.rbs = { + install_info = { + url = "https://github.com/joker1007/tree-sitter-rbs", + files = { "src/parser.c" }, + }, + maintainers = { "@joker1007" }, +} + +list.re2c = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-re2c", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.regex = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-regex", + files = { "src/parser.c" }, + }, + maintainers = { "@theHamsta" }, +} + +list.rego = { + install_info = { + url = "https://github.com/FallenAngel97/tree-sitter-rego", + files = { "src/parser.c" }, + }, + maintainers = { "@FallenAngel97" }, +} + +list.requirements = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-requirements", + files = { "src/parser.c" }, + }, + maintainers = { "@ObserverOfTime" }, + readme_name = "pip requirements", +} + +list.rnoweb = { + install_info = { + url = "https://github.com/bamonroe/tree-sitter-rnoweb", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@bamonroe" }, +} + +list.robot = { + install_info = { + url = "https://github.com/Hubro/tree-sitter-robot", + files = { "src/parser.c" }, + }, + maintainers = { "@Hubro" }, +} + +list.ron = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-ron", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.rst = { + install_info = { + url = "https://github.com/stsewd/tree-sitter-rst", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@stsewd" }, +} + +list.ruby = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-ruby", + files = { "src/parser.c", "src/scanner.cc" }, + }, + maintainers = { "@TravonteD" }, +} + +list.rust = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-rust", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.scala = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-scala", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@stevanmilic" }, +} + +list.scfg = { + install_info = { + url = "https://git.sr.ht/~rockorager/tree-sitter-scfg", + files = { "src/parser.c" }, + requires_generate_from_grammar = true, + }, + maintainers = { "@WhyNotHugo" }, +} + +list.scheme = { + install_info = { + url = "https://github.com/6cdh/tree-sitter-scheme", + files = { "src/parser.c" }, + }, +} + +list.scss = { + install_info = { + url = "https://github.com/serenadeai/tree-sitter-scss", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@elianiva" }, +} + +list.slang = { + install_info = { + url = "https://github.com/theHamsta/tree-sitter-slang", + files = { "src/parser.c", "src/scanner.c" }, + generate_requires_npm = true, + }, + filetype = "shaderslang", + maintainers = { "@theHamsta" }, + experimental = true, +} + +list.slint = { + install_info = { + url = "https://github.com/jrmoulton/tree-sitter-slint", + files = { "src/parser.c" }, + }, + maintainers = { "@jrmoulton" }, + experimental = true, +} + +list.smali = { + install_info = { + url = "https://git.sr.ht/~yotam/tree-sitter-smali", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.snakemake = { + install_info = { + url = "https://github.com/osthomas/tree-sitter-snakemake", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainer = { "@osthomas" }, + experimental = true, +} + +list.smithy = { + install_info = { + url = "https://github.com/indoorvivants/tree-sitter-smithy", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq", "@keynmol" }, +} + +list.solidity = { + install_info = { + url = "https://github.com/JoranHonig/tree-sitter-solidity", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.soql = { + install_info = { + url = "https://github.com/aheber/tree-sitter-sfapex", + files = { "src/parser.c" }, + location = "soql", + }, + maintainers = { "@aheber" }, +} + +list.sosl = { + install_info = { + url = "https://github.com/aheber/tree-sitter-sfapex", + files = { "src/parser.c" }, + location = "sosl", + }, + maintainers = { "@aheber" }, +} + +list.sparql = { + install_info = { + url = "https://github.com/BonaBeavis/tree-sitter-sparql", + files = { "src/parser.c" }, + }, + maintainers = { "@BonaBeavis" }, +} + +list.sql = { + install_info = { + url = "https://github.com/derekstride/tree-sitter-sql", + files = { "src/parser.c", "src/scanner.c" }, + branch = "gh-pages", + }, + maintainers = { "@derekstride" }, +} + +list.squirrel = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-squirrel", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.ssh_config = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-ssh-config", + files = { "src/parser.c" }, + }, + filetype = "sshconfig", + maintainers = { "@ObserverOfTime" }, +} + +list.starlark = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-starlark", + files = { "src/parser.c", "src/scanner.c" }, + }, + filetype = "bzl", + maintainers = { "@amaanq" }, +} + +list.strace = { + install_info = { + url = "https://github.com/sigmaSd/tree-sitter-strace", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.styled = { + install_info = { + url = "https://github.com/mskelton/tree-sitter-styled", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@mskelton" }, +} + +list.supercollider = { + install_info = { + url = "https://github.com/madskjeldgaard/tree-sitter-supercollider", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@madskjeldgaard" }, +} + +list.surface = { + install_info = { + url = "https://github.com/connorlay/tree-sitter-surface", + files = { "src/parser.c" }, + }, + filetype = "sface", + maintainers = { "@connorlay" }, +} + +list.svelte = { + install_info = { + url = "https://github.com/Himujjal/tree-sitter-svelte", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@elianiva" }, +} + +list.swift = { + install_info = { + url = "https://github.com/alex-pinkus/tree-sitter-swift", + files = { "src/parser.c", "src/scanner.c" }, + requires_generate_from_grammar = true, + }, + maintainers = { "@alex-pinkus" }, +} + +list.sxhkdrc = { + install_info = { + url = "https://github.com/RaafatTurki/tree-sitter-sxhkdrc", + files = { "src/parser.c" }, + }, + maintainers = { "@RaafatTurki" }, +} + +list.systemtap = { + install_info = { + url = "https://github.com/ok-ryoko/tree-sitter-systemtap", + files = { "src/parser.c" }, + }, + maintainers = { "@ok-ryoko" }, +} + +list.t32 = { + install_info = { + url = "https://gitlab.com/xasc/tree-sitter-t32.git", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@xasc" }, +} + +list.tablegen = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-tablegen", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + +list.teal = { + install_info = { + url = "https://github.com/euclidianAce/tree-sitter-teal", + files = { "src/parser.c", "src/scanner.c" }, + requires_generate_from_grammar = true, + }, + maintainers = { "@euclidianAce" }, +} + +list.terraform = { + install_info = { + url = "https://github.com/MichaHoffmann/tree-sitter-hcl", + files = { "src/parser.c", "src/scanner.c" }, + location = "dialects/terraform", + }, + maintainers = { "@MichaHoffmann" }, +} + +list.textproto = { + install_info = { + url = "https://github.com/PorterAtGoogle/tree-sitter-textproto", + files = { "src/parser.c" }, + }, + maintainers = { "@Porter" }, +} + +list.thrift = { + install_info = { + url = "https://github.com/duskmoon314/tree-sitter-thrift", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq", "@duskmoon314" }, +} + +list.tiger = { + install_info = { + url = "https://github.com/ambroisie/tree-sitter-tiger", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@ambroisie" }, +} + +list.tlaplus = { + install_info = { + url = "https://github.com/tlaplus-community/tree-sitter-tlaplus", + files = { "src/parser.c", "src/scanner.cc" }, + }, + filetype = "tla", + maintainers = { "@ahelwer", "@susliko" }, +} + +list.todotxt = { + install_info = { + url = "https://github.com/arnarg/tree-sitter-todotxt.git", + files = { "src/parser.c" }, + }, + maintainers = { "@arnarg" }, + experimental = true, +} + +list.toml = { + install_info = { + url = "https://github.com/ikatyang/tree-sitter-toml", + files = { "src/parser.c", "src/scanner.c" }, + generate_requires_npm = true, + }, + maintainers = { "@tk-shirasaka" }, +} + +list.tsv = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-csv", + files = { "src/parser.c" }, + location = "tsv", + }, + maintainers = { "@amaanq" }, +} + +list.tsx = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-typescript", + files = { "src/parser.c", "src/scanner.c" }, + location = "tsx", + generate_requires_npm = true, + }, + filetype = "typescriptreact", + maintainers = { "@steelsojka" }, +} + +list.turtle = { + install_info = { + url = "https://github.com/BonaBeavis/tree-sitter-turtle", + files = { "src/parser.c" }, + }, + maintainers = { "@BonaBeavis" }, +} + +list.twig = { + install_info = { + url = "https://github.com/gbprod/tree-sitter-twig", + files = { "src/parser.c" }, + }, + maintainers = { "@gbprod" }, +} + +list.typescript = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-typescript", + files = { "src/parser.c", "src/scanner.c" }, + location = "typescript", + generate_requires_npm = true, + }, + maintainers = { "@steelsojka" }, +} + +list.typoscript = { + install_info = { + url = "https://github.com/Teddytrombone/tree-sitter-typoscript", + files = { "src/parser.c" }, + }, + maintainers = { "@Teddytrombone" }, +} + +list.udev = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-udev", + files = { "src/parser.c" }, + }, + filetype = "udevrules", + maintainers = { "@ObserverOfTime" }, +} + +list.ungrammar = { + install_info = { + url = "https://github.com/Philipp-M/tree-sitter-ungrammar", + files = { "src/parser.c" }, + }, + maintainers = { "@Philipp-M", "@amaanq" }, +} + +list.unison = { + install_info = { + url = "https://github.com/kylegoetz/tree-sitter-unison", + files = { "src/parser.c", "src/scanner.c" }, + requires_generate_from_grammar = true, + }, + maintainers = { "@tapegram" }, +} + +list.usd = { + install_info = { + url = "https://github.com/ColinKennedy/tree-sitter-usd", + files = { "src/parser.c" }, + }, + maintainers = { "@ColinKennedy" }, +} + +list.uxntal = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-uxntal", + files = { "src/parser.c", "src/scanner.c" }, + }, + filetype = "tal", + maintainers = { "@amaanq" }, + readme_name = "uxn tal", +} + +list.v = { + install_info = { + url = "https://github.com/v-analyzer/v-analyzer", + files = { "src/parser.c" }, + location = "tree_sitter_v", + }, + filetype = "vlang", + maintainers = { "@kkharji", "@amaanq" }, +} + +list.vala = { + install_info = { + url = "https://github.com/vala-lang/tree-sitter-vala", + files = { "src/parser.c" }, + }, + maintainers = { "@Prince781" }, +} + +list.verilog = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-verilog", + files = { "src/parser.c" }, + }, + maintainers = { "@zegervdv" }, +} + +list.vhs = { + install_info = { + url = "https://github.com/charmbracelet/tree-sitter-vhs", + files = { "src/parser.c" }, + }, + filetype = "tape", + maintainers = { "@caarlos0" }, +} + +list.vim = { + install_info = { + url = "https://github.com/neovim/tree-sitter-vim", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@clason" }, +} + +list.vimdoc = { + install_info = { + url = "https://github.com/neovim/tree-sitter-vimdoc", + files = { "src/parser.c" }, + }, + filetype = "help", + maintainers = { "@clason" }, +} + +list.vue = { + install_info = { + url = "https://github.com/ikatyang/tree-sitter-vue", + files = { "src/parser.c", "src/scanner.cc" }, + }, + maintainers = { "@WhyNotHugo" }, +} + +list.wgsl = { + install_info = { + url = "https://github.com/szebniok/tree-sitter-wgsl", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@szebniok" }, +} + +list.wgsl_bevy = { + install_info = { + url = "https://github.com/theHamsta/tree-sitter-wgsl-bevy", + files = { "src/parser.c", "src/scanner.c" }, + generate_requires_npm = true, + }, + maintainers = { "@theHamsta" }, +} + +list.wing = { + install_info = { + url = "https://github.com/winglang/wing", + files = { "src/parser.c", "src/scanner.c" }, + location = "libs/tree-sitter-wing", + requires_generate_from_grammar = true, + }, + maintainers = { "@gshpychka", "@MarkMcCulloh" }, + experimental = true, +} + +list.xcompose = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-xcompose", + files = { "src/parser.c" }, + }, + maintainers = { "@ObserverOfTime" }, +} + +list.xml = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-xml", + files = { "src/parser.c", "src/scanner.c" }, + location = "tree-sitter-xml", + }, + maintainers = { "@ObserverOfTime" }, +} + +list.yaml = { + install_info = { + url = "https://github.com/ikatyang/tree-sitter-yaml", + files = { "src/parser.c", "src/scanner.cc" }, + }, + maintainers = { "@stsewd" }, +} + +list.yang = { + install_info = { + url = "https://github.com/Hubro/tree-sitter-yang", + files = { "src/parser.c" }, + }, + maintainers = { "@Hubro" }, +} + +list.yuck = { + install_info = { + url = "https://github.com/Philipp-M/tree-sitter-yuck", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@Philipp-M", "@amaanq" }, +} + +list.zig = { + install_info = { + url = "https://github.com/maxxnino/tree-sitter-zig", + files = { "src/parser.c" }, + }, + maintainers = { "@maxxnino" }, +} + +list.templ = { + install_info = { + url = "https://github.com/vrischmann/tree-sitter-templ", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@vrischmann" }, +} + +local M = { + list = list, + filetype_to_parsername = filetype_to_parsername, +} + +local function get_lang(ft) + if new_lang_api then + return ts.language.get_lang(ft) + end + return filetype_to_parsername[ft] +end + +function M.ft_to_lang(ft) + local result = get_lang(ft) + if result then + return result + else + ft = vim.split(ft, ".", { plain = true })[1] + return get_lang(ft) or ft + end +end + +-- Get a list of all available parsers +---@return string[] +function M.available_parsers() + local parsers = vim.tbl_keys(M.list) + table.sort(parsers) + if vim.fn.executable "tree-sitter" == 1 and vim.fn.executable "node" == 1 then + return parsers + else + return vim.tbl_filter(function(p) ---@param p string + return not M.list[p].install_info.requires_generate_from_grammar + end, parsers) + end +end + +function M.get_parser_configs() + return M.list +end + +local parser_files + +function M.reset_cache() + parser_files = setmetatable({}, { + __index = function(tbl, key) + rawset(tbl, key, api.nvim_get_runtime_file("parser/" .. key .. ".*", false)) + return rawget(tbl, key) + end, + }) +end + +M.reset_cache() + +function M.has_parser(lang) + lang = lang or M.get_buf_lang(api.nvim_get_current_buf()) + + if not lang or #lang == 0 then + return false + end + -- HACK: nvim internal API + if vim._ts_has_language(lang) then + return true + end + return #parser_files[lang] > 0 +end + +function M.get_parser(bufnr, lang) + bufnr = bufnr or api.nvim_get_current_buf() + lang = lang or M.get_buf_lang(bufnr) + + if M.has_parser(lang) then + return ts.get_parser(bufnr, lang) + end +end + +-- @deprecated This is only kept for legacy purposes. +-- All root nodes should be accounted for. +function M.get_tree_root(bufnr) + bufnr = bufnr or api.nvim_get_current_buf() + return M.get_parser(bufnr):parse()[1]:root() +end + +-- Gets the language of a given buffer +---@param bufnr number? or current buffer +---@return string +function M.get_buf_lang(bufnr) + bufnr = bufnr or api.nvim_get_current_buf() + return M.ft_to_lang(api.nvim_buf_get_option(bufnr, "ft")) +end + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/query.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/query.lua new file mode 100644 index 00000000..51310545 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/query.lua @@ -0,0 +1,453 @@ +local api = vim.api +local ts = require "nvim-treesitter.compat" +local tsrange = require "nvim-treesitter.tsrange" +local utils = require "nvim-treesitter.utils" +local parsers = require "nvim-treesitter.parsers" +local caching = require "nvim-treesitter.caching" + +local M = {} + +local EMPTY_ITER = function() end + +M.built_in_query_groups = { "highlights", "locals", "folds", "indents", "injections" } + +-- Creates a function that checks whether a given query exists +-- for a specific language. +---@param query string +---@return fun(string): boolean +local function get_query_guard(query) + return function(lang) + return M.has_query_files(lang, query) + end +end + +for _, query in ipairs(M.built_in_query_groups) do + M["has_" .. query] = get_query_guard(query) +end + +---@return string[] +function M.available_query_groups() + local query_files = api.nvim_get_runtime_file("queries/*/*.scm", true) + local groups = {} + for _, f in ipairs(query_files) do + groups[vim.fn.fnamemodify(f, ":t:r")] = true + end + local list = {} + for k, _ in pairs(groups) do + table.insert(list, k) + end + return list +end + +do + local query_cache = caching.create_buffer_cache() + + local function update_cached_matches(bufnr, changed_tick, query_group) + query_cache.set(query_group, bufnr, { + tick = changed_tick, + cache = M.collect_group_results(bufnr, query_group) or {}, + }) + end + + ---@param bufnr integer + ---@param query_group string + ---@return any + function M.get_matches(bufnr, query_group) + bufnr = bufnr or api.nvim_get_current_buf() + local cached_local = query_cache.get(query_group, bufnr) + if not cached_local or api.nvim_buf_get_changedtick(bufnr) > cached_local.tick then + update_cached_matches(bufnr, api.nvim_buf_get_changedtick(bufnr), query_group) + end + + return query_cache.get(query_group, bufnr).cache + end +end + +---@param lang string +---@param query_name string +---@return string[] +local function runtime_queries(lang, query_name) + return api.nvim_get_runtime_file(string.format("queries/%s/%s.scm", lang, query_name), true) or {} +end + +---@type table> +local query_files_cache = {} + +---@param lang string +---@param query_name string +---@return boolean +function M.has_query_files(lang, query_name) + if not query_files_cache[lang] then + query_files_cache[lang] = {} + end + if query_files_cache[lang][query_name] == nil then + local files = runtime_queries(lang, query_name) + query_files_cache[lang][query_name] = files and #files > 0 + end + return query_files_cache[lang][query_name] +end + +do + local mt = {} + mt.__index = function(tbl, key) + if rawget(tbl, key) == nil then + rawset(tbl, key, {}) + end + return rawget(tbl, key) + end + + -- cache will auto set the table for each lang if it is nil + ---@type table> + local cache = setmetatable({}, mt) + + -- Same as `vim.treesitter.query` except will return cached values + ---@param lang string + ---@param query_name string + function M.get_query(lang, query_name) + if cache[lang][query_name] == nil then + cache[lang][query_name] = ts.get_query(lang, query_name) + end + + return cache[lang][query_name] + end + + -- Invalidates the query file cache. + -- + -- If lang and query_name is both present, will reload for only the lang and query_name. + -- If only lang is present, will reload all query_names for that lang + -- If none are present, will reload everything + ---@param lang? string + ---@param query_name? string + function M.invalidate_query_cache(lang, query_name) + if lang and query_name then + cache[lang][query_name] = nil + if query_files_cache[lang] then + query_files_cache[lang][query_name] = nil + end + elseif lang and not query_name then + query_files_cache[lang] = nil + for query_name0, _ in pairs(cache[lang]) do + M.invalidate_query_cache(lang, query_name0) + end + elseif not lang and not query_name then + query_files_cache = {} + for lang0, _ in pairs(cache) do + for query_name0, _ in pairs(cache[lang0]) do + M.invalidate_query_cache(lang0, query_name0) + end + end + else + error "Cannot have query_name by itself!" + end + end +end + +-- This function is meant for an autocommand and not to be used. Only use if file is a query file. +---@param fname string +function M.invalidate_query_file(fname) + local fnamemodify = vim.fn.fnamemodify + M.invalidate_query_cache(fnamemodify(fname, ":p:h:t"), fnamemodify(fname, ":t:r")) +end + +---@class QueryInfo +---@field root TSNode +---@field source integer +---@field start integer +---@field stop integer + +---@param bufnr integer +---@param query_name string +---@param root TSNode +---@param root_lang string|nil +---@return Query|nil, QueryInfo|nil +local function prepare_query(bufnr, query_name, root, root_lang) + local buf_lang = parsers.get_buf_lang(bufnr) + + if not buf_lang then + return + end + + local parser = parsers.get_parser(bufnr, buf_lang) + if not parser then + return + end + + if not root then + local first_tree = parser:trees()[1] + + if first_tree then + root = first_tree:root() + end + end + + if not root then + return + end + + local range = { root:range() } + + if not root_lang then + local lang_tree = parser:language_for_range(range) + + if lang_tree then + root_lang = lang_tree:lang() + end + end + + if not root_lang then + return + end + + local query = M.get_query(root_lang, query_name) + if not query then + return + end + + return query, + { + root = root, + source = bufnr, + start = range[1], + -- The end row is exclusive so we need to add 1 to it. + stop = range[3] + 1, + } +end + +-- Given a path (i.e. a List(String)) this functions inserts value at path +---@param object any +---@param path string[] +---@param value any +function M.insert_to_path(object, path, value) + local curr_obj = object + + for index = 1, (#path - 1) do + if curr_obj[path[index]] == nil then + curr_obj[path[index]] = {} + end + + curr_obj = curr_obj[path[index]] + end + + curr_obj[path[#path]] = value +end + +---@param query Query +---@param bufnr integer +---@param start_row integer +---@param end_row integer +function M.iter_prepared_matches(query, qnode, bufnr, start_row, end_row) + -- A function that splits a string on '.' + ---@param to_split string + ---@return string[] + local function split(to_split) + local t = {} + for str in string.gmatch(to_split, "([^.]+)") do + table.insert(t, str) + end + + return t + end + + local matches = query:iter_matches(qnode, bufnr, start_row, end_row) + + local function iterator() + local pattern, match, metadata = matches() + if pattern ~= nil then + local prepared_match = {} + + -- Extract capture names from each match + for id, node in pairs(match) do + local name = query.captures[id] -- name of the capture in the query + if name ~= nil then + local path = split(name .. ".node") + M.insert_to_path(prepared_match, path, node) + local metadata_path = split(name .. ".metadata") + M.insert_to_path(prepared_match, metadata_path, metadata[id]) + end + end + + -- Add some predicates for testing + ---@type string[][] ( TODO: make pred type so this can be pred[]) + local preds = query.info.patterns[pattern] + if preds then + for _, pred in pairs(preds) do + -- functions + if pred[1] == "set!" and type(pred[2]) == "string" then + M.insert_to_path(prepared_match, split(pred[2]), pred[3]) + end + if pred[1] == "make-range!" and type(pred[2]) == "string" and #pred == 4 then + M.insert_to_path( + prepared_match, + split(pred[2] .. ".node"), + tsrange.TSRange.from_nodes(bufnr, match[pred[3]], match[pred[4]]) + ) + end + end + end + + return prepared_match + end + end + return iterator +end + +-- Return all nodes corresponding to a specific capture path (like @definition.var, @reference.type) +-- Works like M.get_references or M.get_scopes except you can choose the capture +-- Can also be a nested capture like @definition.function to get all nodes defining a function. +-- +---@param bufnr integer the buffer +---@param captures string|string[] +---@param query_group string the name of query group (highlights or injections for example) +---@param root TSNode|nil node from where to start the search +---@param lang string|nil the language from where to get the captures. +--- Root nodes can have several languages. +---@return table|nil +function M.get_capture_matches(bufnr, captures, query_group, root, lang) + if type(captures) == "string" then + captures = { captures } + end + local strip_captures = {} ---@type string[] + for i, capture in ipairs(captures) do + if capture:sub(1, 1) ~= "@" then + error 'Captures must start with "@"' + return + end + -- Remove leading "@". + strip_captures[i] = capture:sub(2) + end + + local matches = {} + for match in M.iter_group_results(bufnr, query_group, root, lang) do + for _, capture in ipairs(strip_captures) do + local insert = utils.get_at_path(match, capture) + if insert then + table.insert(matches, insert) + end + end + end + return matches +end + +function M.iter_captures(bufnr, query_name, root, lang) + local query, params = prepare_query(bufnr, query_name, root, lang) + if not query then + return EMPTY_ITER + end + assert(params) + + local iter = query:iter_captures(params.root, params.source, params.start, params.stop) + + local function wrapped_iter() + local id, node, metadata = iter() + if not id then + return + end + + local name = query.captures[id] + if string.sub(name, 1, 1) == "_" then + return wrapped_iter() + end + + return name, node, metadata + end + + return wrapped_iter +end + +---@param bufnr integer +---@param capture_string string +---@param query_group string +---@param filter_predicate fun(match: table): boolean +---@param scoring_function fun(match: table): number +---@param root TSNode +---@return table|unknown +function M.find_best_match(bufnr, capture_string, query_group, filter_predicate, scoring_function, root) + if string.sub(capture_string, 1, 1) == "@" then + --remove leading "@" + capture_string = string.sub(capture_string, 2) + end + + local best ---@type table|nil + local best_score ---@type number + + for maybe_match in M.iter_group_results(bufnr, query_group, root) do + local match = utils.get_at_path(maybe_match, capture_string) + + if match and filter_predicate(match) then + local current_score = scoring_function(match) + if not best then + best = match + best_score = current_score + end + if current_score > best_score then + best = match + best_score = current_score + end + end + end + return best +end + +---Iterates matches from a query file. +---@param bufnr integer the buffer +---@param query_group string the query file to use +---@param root TSNode the root node +---@param root_lang? string the root node lang, if known +function M.iter_group_results(bufnr, query_group, root, root_lang) + local query, params = prepare_query(bufnr, query_group, root, root_lang) + if not query then + return EMPTY_ITER + end + assert(params) + + return M.iter_prepared_matches(query, params.root, params.source, params.start, params.stop) +end + +function M.collect_group_results(bufnr, query_group, root, lang) + local matches = {} + + for prepared_match in M.iter_group_results(bufnr, query_group, root, lang) do + table.insert(matches, prepared_match) + end + + return matches +end + +---@alias CaptureResFn function(string, LanguageTree, LanguageTree): string, string + +-- Same as get_capture_matches except this will recursively get matches for every language in the tree. +---@param bufnr integer The buffer +---@param capture_or_fn string|CaptureResFn The capture to get. If a function is provided then that +--- function will be used to resolve both the capture and query argument. +--- The function can return `nil` to ignore that tree. +---@param query_type string? The query to get the capture from. This is ignored if a function is provided +--- for the capture argument. +---@return table[] +function M.get_capture_matches_recursively(bufnr, capture_or_fn, query_type) + ---@type CaptureResFn + local type_fn + if type(capture_or_fn) == "function" then + type_fn = capture_or_fn + else + type_fn = function(_, _, _) + return capture_or_fn, query_type + end + end + local parser = parsers.get_parser(bufnr) + local matches = {} + + if parser then + parser:for_each_tree(function(tree, lang_tree) + local lang = lang_tree:lang() + local capture, type_ = type_fn(lang, tree, lang_tree) + + if capture then + vim.list_extend(matches, M.get_capture_matches(bufnr, capture, type_, tree:root(), lang) or {}) + end + end) + end + + return matches +end + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/query_predicates.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/query_predicates.lua new file mode 100644 index 00000000..d4726107 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/query_predicates.lua @@ -0,0 +1,238 @@ +local query = require "vim.treesitter.query" + +local html_script_type_languages = { + ["importmap"] = "json", + ["module"] = "javascript", + ["application/ecmascript"] = "javascript", + ["text/ecmascript"] = "javascript", +} + +local non_filetype_match_injection_language_aliases = { + ex = "elixir", + pl = "perl", + sh = "bash", + uxn = "uxntal", + ts = "typescript", +} + +local function get_parser_from_markdown_info_string(injection_alias) + local match = vim.filetype.match { filename = "a." .. injection_alias } + return match or non_filetype_match_injection_language_aliases[injection_alias] or injection_alias +end + +local function error(str) + vim.api.nvim_err_writeln(str) +end + +local function valid_args(name, pred, count, strict_count) + local arg_count = #pred - 1 + + if strict_count then + if arg_count ~= count then + error(string.format("%s must have exactly %d arguments", name, count)) + return false + end + elseif arg_count < count then + error(string.format("%s must have at least %d arguments", name, count)) + return false + end + + return true +end + +---@param match (TSNode|nil)[] +---@param _pattern string +---@param _bufnr integer +---@param pred string[] +---@return boolean|nil +query.add_predicate("nth?", function(match, _pattern, _bufnr, pred) + if not valid_args("nth?", pred, 2, true) then + return + end + + local node = match[pred[2]] ---@type TSNode + local n = tonumber(pred[3]) + if node and node:parent() and node:parent():named_child_count() > n then + return node:parent():named_child(n) == node + end + + return false +end, true) + +---@param match (TSNode|nil)[] +---@param _pattern string +---@param _bufnr integer +---@param pred string[] +---@return boolean|nil +local function has_ancestor(match, _pattern, _bufnr, pred) + if not valid_args(pred[1], pred, 2) then + return + end + + local node = match[pred[2]] + local ancestor_types = { unpack(pred, 3) } + if not node then + return true + end + + local just_direct_parent = pred[1]:find("has-parent", 1, true) + + node = node:parent() + while node do + if vim.tbl_contains(ancestor_types, node:type()) then + return true + end + if just_direct_parent then + node = nil + else + node = node:parent() + end + end + return false +end + +query.add_predicate("has-ancestor?", has_ancestor, true) + +query.add_predicate("has-parent?", has_ancestor, true) + +---@param match (TSNode|nil)[] +---@param _pattern string +---@param bufnr integer +---@param pred string[] +---@return boolean|nil +query.add_predicate("is?", function(match, _pattern, bufnr, pred) + if not valid_args("is?", pred, 2) then + return + end + + -- Avoid circular dependencies + local locals = require "nvim-treesitter.locals" + local node = match[pred[2]] + local types = { unpack(pred, 3) } + + if not node then + return true + end + + local _, _, kind = locals.find_definition(node, bufnr) + + return vim.tbl_contains(types, kind) +end, true) + +---@param match (TSNode|nil)[] +---@param _pattern string +---@param _bufnr integer +---@param pred string[] +---@return boolean|nil +query.add_predicate("has-type?", function(match, _pattern, _bufnr, pred) + if not valid_args(pred[1], pred, 2) then + return + end + + local node = match[pred[2]] + local types = { unpack(pred, 3) } + + if not node then + return true + end + + return vim.tbl_contains(types, node:type()) +end, true) + +---@param match (TSNode|nil)[] +---@param _ string +---@param bufnr integer +---@param pred string[] +---@return boolean|nil +query.add_directive("set-lang-from-mimetype!", function(match, _, bufnr, pred, metadata) + local capture_id = pred[2] + local node = match[capture_id] + if not node then + return + end + local type_attr_value = vim.treesitter.get_node_text(node, bufnr) + local configured = html_script_type_languages[type_attr_value] + if configured then + metadata["injection.language"] = configured + else + local parts = vim.split(type_attr_value, "/", {}) + metadata["injection.language"] = parts[#parts] + end +end, true) + +---@param match (TSNode|nil)[] +---@param _ string +---@param bufnr integer +---@param pred string[] +---@return boolean|nil +query.add_directive("set-lang-from-info-string!", function(match, _, bufnr, pred, metadata) + local capture_id = pred[2] + local node = match[capture_id] + if not node then + return + end + local injection_alias = vim.treesitter.get_node_text(node, bufnr) + metadata["injection.language"] = get_parser_from_markdown_info_string(injection_alias) +end, true) + +-- Just avoid some annoying warnings for this directive +query.add_directive("make-range!", function() end, true) + +--- transform node text to lower case (e.g., to make @injection.language case insensitive) +--- +---@param match (TSNode|nil)[] +---@param _ string +---@param bufnr integer +---@param pred string[] +---@return boolean|nil +query.add_directive("downcase!", function(match, _, bufnr, pred, metadata) + local id = pred[2] + local node = match[id] + if not node then + return + end + + local text = vim.treesitter.get_node_text(node, bufnr, { metadata = metadata[id] }) or "" + if not metadata[id] then + metadata[id] = {} + end + metadata[id].text = string.lower(text) +end, true) + +-- Trim blank lines from end of the region +-- Arguments are the captures to trim. +---@param match (TSNode|nil)[] +---@param _ string +---@param bufnr integer +---@param pred string[] +---@param metadata table +query.add_directive("trim!", function(match, _, bufnr, pred, metadata) + for _, id in ipairs { select(2, unpack(pred)) } do + local node = match[id] + local start_row, start_col, end_row, end_col = node:range() + + -- Don't trim if region ends in middle of a line + if end_col ~= 0 then + return + end + + while true do + -- As we only care when end_col == 0, always inspect one line above end_row. + local end_line = vim.api.nvim_buf_get_lines(bufnr, end_row - 1, end_row, true)[1] + + if end_line ~= "" then + break + end + + end_row = end_row - 1 + end + + -- If this produces an invalid range, we just skip it. + if start_row < end_row or (start_row == end_row and start_col <= end_col) then + if not metadata[id] then + metadata[id] = {} + end + metadata[id].range = { start_row, start_col, end_row, end_col } + end + end +end, true) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/shell_command_selectors.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/shell_command_selectors.lua new file mode 100644 index 00000000..0479956f --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/shell_command_selectors.lua @@ -0,0 +1,335 @@ +local fn = vim.fn +local utils = require "nvim-treesitter.utils" + +-- Convert path for cmd.exe on Windows. +-- This is needed when vim.opt.shellslash is in use. +---@param p string +---@return string +local function cmdpath(p) + if vim.opt.shellslash:get() then + local r = p:gsub("/", "\\") + return r + else + return p + end +end + +local M = {} + +-- Returns the mkdir command based on the OS +---@param directory string +---@param cwd string +---@param info_msg string +---@return table +function M.select_mkdir_cmd(directory, cwd, info_msg) + if fn.has "win32" == 1 then + return { + cmd = "cmd", + opts = { + args = { "/C", "mkdir", cmdpath(directory) }, + cwd = cwd, + }, + info = info_msg, + err = "Could not create " .. directory, + } + else + return { + cmd = "mkdir", + opts = { + args = { directory }, + cwd = cwd, + }, + info = info_msg, + err = "Could not create " .. directory, + } + end +end + +-- Returns the remove command based on the OS +---@param file string +---@param info_msg string +---@return table +function M.select_rm_file_cmd(file, info_msg) + if fn.has "win32" == 1 then + return { + cmd = "cmd", + opts = { + args = { "/C", "if", "exist", cmdpath(file), "del", cmdpath(file) }, + }, + info = info_msg, + err = "Could not delete " .. file, + } + else + return { + cmd = "rm", + opts = { + args = { file }, + }, + info = info_msg, + err = "Could not delete " .. file, + } + end +end + +---@param executables string[] +---@return string|nil +function M.select_executable(executables) + return vim.tbl_filter(function(c) ---@param c string + return c ~= vim.NIL and fn.executable(c) == 1 + end, executables)[1] +end + +-- Returns the compiler arguments based on the compiler and OS +---@param repo InstallInfo +---@param compiler string +---@return string[] +function M.select_compiler_args(repo, compiler) + if string.match(compiler, "cl$") or string.match(compiler, "cl.exe$") then + return { + "/Fe:", + "parser.so", + "/Isrc", + repo.files, + "-Os", + "/LD", + } + elseif string.match(compiler, "zig$") or string.match(compiler, "zig.exe$") then + return { + "c++", + "-o", + "parser.so", + repo.files, + "-lc", + "-Isrc", + "-shared", + "-Os", + } + else + local args = { + "-o", + "parser.so", + "-I./src", + repo.files, + "-Os", + } + if fn.has "mac" == 1 then + table.insert(args, "-bundle") + else + table.insert(args, "-shared") + end + if + #vim.tbl_filter(function(file) ---@param file string + local ext = vim.fn.fnamemodify(file, ":e") + return ext == "cc" or ext == "cpp" or ext == "cxx" + end, repo.files) > 0 + then + table.insert(args, "-lstdc++") + end + if fn.has "win32" == 0 then + table.insert(args, "-fPIC") + end + return args + end +end + +-- Returns the compile command based on the OS and user options +---@param repo InstallInfo +---@param cc string +---@param compile_location string +---@return Command +function M.select_compile_command(repo, cc, compile_location) + local make = M.select_executable { "gmake", "make" } + if + string.match(cc, "cl$") + or string.match(cc, "cl.exe$") + or not repo.use_makefile + or fn.has "win32" == 1 + or not make + then + return { + cmd = cc, + info = "Compiling...", + err = "Error during compilation", + opts = { + args = vim.tbl_flatten(M.select_compiler_args(repo, cc)), + cwd = compile_location, + }, + } + else + return { + cmd = make, + info = "Compiling...", + err = "Error during compilation", + opts = { + args = { + "--makefile=" .. utils.join_path(utils.get_package_path(), "scripts", "compile_parsers.makefile"), + "CC=" .. cc, + "CXX_STANDARD=" .. (repo.cxx_standard or "c++14"), + }, + cwd = compile_location, + }, + } + end +end + +-- Returns the remove command based on the OS +---@param cache_folder string +---@param project_name string +---@return Command +function M.select_install_rm_cmd(cache_folder, project_name) + if fn.has "win32" == 1 then + local dir = cache_folder .. "\\" .. project_name + return { + cmd = "cmd", + opts = { + args = { "/C", "if", "exist", cmdpath(dir), "rmdir", "/s", "/q", cmdpath(dir) }, + }, + } + else + return { + cmd = "rm", + opts = { + args = { "-rf", cache_folder .. "/" .. project_name }, + }, + } + end +end + +-- Returns the move command based on the OS +---@param from string +---@param to string +---@param cwd string +---@return Command +function M.select_mv_cmd(from, to, cwd) + if fn.has "win32" == 1 then + return { + cmd = "cmd", + opts = { + args = { "/C", "move", "/Y", cmdpath(from), cmdpath(to) }, + cwd = cwd, + }, + } + else + return { + cmd = "mv", + opts = { + args = { "-f", from, to }, + cwd = cwd, + }, + } + end +end + +---@param repo InstallInfo +---@param project_name string +---@param cache_folder string +---@param revision string|nil +---@param prefer_git boolean +---@return table +function M.select_download_commands(repo, project_name, cache_folder, revision, prefer_git) + local can_use_tar = vim.fn.executable "tar" == 1 and vim.fn.executable "curl" == 1 + local is_github = repo.url:find("github.com", 1, true) + local is_gitlab = repo.url:find("gitlab.com", 1, true) + + revision = revision or repo.branch or "master" + + if can_use_tar and (is_github or is_gitlab) and not prefer_git then + local path_sep = utils.get_path_sep() + local url = repo.url:gsub(".git$", "") + + local folder_rev = revision + if is_github and revision:match "^v%d" then + folder_rev = revision:sub(2) + end + + return { + M.select_install_rm_cmd(cache_folder, project_name .. "-tmp"), + { + cmd = "curl", + info = "Downloading " .. project_name .. "...", + err = "Error during download, please verify your internet connection", + opts = { + args = { + "--silent", + "-L", -- follow redirects + is_github and url .. "/archive/" .. revision .. ".tar.gz" + or url .. "/-/archive/" .. revision .. "/" .. project_name .. "-" .. revision .. ".tar.gz", + "--output", + project_name .. ".tar.gz", + }, + cwd = cache_folder, + }, + }, + M.select_mkdir_cmd(project_name .. "-tmp", cache_folder, "Creating temporary directory"), + { + cmd = "tar", + info = "Extracting " .. project_name .. "...", + err = "Error during tarball extraction.", + opts = { + args = { + "-xvzf", + project_name .. ".tar.gz", + "-C", + project_name .. "-tmp", + }, + cwd = cache_folder, + }, + }, + M.select_rm_file_cmd(cache_folder .. path_sep .. project_name .. ".tar.gz"), + M.select_mv_cmd( + utils.join_path(project_name .. "-tmp", url:match "[^/]-$" .. "-" .. folder_rev), + project_name, + cache_folder + ), + M.select_install_rm_cmd(cache_folder, project_name .. "-tmp"), + } + else + local git_folder = utils.join_path(cache_folder, project_name) + local clone_error = "Error during download, please verify your internet connection" + + return { + { + cmd = "git", + info = "Downloading " .. project_name .. "...", + err = clone_error, + opts = { + args = { + "clone", + repo.url, + project_name, + }, + cwd = cache_folder, + }, + }, + { + cmd = "git", + info = "Checking out locked revision", + err = "Error while checking out revision", + opts = { + args = { + "checkout", + revision, + }, + cwd = git_folder, + }, + }, + } + end +end + +---@param dir string +---@param command string +---@return string command +function M.make_directory_change_for_command(dir, command) + if fn.has "win32" == 1 then + if string.find(vim.o.shell, "cmd") ~= nil then + return string.format("pushd %s & %s & popd", cmdpath(dir), command) + else + return string.format("pushd %s ; %s ; popd", cmdpath(dir), command) + end + else + return string.format("cd %s;\n %s", dir, command) + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/statusline.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/statusline.lua new file mode 100644 index 00000000..68ba41ac --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/statusline.lua @@ -0,0 +1,53 @@ +local parsers = require "nvim-treesitter.parsers" +local ts_utils = require "nvim-treesitter.ts_utils" + +local M = {} + +-- Trim spaces and opening brackets from end +local transform_line = function(line) + return line:gsub("%s*[%[%(%{]*%s*$", "") +end + +function M.statusline(opts) + if not parsers.has_parser() then + return + end + local options = opts or {} + if type(opts) == "number" then + options = { indicator_size = opts } + end + local bufnr = options.bufnr or 0 + local indicator_size = options.indicator_size or 100 + local type_patterns = options.type_patterns or { "class", "function", "method" } + local transform_fn = options.transform_fn or transform_line + local separator = options.separator or " -> " + local allow_duplicates = options.allow_duplicates or false + + local current_node = ts_utils.get_node_at_cursor() + if not current_node then + return "" + end + + local lines = {} + local expr = current_node + + while expr do + local line = ts_utils._get_line_for_node(expr, type_patterns, transform_fn, bufnr) + if line ~= "" then + if allow_duplicates or not vim.tbl_contains(lines, line) then + table.insert(lines, 1, line) + end + end + expr = expr:parent() + end + + local text = table.concat(lines, separator) + local text_len = #text + if text_len > indicator_size then + return "..." .. text:sub(text_len - indicator_size, text_len) + end + + return text +end + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/ts_utils.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/ts_utils.lua new file mode 100644 index 00000000..655c6288 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/ts_utils.lua @@ -0,0 +1,467 @@ +local api = vim.api + +local parsers = require "nvim-treesitter.parsers" +local utils = require "nvim-treesitter.utils" +local ts = vim.treesitter + +local M = {} + +local function get_node_text(node, bufnr) + bufnr = bufnr or api.nvim_get_current_buf() + if not node then + return {} + end + + -- We have to remember that end_col is end-exclusive + local start_row, start_col, end_row, end_col = ts.get_node_range(node) + + if start_row ~= end_row then + local lines = api.nvim_buf_get_lines(bufnr, start_row, end_row + 1, false) + if next(lines) == nil then + return {} + end + lines[1] = string.sub(lines[1], start_col + 1) + -- end_row might be just after the last line. In this case the last line is not truncated. + if #lines == end_row - start_row + 1 then + lines[#lines] = string.sub(lines[#lines], 1, end_col) + end + return lines + else + local line = api.nvim_buf_get_lines(bufnr, start_row, start_row + 1, false)[1] + -- If line is nil then the line is empty + return line and { string.sub(line, start_col + 1, end_col) } or {} + end +end + +---@private +---@param node TSNode +---@param type_patterns string[] +---@param transform_fn fun(line: string): string +---@param bufnr integer +---@return string +function M._get_line_for_node(node, type_patterns, transform_fn, bufnr) + local node_type = node:type() + local is_valid = false + for _, rgx in ipairs(type_patterns) do + if node_type:find(rgx) then + is_valid = true + break + end + end + if not is_valid then + return "" + end + local line = transform_fn(vim.trim(get_node_text(node, bufnr)[1] or ""), node) + -- Escape % to avoid statusline to evaluate content as expression + return line:gsub("%%", "%%%%") +end + +-- Gets the actual text content of a node +-- @deprecated Use vim.treesitter.query.get_node_text +-- @param node the node to get the text from +-- @param bufnr the buffer containing the node +-- @return list of lines of text of the node +function M.get_node_text(node, bufnr) + vim.notify_once( + "nvim-treesitter.ts_utils.get_node_text is deprecated: use vim.treesitter.query.get_node_text", + vim.log.levels.WARN + ) + return get_node_text(node, bufnr) +end + +-- Determines whether a node is the parent of another +-- @param dest the possible parent +-- @param source the possible child node +function M.is_parent(dest, source) + if not (dest and source) then + return false + end + + local current = source + while current ~= nil do + if current == dest then + return true + end + + current = current:parent() + end + + return false +end + +-- Get next node with same parent +---@param node TSNode +---@param allow_switch_parents? boolean allow switching parents if last node +---@param allow_next_parent? boolean allow next parent if last node and next parent without children +function M.get_next_node(node, allow_switch_parents, allow_next_parent) + local destination_node ---@type TSNode + local parent = node:parent() + + if not parent then + return + end + local found_pos = 0 + for i = 0, parent:named_child_count() - 1, 1 do + if parent:named_child(i) == node then + found_pos = i + break + end + end + if parent:named_child_count() > found_pos + 1 then + destination_node = parent:named_child(found_pos + 1) + elseif allow_switch_parents then + local next_node = M.get_next_node(node:parent()) + if next_node and next_node:named_child_count() > 0 then + destination_node = next_node:named_child(0) + elseif next_node and allow_next_parent then + destination_node = next_node + end + end + + return destination_node +end + +-- Get previous node with same parent +---@param node TSNode +---@param allow_switch_parents? boolean allow switching parents if first node +---@param allow_previous_parent? boolean allow previous parent if first node and previous parent without children +function M.get_previous_node(node, allow_switch_parents, allow_previous_parent) + local destination_node ---@type TSNode + local parent = node:parent() + if not parent then + return + end + + local found_pos = 0 + for i = 0, parent:named_child_count() - 1, 1 do + if parent:named_child(i) == node then + found_pos = i + break + end + end + if 0 < found_pos then + destination_node = parent:named_child(found_pos - 1) + elseif allow_switch_parents then + local previous_node = M.get_previous_node(node:parent()) + if previous_node and previous_node:named_child_count() > 0 then + destination_node = previous_node:named_child(previous_node:named_child_count() - 1) + elseif previous_node and allow_previous_parent then + destination_node = previous_node + end + end + return destination_node +end + +function M.get_named_children(node) + local nodes = {} ---@type TSNode[] + for i = 0, node:named_child_count() - 1, 1 do + nodes[i + 1] = node:named_child(i) + end + return nodes +end + +function M.get_node_at_cursor(winnr, ignore_injected_langs) + winnr = winnr or 0 + local cursor = api.nvim_win_get_cursor(winnr) + local cursor_range = { cursor[1] - 1, cursor[2] } + + local buf = vim.api.nvim_win_get_buf(winnr) + local root_lang_tree = parsers.get_parser(buf) + if not root_lang_tree then + return + end + + local root ---@type TSNode|nil + if ignore_injected_langs then + for _, tree in pairs(root_lang_tree:trees()) do + local tree_root = tree:root() + if tree_root and ts.is_in_node_range(tree_root, cursor_range[1], cursor_range[2]) then + root = tree_root + break + end + end + else + root = M.get_root_for_position(cursor_range[1], cursor_range[2], root_lang_tree) + end + + if not root then + return + end + + return root:named_descendant_for_range(cursor_range[1], cursor_range[2], cursor_range[1], cursor_range[2]) +end + +function M.get_root_for_position(line, col, root_lang_tree) + if not root_lang_tree then + if not parsers.has_parser() then + return + end + + root_lang_tree = parsers.get_parser() + end + + local lang_tree = root_lang_tree:language_for_range { line, col, line, col } + + for _, tree in pairs(lang_tree:trees()) do + local root = tree:root() + + if root and ts.is_in_node_range(root, line, col) then + return root, tree, lang_tree + end + end + + -- This isn't a likely scenario, since the position must belong to a tree somewhere. + return nil, nil, lang_tree +end + +---comment +---@param node TSNode +---@return TSNode result +function M.get_root_for_node(node) + local parent = node + local result = node + + while parent ~= nil do + result = parent + parent = result:parent() + end + + return result +end + +function M.highlight_node(node, buf, hl_namespace, hl_group) + if not node then + return + end + M.highlight_range({ node:range() }, buf, hl_namespace, hl_group) +end + +-- Get a compatible vim range (1 index based) from a TS node range. +-- +-- TS nodes start with 0 and the end col is ending exclusive. +-- They also treat a EOF/EOL char as a char ending in the first +-- col of the next row. +---comment +---@param range integer[] +---@param buf integer|nil +---@return integer, integer, integer, integer +function M.get_vim_range(range, buf) + ---@type integer, integer, integer, integer + local srow, scol, erow, ecol = unpack(range) + srow = srow + 1 + scol = scol + 1 + erow = erow + 1 + + if ecol == 0 then + -- Use the value of the last col of the previous row instead. + erow = erow - 1 + if not buf or buf == 0 then + ecol = vim.fn.col { erow, "$" } - 1 + else + ecol = #api.nvim_buf_get_lines(buf, erow - 1, erow, false)[1] + end + ecol = math.max(ecol, 1) + end + return srow, scol, erow, ecol +end + +function M.highlight_range(range, buf, hl_namespace, hl_group) + ---@type integer, integer, integer, integer + local start_row, start_col, end_row, end_col = unpack(range) + ---@diagnostic disable-next-line: missing-parameter + vim.highlight.range(buf, hl_namespace, hl_group, { start_row, start_col }, { end_row, end_col }) +end + +-- Set visual selection to node +-- @param selection_mode One of "charwise" (default) or "v", "linewise" or "V", +-- "blockwise" or "" (as a string with 5 characters or a single character) +function M.update_selection(buf, node, selection_mode) + local start_row, start_col, end_row, end_col = M.get_vim_range({ ts.get_node_range(node) }, buf) + + local v_table = { charwise = "v", linewise = "V", blockwise = "" } + selection_mode = selection_mode or "charwise" + + -- Normalise selection_mode + if vim.tbl_contains(vim.tbl_keys(v_table), selection_mode) then + selection_mode = v_table[selection_mode] + end + + -- enter visual mode if normal or operator-pending (no) mode + -- Why? According to https://learnvimscriptthehardway.stevelosh.com/chapters/15.html + -- If your operator-pending mapping ends with some text visually selected, Vim will operate on that text. + -- Otherwise, Vim will operate on the text between the original cursor position and the new position. + local mode = api.nvim_get_mode() + if mode.mode ~= selection_mode then + -- Call to `nvim_replace_termcodes()` is needed for sending appropriate command to enter blockwise mode + selection_mode = vim.api.nvim_replace_termcodes(selection_mode, true, true, true) + api.nvim_cmd({ cmd = "normal", bang = true, args = { selection_mode } }, {}) + end + + api.nvim_win_set_cursor(0, { start_row, start_col - 1 }) + vim.cmd "normal! o" + api.nvim_win_set_cursor(0, { end_row, end_col - 1 }) +end + +-- Byte length of node range +---@param node TSNode +---@return number +function M.node_length(node) + local _, _, start_byte = node:start() + local _, _, end_byte = node:end_() + return end_byte - start_byte +end + +---@deprecated Use `vim.treesitter.is_in_node_range()` instead +function M.is_in_node_range(node, line, col) + vim.notify_once( + "nvim-treesitter.ts_utils.is_in_node_range is deprecated: use vim.treesitter.is_in_node_range", + vim.log.levels.WARN + ) + return ts.is_in_node_range(node, line, col) +end + +---@deprecated Use `vim.treesitter.get_node_range()` instead +function M.get_node_range(node_or_range) + vim.notify_once( + "nvim-treesitter.ts_utils.get_node_range is deprecated: use vim.treesitter.get_node_range", + vim.log.levels.WARN + ) + return ts.get_node_range(node_or_range) +end + +---@param node TSNode +---@return table +function M.node_to_lsp_range(node) + local start_line, start_col, end_line, end_col = ts.get_node_range(node) + local rtn = {} + rtn.start = { line = start_line, character = start_col } + rtn["end"] = { line = end_line, character = end_col } + return rtn +end + +-- Memoizes a function based on the buffer tick of the provided bufnr. +-- The cache entry is cleared when the buffer is detached to avoid memory leaks. +-- The options argument is a table with two optional values: +-- - bufnr: extracts a bufnr from the given arguments. +-- - key: extracts the cache key from the given arguments. +---@param fn function the fn to memoize, taking the buffer as first argument +---@param options? {bufnr: integer?, key: string|fun(...): string?} the memoization options +---@return function: a memoized function +function M.memoize_by_buf_tick(fn, options) + options = options or {} + + ---@type table + local cache = setmetatable({}, { __mode = "kv" }) + local bufnr_fn = utils.to_func(options.bufnr or utils.identity) + local key_fn = utils.to_func(options.key or utils.identity) + + return function(...) + local bufnr = bufnr_fn(...) + local key = key_fn(...) + local tick = api.nvim_buf_get_changedtick(bufnr) + + if cache[key] then + if cache[key].last_tick == tick then + return cache[key].result + end + else + local function detach_handler() + cache[key] = nil + end + + -- Clean up logic only! + api.nvim_buf_attach(bufnr, false, { + on_detach = detach_handler, + on_reload = detach_handler, + }) + end + + cache[key] = { + result = fn(...), + last_tick = tick, + } + + return cache[key].result + end +end + +function M.swap_nodes(node_or_range1, node_or_range2, bufnr, cursor_to_second) + if not node_or_range1 or not node_or_range2 then + return + end + local range1 = M.node_to_lsp_range(node_or_range1) + local range2 = M.node_to_lsp_range(node_or_range2) + + local text1 = get_node_text(node_or_range1, bufnr) + local text2 = get_node_text(node_or_range2, bufnr) + + local edit1 = { range = range1, newText = table.concat(text2, "\n") } + local edit2 = { range = range2, newText = table.concat(text1, "\n") } + vim.lsp.util.apply_text_edits({ edit1, edit2 }, bufnr, "utf-8") + + if cursor_to_second then + utils.set_jump() + + local char_delta = 0 + local line_delta = 0 + if + range1["end"].line < range2.start.line + or (range1["end"].line == range2.start.line and range1["end"].character <= range2.start.character) + then + line_delta = #text2 - #text1 + end + + if range1["end"].line == range2.start.line and range1["end"].character <= range2.start.character then + if line_delta ~= 0 then + --- why? + --correction_after_line_change = -range2.start.character + --text_now_before_range2 = #(text2[#text2]) + --space_between_ranges = range2.start.character - range1["end"].character + --char_delta = correction_after_line_change + text_now_before_range2 + space_between_ranges + --- Equivalent to: + char_delta = #text2[#text2] - range1["end"].character + + -- add range1.start.character if last line of range1 (now text2) does not start at 0 + if range1.start.line == range2.start.line + line_delta then + char_delta = char_delta + range1.start.character + end + else + char_delta = #text2[#text2] - #text1[#text1] + end + end + + api.nvim_win_set_cursor( + api.nvim_get_current_win(), + { range2.start.line + 1 + line_delta, range2.start.character + char_delta } + ) + end +end + +function M.goto_node(node, goto_end, avoid_set_jump) + if not node then + return + end + if not avoid_set_jump then + utils.set_jump() + end + local range = { M.get_vim_range { node:range() } } + ---@type table + local position + if not goto_end then + position = { range[1], range[2] } + else + position = { range[3], range[4] } + end + + -- Enter visual mode if we are in operator pending mode + -- If we don't do this, it will miss the last character. + local mode = vim.api.nvim_get_mode() + if mode.mode == "no" then + vim.cmd "normal! v" + end + + -- Position is 1, 0 indexed. + api.nvim_win_set_cursor(0, { position[1], position[2] - 1 }) +end + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/tsrange.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/tsrange.lua new file mode 100644 index 00000000..d41585c6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/tsrange.lua @@ -0,0 +1,154 @@ +local M = {} +local TSRange = {} +TSRange.__index = TSRange + +local api = vim.api +local ts_utils = require "nvim-treesitter.ts_utils" +local parsers = require "nvim-treesitter.parsers" + +local function get_byte_offset(buf, row, col) + return api.nvim_buf_get_offset(buf, row) + vim.fn.byteidx(api.nvim_buf_get_lines(buf, row, row + 1, false)[1], col) +end + +function TSRange.new(buf, start_row, start_col, end_row, end_col) + return setmetatable({ + start_pos = { start_row, start_col, get_byte_offset(buf, start_row, start_col) }, + end_pos = { end_row, end_col, get_byte_offset(buf, end_row, end_col) }, + buf = buf, + [1] = start_row, + [2] = start_col, + [3] = end_row, + [4] = end_col, + }, TSRange) +end + +function TSRange.from_nodes(buf, start_node, end_node) + TSRange.__index = TSRange + local start_pos = start_node and { start_node:start() } or { end_node:start() } + local end_pos = end_node and { end_node:end_() } or { start_node:end_() } + return setmetatable({ + start_pos = { start_pos[1], start_pos[2], start_pos[3] }, + end_pos = { end_pos[1], end_pos[2], end_pos[3] }, + buf = buf, + [1] = start_pos[1], + [2] = start_pos[2], + [3] = end_pos[1], + [4] = end_pos[2], + }, TSRange) +end + +function TSRange.from_table(buf, range) + return setmetatable({ + start_pos = { range[1], range[2], get_byte_offset(buf, range[1], range[2]) }, + end_pos = { range[3], range[4], get_byte_offset(buf, range[3], range[4]) }, + buf = buf, + [1] = range[1], + [2] = range[2], + [3] = range[3], + [4] = range[4], + }, TSRange) +end + +function TSRange:parent() + local root_lang_tree = parsers.get_parser(self.buf) + local root = ts_utils.get_root_for_position(self[1], self[2], root_lang_tree) + + return root + and root:named_descendant_for_range(self.start_pos[1], self.start_pos[2], self.end_pos[1], self.end_pos[2]) + or nil +end + +function TSRange:field() end + +function TSRange:child_count() + return #self:collect_children() +end + +function TSRange:named_child_count() + return #self:collect_children(function(c) + return c:named() + end) +end + +function TSRange:iter_children() + local raw_iterator = self:parent().iter_children() + return function() + while true do + local node = raw_iterator() + if not node then + return + end + local _, _, start_byte = node:start() + local _, _, end_byte = node:end_() + if start_byte >= self.start_pos[3] and end_byte <= self.end_pos[3] then + return node + end + end + end +end + +function TSRange:collect_children(filter_fun) + local children = {} + for _, c in self:iter_children() do + if not filter_fun or filter_fun(c) then + table.insert(children, c) + end + end + return children +end + +function TSRange:child(index) + return self:collect_children()[index + 1] +end + +function TSRange:named_child(index) + return self:collect_children(function(c) + return c.named() + end)[index + 1] +end + +function TSRange:start() + return unpack(self.start_pos) +end + +function TSRange:end_() + return unpack(self.end_pos) +end + +function TSRange:range() + return self.start_pos[1], self.start_pos[2], self.end_pos[1], self.end_pos[2] +end + +function TSRange:type() + return "nvim-treesitter-range" +end + +function TSRange:symbol() + return -1 +end + +function TSRange:named() + return false +end + +function TSRange:missing() + return false +end + +function TSRange:has_error() + return #self:collect_children(function(c) + return c:has_error() + end) > 0 and true or false +end + +function TSRange:sexpr() + return table.concat( + vim.tbl_map(function(c) + return c:sexpr() + end, self:collect_children()), + " " + ) +end + +M.TSRange = TSRange +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/utils.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/utils.lua new file mode 100644 index 00000000..4aa8e598 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/lua/nvim-treesitter/utils.lua @@ -0,0 +1,237 @@ +local api = vim.api +local fn = vim.fn +local luv = vim.loop + +local M = {} + +-- Wrapper around vim.notify with common options set. +---@param msg string +---@param log_level number|nil +---@param opts table|nil +function M.notify(msg, log_level, opts) + local default_opts = { title = "nvim-treesitter" } + vim.notify(msg, log_level, vim.tbl_extend("force", default_opts, opts or {})) +end + +-- Returns the system-specific path separator. +---@return string +function M.get_path_sep() + return (fn.has "win32" == 1 and not vim.opt.shellslash:get()) and "\\" or "/" +end + +-- Returns a function that joins the given arguments with separator. Arguments +-- can't be nil. Example: +-- +--[[ + print(M.generate_join(" ")("foo", "bar")) +--]] +--prints "foo bar" +---@param separator string +---@return fun(...: string): string +function M.generate_join(separator) + return function(...) + return table.concat({ ... }, separator) + end +end + +M.join_path = M.generate_join(M.get_path_sep()) + +M.join_space = M.generate_join " " + +---@class Command +---@field run function +---@field f_args string +---@field args string + +-- Define user defined vim command which calls nvim-treesitter module function +-- - If module name is 'mod', it should be defined in hierarchy 'nvim-treesitter.mod' +-- - A table with name 'commands' should be defined in 'mod' which needs to be passed as +-- the commands param of this function +-- +---@param mod string Name of the module that resides in the hierarchy - nvim-treesitter.module +---@param commands table Command list for the module +--- - {command_name} Name of the vim user defined command, Keys: +--- - {run}: (function) callback function that needs to be executed +--- - {f_args}: (string, default ) +--- - type of arguments that needs to be passed to the vim command +--- - {args}: (string, optional) +--- - vim command attributes +--- +---* @example +--- If module is nvim-treesitter.custom_mod +---
+---  M.commands = {
+---      custom_command = {
+---          run = M.module_function,
+---          f_args = "",
+---          args = {
+---              "-range"
+---          }
+---      }
+---  }
+---
+---  utils.setup_commands("custom_mod", require("nvim-treesitter.custom_mod").commands)
+---  
+--- +--- Will generate command : +---
+---  command! -range custom_command \
+---      lua require'nvim-treesitter.custom_mod'.commands.custom_command['run']()
+---  
+function M.setup_commands(mod, commands) + for command_name, def in pairs(commands) do + local f_args = def.f_args or "" + local call_fn = + string.format("lua require'nvim-treesitter.%s'.commands.%s['run'](%s)", mod, command_name, f_args) + local parts = vim.tbl_flatten { + "command!", + "-bar", + def.args, + command_name, + call_fn, + } + api.nvim_command(table.concat(parts, " ")) + end +end + +---@param dir string +---@param create_err string +---@param writeable_err string +---@return string|nil, string|nil +function M.create_or_reuse_writable_dir(dir, create_err, writeable_err) + create_err = create_err or M.join_space("Could not create dir '", dir, "': ") + writeable_err = writeable_err or M.join_space("Invalid rights, '", dir, "' should be read/write") + -- Try creating and using parser_dir if it doesn't exist + if not luv.fs_stat(dir) then + local ok, error = pcall(vim.fn.mkdir, dir, "p", "0755") + if not ok then + return nil, M.join_space(create_err, error) + end + + return dir + end + + -- parser_dir exists, use it if it's read/write + if luv.fs_access(dir, "RW") then + return dir + end + + -- parser_dir exists but isn't read/write, give up + return nil, M.join_space(writeable_err, dir, "'") +end + +function M.get_package_path() + -- Path to this source file, removing the leading '@' + local source = string.sub(debug.getinfo(1, "S").source, 2) + + -- Path to the package root + return fn.fnamemodify(source, ":p:h:h:h") +end + +function M.get_cache_dir() + local cache_dir = fn.stdpath "data" + + if luv.fs_access(cache_dir, "RW") then + return cache_dir + elseif luv.fs_access("/tmp", "RW") then + return "/tmp" + end + + return nil, M.join_space("Invalid cache rights,", fn.stdpath "data", "or /tmp should be read/write") +end + +-- Returns $XDG_DATA_HOME/nvim/site, but could use any directory that is in +-- runtimepath +function M.get_site_dir() + return M.join_path(fn.stdpath "data", "site") +end + +-- Gets a property at path +---@param tbl table the table to access +---@param path string the '.' separated path +---@return table|nil result the value at path or nil +function M.get_at_path(tbl, path) + if path == "" then + return tbl + end + + local segments = vim.split(path, ".", true) + ---@type table[]|table + local result = tbl + + for _, segment in ipairs(segments) do + if type(result) == "table" then + ---@type table + -- TODO: figure out the actual type of tbl + result = result[segment] + end + end + + return result +end + +function M.set_jump() + vim.cmd "normal! m'" +end + +-- Filters a list based on the given predicate +---@param tbl any[] The list to filter +---@param predicate fun(v:any, i:number):boolean The predicate to filter with +function M.filter(tbl, predicate) + local result = {} + + for i, v in ipairs(tbl) do + if predicate(v, i) then + table.insert(result, v) + end + end + + return result +end + +-- Returns a list of all values from the first list +-- that are not present in the second list. +---@param tbl1 any[] The first table +---@param tbl2 any[] The second table +---@return table +function M.difference(tbl1, tbl2) + return M.filter(tbl1, function(v) + return not vim.tbl_contains(tbl2, v) + end) +end + +function M.identity(a) + return a +end + +-- Returns a function returning the given value +---@param a any +---@return fun():any +function M.constant(a) + return function() + return a + end +end + +-- Returns a function that returns the given value if it is a function, +-- otherwise returns a function that returns the given value. +---@param a any +---@return fun(...):any +function M.to_func(a) + return type(a) == "function" and a or M.constant(a) +end + +---@return string|nil +function M.ts_cli_version() + if fn.executable "tree-sitter" == 1 then + local handle = io.popen "tree-sitter -V" + if not handle then + return + end + local result = handle:read "*a" + handle:close() + return vim.split(result, "\n")[1]:match "[^tree%psitter ].*" + end +end + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/parser-info/.gitignore b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/parser-info/.gitignore new file mode 100644 index 00000000..d6b7ef32 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/parser-info/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/parser/.gitignore b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/parser/.gitignore new file mode 100644 index 00000000..d6b7ef32 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/parser/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/plugin/nvim-treesitter.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/plugin/nvim-treesitter.lua new file mode 100644 index 00000000..4ea3925f --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/plugin/nvim-treesitter.lua @@ -0,0 +1,34 @@ +-- Last Change: 2022 Apr 16 + +if vim.g.loaded_nvim_treesitter then + return +end +vim.g.loaded_nvim_treesitter = true + +-- setup modules +require("nvim-treesitter").setup() + +local api = vim.api + +-- define autocommands +local augroup = api.nvim_create_augroup("NvimTreesitter", {}) + +api.nvim_create_autocmd("Filetype", { + pattern = "query", + group = augroup, + callback = function() + api.nvim_clear_autocmds { + group = augroup, + event = "BufWritePost", + } + api.nvim_create_autocmd("BufWritePost", { + group = augroup, + buffer = 0, + callback = function(opts) + require("nvim-treesitter.query").invalidate_query_file(opts.file) + end, + desc = "Invalidate query file", + }) + end, + desc = "Reload query", +}) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ada/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ada/folds.scm new file mode 100644 index 00000000..b8b5735b --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ada/folds.scm @@ -0,0 +1,14 @@ +;; Support for folding in Ada +;; za toggles folding a package, subprogram, if statement or loop + +[ + (package_declaration) + (generic_package_declaration) + (package_body) + (subprogram_body) + (block_statement) + (if_statement) + (loop_statement) + (gnatprep_declarative_if_statement) + (gnatprep_if_statement) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ada/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ada/highlights.scm new file mode 100644 index 00000000..69476307 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ada/highlights.scm @@ -0,0 +1,190 @@ +;; highlight queries. +;; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries +;; See also https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations +;; for a list of recommended @ tags, though not all of them have matching +;; highlights in neovim. + +[ + "abort" + "abs" + "abstract" + "accept" + "access" + "all" + "array" + "at" + "begin" + "declare" + "delay" + "delta" + "digits" + "do" + "end" + "entry" + "exit" + "generic" + "interface" + "is" + "limited" + "null" + "of" + "others" + "out" + "pragma" + "private" + "range" + "synchronized" + "tagged" + "task" + "terminate" + "until" + "when" +] @keyword +[ + "aliased" + "constant" + "renames" +] @storageclass +[ + "mod" + "new" + "protected" + "record" + "subtype" + "type" +] @keyword.type +[ + "with" + "use" +] @include +[ + "body" + "function" + "overriding" + "procedure" + "package" + "separate" +] @keyword.function +[ + "and" + "in" + "not" + "or" + "xor" +] @keyword.operator +[ + "while" + "loop" + "for" + "parallel" + "reverse" + "some" +] @repeat +[ + "return" +] @keyword.return +[ + "case" + "if" + "else" + "then" + "elsif" + "select" +] @conditional +[ + "exception" + "raise" +] @exception +(comment) @comment @spell +(string_literal) @string +(character_literal) @string +(numeric_literal) @number + +;; Highlight the name of subprograms +(procedure_specification name: (_) @function) +(function_specification name: (_) @function) +(package_declaration name: (_) @function) +(package_body name: (_) @function) +(generic_instantiation name: (_) @function) +(entry_declaration . (identifier) @function) + +;; Some keywords should take different categories depending on the context +(use_clause "use" @include "type" @include) +(with_clause "private" @include) +(with_clause "limited" @include) +(use_clause (_) @namespace) +(with_clause (_) @namespace) + +(loop_statement "end" @keyword.repeat) +(if_statement "end" @conditional) +(loop_parameter_specification "in" @keyword.repeat) +(loop_parameter_specification "in" @keyword.repeat) +(iterator_specification ["in" "of"] @keyword.repeat) +(range_attribute_designator "range" @keyword.repeat) + +(raise_statement "with" @exception) + +(gnatprep_declarative_if_statement) @preproc +(gnatprep_if_statement) @preproc +(gnatprep_identifier) @preproc + +(subprogram_declaration "is" @keyword.function "abstract" @keyword.function) +(aspect_specification "with" @keyword.function) + +(full_type_declaration "is" @keyword.type) +(subtype_declaration "is" @keyword.type) +(record_definition "end" @keyword.type) +(full_type_declaration (_ "access" @keyword.type)) +(array_type_definition "array" @keyword.type "of" @keyword.type) +(access_to_object_definition "access" @keyword.type) +(access_to_object_definition "access" @keyword.type + [ + (general_access_modifier "constant" @keyword.type) + (general_access_modifier "all" @keyword.type) + ] +) +(range_constraint "range" @keyword.type) +(signed_integer_type_definition "range" @keyword.type) +(index_subtype_definition "range" @keyword.type) +(record_type_definition "abstract" @keyword.type) +(record_type_definition "tagged" @keyword.type) +(record_type_definition "limited" @keyword.type) +(record_type_definition (record_definition "null" @keyword.type)) +(private_type_declaration "is" @keyword.type "private" @keyword.type) +(private_type_declaration "tagged" @keyword.type) +(private_type_declaration "limited" @keyword.type) +(task_type_declaration "task" @keyword.type "is" @keyword.type) + +;; Gray the body of expression functions +(expression_function_declaration + (function_specification) + "is" + (_) @attribute +) +(subprogram_declaration (aspect_specification) @attribute) + +;; Highlight full subprogram specifications +;(subprogram_body +; [ +; (procedure_specification) +; (function_specification) +; ] @function.spec +;) + +((comment) @comment.documentation + . [ + (entry_declaration) + (subprogram_declaration) + (parameter_specification) + ]) + +(compilation_unit + . (comment) @comment.documentation) + +(component_list + (component_declaration) + . (comment) @comment.documentation) + +(enumeration_type_definition + (identifier) + . (comment) @comment.documentation) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ada/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ada/locals.scm new file mode 100644 index 00000000..b36d3718 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ada/locals.scm @@ -0,0 +1,33 @@ +;; Better highlighting by referencing to the definition, for variable +;; references. However, this is not yet supported by neovim +;; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables + +(compilation) @scope +(package_declaration) @scope +(package_body) @scope +(subprogram_declaration) @scope +(subprogram_body) @scope +(block_statement) @scope + +(with_clause (identifier) @definition.import) +(procedure_specification name: (_) @definition.function) +(function_specification name: (_) @definition.function) +(package_declaration name: (_) @definition.var) +(package_body name: (_) @definition.var) +(generic_instantiation . name: (_) @definition.var) +(component_declaration . (identifier) @definition.var) +(exception_declaration . (identifier) @definition.var) +(formal_object_declaration . (identifier) @definition.var) +(object_declaration . (identifier) @definition.var) +(parameter_specification . (identifier) @definition.var) +(full_type_declaration . (identifier) @definition.type) +(private_type_declaration . (identifier) @definition.type) +(private_extension_declaration . (identifier) @definition.type) +(incomplete_type_declaration . (identifier) @definition.type) +(protected_type_declaration . (identifier) @definition.type) +(formal_complete_type_declaration . (identifier) @definition.type) +(formal_incomplete_type_declaration . (identifier) @definition.type) +(task_type_declaration . (identifier) @definition.type) +(subtype_declaration . (identifier) @definition.type) + +(identifier) @reference diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/agda/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/agda/folds.scm new file mode 100644 index 00000000..e3258efb --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/agda/folds.scm @@ -0,0 +1,4 @@ +[ + (record) + (module) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/agda/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/agda/highlights.scm new file mode 100644 index 00000000..a5c42c0a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/agda/highlights.scm @@ -0,0 +1,81 @@ + +;; Constants +(integer) @number + +;; Variables and Symbols + +(typed_binding (atom (qid) @variable)) +(untyped_binding) @variable +(typed_binding (expr) @type) + +(id) @function +(bid) @function + +(function_name (atom (qid) @function)) +(field_name) @function + + +[(data_name) (record_name)] @constructor + +; Set +(SetN) @type.builtin + +(expr . (atom) @function) + +((atom) @boolean + (#any-of? @boolean "true" "false" "True" "False")) + +;; Imports and Module Declarations + +"import" @include + +(module_name) @namespace + +;; Pragmas and comments + +(pragma) @preproc + +(comment) @comment @spell + +;; Keywords +[ + "where" + "data" + "rewrite" + "postulate" + "public" + "private" + "tactic" + "Prop" + "quote" + "renaming" + "open" + "in" + "hiding" + "constructor" + "abstract" + "let" + "field" + "mutual" + "module" + "infix" + "infixl" + "infixr" + "record" +] +@keyword + +;;;(expr +;;; f_name: (atom) @function) +;; Brackets + +[ + "(" + ")" + "{" + "}"] +@punctuation.bracket + +[ + "=" +] @operator diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/angular/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/angular/highlights.scm new file mode 100644 index 00000000..dc926bb9 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/angular/highlights.scm @@ -0,0 +1,67 @@ +(identifier) @variable +(pipe_sequence "|" @operator) +(string) @string +(number) @number +(pipe_call + name: (identifier) @function) +(pipe_call + arguments: (pipe_arguments + (identifier) @parameter)) + +(structural_assignment + operator: (identifier) @keyword) + +(member_expression + property: (identifier) @property) + +(call_expression + function: (identifier) @function) + +(call_expression + function: ((identifier) @function.builtin + (#eq? @function.builtin "$any"))) + +[ +"let" +"as" +] @keyword + +[ +"(" +")" +"[" +"]" +"{" +"}" +] @punctuation.bracket + +[ +";" +"." +"," +"?." +] @punctuation.delimiter + +((identifier) @boolean + (#any-of? @boolean "true" "false")) +((identifier) @variable.builtin + (#any-of? @variable.builtin "this" "\$event" "null")) + +[ + "-" + "&&" + "+" + "<" + "<=" + "=" + "==" + "===" + "!=" + "!==" + ">" + ">=" + "*" + "/" + "||" + "%" +] @operator diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/apex/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/apex/folds.scm new file mode 100644 index 00000000..0ffc550e --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/apex/folds.scm @@ -0,0 +1,6 @@ +[ + (class_body) + (constructor_declaration) + (argument_list) + (annotation_argument_list) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/apex/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/apex/highlights.scm new file mode 100644 index 00000000..f5ce0b9f --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/apex/highlights.scm @@ -0,0 +1,248 @@ +; inherits: soql + +;;; Apex + SOQL + +[ + "[" + "]" + "{" + "}" + "(" + ")" +] @punctuation.bracket + +[ + "," + "." + ":" + "?" + ";" + ] @punctuation.delimiter + +;; Default general color defination + +(identifier) @variable + +(type_identifier) @type + +;; Methods + +(method_declaration + name: (identifier) @method) + +(method_invocation + name: (identifier) @method.call) + +(super) @function.builtin + +;; Annotations + +(annotation + name: (identifier) @attribute) + +;; Types + +(interface_declaration + name: (identifier) @type) + +(class_declaration + name: (identifier) @type) + +(class_declaration + (superclass) @type) + +(enum_declaration + name: (identifier) @type) + +(enum_constant + name: (identifier) @constant) + +(type_arguments "<" @punctuation.delimiter) +(type_arguments ">" @punctuation.delimiter) + +((field_access + object: (identifier) @type)) + +(field_access + field: (identifier) @property) + +((scoped_identifier + scope: (identifier) @type) + (#match? @type "^[A-Z]")) + +((method_invocation + object: (identifier) @type) + (#match? @type "^[A-Z]")) + +(method_declaration + (formal_parameters + (formal_parameter + name: (identifier) @parameter))) + +(constructor_declaration + name: (identifier) @constructor) + +(dml_type) @function.builtin + +(assignment_operator) @operator + +(update_expression ["++" "--"] @operator) + +(trigger_declaration + name: (identifier) @type + object: (identifier) @type + (trigger_event) @keyword + ("," (trigger_event) @keyword)*) + +[ + "@" + "=" + "!=" + "<=" + ">=" +] @operator + +(binary_expression + operator: [ + ">" + "<" + "==" + "===" + "!==" + "&&" + "||" + "+" + "-" + "*" + "/" + "&" + "|" + "^" + "%" + "<<" + ">>" + ">>>"] @operator) + +(unary_expression + operator: [ + "+" + "-" + "!" + "~" + ]) @operator + +(map_initializer "=>" @operator) + +[ + (boolean_type) + (void_type) +] @type.builtin;; + +; Fields + +(field_declaration + declarator: (variable_declarator + name: (identifier) @field)) + +(field_access + field: (identifier) @field) + +; Variables + +(field_declaration + (modifiers (modifier ["final" "static"])(modifier ["final" "static"])) + (variable_declarator + name: (identifier) @constant)) + +(variable_declarator + (identifier) @property) + +((identifier) @constant + (#lua-match? @constant "^[A-Z][A-Z0-9_]+$")) ; SCREAM SNAKE CASE + +(this) @variable.builtin + +; Literals + +[ + (int) + (decimal) + (currency_literal) +] @number + +(string_literal) @string + +[ + (line_comment) + (block_comment) +] @comment + +(null_literal) @constant.builtin + +;; ;; Keywords + +[ + "abstract" + "final" + "private" + "protected" + "public" + "static" + ] @type.qualifier + +[ + "if" + "else" + "switch" +] @conditional + +[ + "for" + "while" + "do" + "break" +] @repeat + +[ + "return" +] @keyword.return + +[ + "throw" + "finally" + "try" + "catch" + ] @exception + +"new" @keyword.operator + +[ + "abstract" + "class" + "continue" + "default" + "enum" + "extends" + "final" + "get" + "global" + "implements" + "instanceof" + "interface" + "on" + "private" + "protected" + "public" + "set" + "static" + "testMethod" + "transient" + "trigger" + "virtual" + "when" + "with_sharing" + "without_sharing" + "inherited_sharing" +] @keyword + +"System.runAs" @type.builtin diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/apex/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/apex/locals.scm new file mode 100644 index 00000000..c7213601 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/apex/locals.scm @@ -0,0 +1,66 @@ +; declarations + +(class_declaration) @scope +(method_declaration) @scope +(constructor_declaration) @scope +(enum_declaration) @scope +(enhanced_for_statement) @scope + +; if/else + +(if_statement) @scope +(if_statement + consequence: (_) @scope) ; if body in case there are no braces +(if_statement + alternative: (_) @scope) ; else body in case there are no braces + +; try/catch + +(try_statement) @scope ; covers try+catch, individual try and catch are covered by (block) +(catch_clause) @scope ; needed because `Exception` variable + +; loops + +(for_statement) @scope +(for_statement ; "for" body in case there are no braces + body: (_) @scope) +(do_statement + body: (_) @scope) +(while_statement + body: (_) @scope) + +; Functions + +(constructor_declaration) @scope +(method_declaration) @scope + +;; definitions + +(enum_declaration + name: (identifier) @definition.enum) + +(method_declaration + name: (identifier) @definition.method) + +(local_variable_declaration + declarator: (variable_declarator + name: (identifier) @definition.var)) + +(enhanced_for_statement + name: (identifier) @definition.var) + +(formal_parameter + name: (identifier) @definition.parameter) + +(catch_formal_parameter + name: (identifier) @definition.parameter) + +(field_declaration + declarator: (variable_declarator + name: (identifier) @definition.field)) + +;; REFERENCES + +(identifier) @reference + +(type_identifier) @reference diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/arduino/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/arduino/folds.scm new file mode 100644 index 00000000..b617fdc5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/arduino/folds.scm @@ -0,0 +1 @@ +; inherits: cpp diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/arduino/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/arduino/highlights.scm new file mode 100644 index 00000000..a4e74ae8 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/arduino/highlights.scm @@ -0,0 +1,111 @@ +; inherits: cpp + +((identifier) @function.builtin + (#any-of? @function.builtin + ; Digital I/O + "digitalRead" + "digitalWrite" + "pinMode" + ; Analog I/O + "analogRead" + "analogReference" + "analogWrite" + ; Zero, Due & MKR Family + "analogReadResolution" + "analogWriteResolution" + ; Advanced I/O + "noTone" + "pulseIn" + "pulseInLong" + "shiftIn" + "shiftOut" + "tone" + ; Time + "delay" + "delayMicroseconds" + "micros" + "millis" + ; Math + "abs" + "constrain" + "map" + "max" + "min" + "pow" + "sq" + "sqrt" + ; Trigonometry + "cos" + "sin" + "tan" + ; Characters + "isAlpha" + "isAlphaNumeric" + "isAscii" + "isControl" + "isDigit" + "isGraph" + "isHexadecimalDigit" + "isLowerCase" + "isPrintable" + "isPunct" + "isSpace" + "isUpperCase" + "isWhitespace" + ; Random Numbers + "random" + "randomSeed" + ; Bits and Bytes + "bit" + "bitClear" + "bitRead" + "bitSet" + "bitWrite" + "highByte" + "lowByte" + ; External Interrupts + "attachInterrupt" + "detachInterrupt" + ; Interrupts + "interrupts" + "noInterrupts" + )) + +((identifier) @type.builtin + (#any-of? @type.builtin + "Serial" + "SPI" + "Stream" + "Wire" + "Keyboard" + "Mouse" + "String" + )) + +((identifier) @constant.builtin + (#any-of? @constant.builtin + "HIGH" + "LOW" + "INPUT" + "OUTPUT" + "INPUT_PULLUP" + "LED_BUILTIN" + )) + +(function_definition + (function_declarator + declarator: (identifier) @function.builtin) + (#any-of? @function.builtin "loop" "setup")) + +(call_expression + function: (primitive_type) @function.builtin) + +(call_expression + function: (identifier) @constructor + (#any-of? @constructor "SPISettings" "String")) + +(declaration + (type_identifier) @type.builtin + (function_declarator + declarator: (identifier) @constructor) + (#eq? @type.builtin "SPISettings")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/arduino/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/arduino/indents.scm new file mode 100644 index 00000000..b617fdc5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/arduino/indents.scm @@ -0,0 +1 @@ +; inherits: cpp diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/arduino/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/arduino/injections.scm new file mode 100644 index 00000000..6ccfef83 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/arduino/injections.scm @@ -0,0 +1,5 @@ +((preproc_arg) @injection.content + (#set! injection.language "arduino")) + +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/arduino/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/arduino/locals.scm new file mode 100644 index 00000000..b617fdc5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/arduino/locals.scm @@ -0,0 +1 @@ +; inherits: cpp diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/astro/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/astro/folds.scm new file mode 100644 index 00000000..1f2129cf --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/astro/folds.scm @@ -0,0 +1 @@ +; inherits: html diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/astro/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/astro/highlights.scm new file mode 100644 index 00000000..91ccbffb --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/astro/highlights.scm @@ -0,0 +1,13 @@ +; inherits: html + +[ "---" ] @punctuation.delimiter + +[ "{" "}" ] @punctuation.special + +; custom components get `@type` highlighting +((start_tag (tag_name) @type) + (#lua-match? @type "^[A-Z]")) +((end_tag (tag_name) @type) + (#lua-match? @type "^[A-Z]")) +((erroneous_end_tag (erroneous_end_tag_name) @type) + (#lua-match? @type "^[A-Z]")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/astro/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/astro/indents.scm new file mode 100644 index 00000000..1f2129cf --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/astro/indents.scm @@ -0,0 +1 @@ +; inherits: html diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/astro/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/astro/injections.scm new file mode 100644 index 00000000..b8f1ccef --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/astro/injections.scm @@ -0,0 +1,23 @@ +; inherits: html_tags + +(frontmatter + (raw_text) @injection.content + (#set! injection.language "typescript")) + +(interpolation + (raw_text) @injection.content + (#set! injection.language "tsx")) + +(script_element + (raw_text) @injection.content + (#set! injection.language "typescript")) + +(style_element + (start_tag + (attribute + (attribute_name) @_lang_attr + (quoted_attribute_value (attribute_value) @_lang_value))) + (raw_text) @injection.content + (#eq? @_lang_attr "lang") + (#eq? @_lang_value "scss") + (#set! injection.language "scss")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/astro/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/astro/locals.scm new file mode 100644 index 00000000..1f2129cf --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/astro/locals.scm @@ -0,0 +1 @@ +; inherits: html diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/authzed/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/authzed/highlights.scm new file mode 100644 index 00000000..7a4b85d1 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/authzed/highlights.scm @@ -0,0 +1,58 @@ +(identifier) @function + +(block + (relation + (relation_literal) @function.builtin + (identifier) @constant)) + +(block + (permission + (permission_literal) @variable.builtin + (identifier) @type)) + +; relations +(rel_expression (identifier) @property) + +(relation + (rel_expression + (hash_literal) + . + (identifier) @constant)) + +; permissions +(perm_expression (identifier) @property) + +(call_expression + function: (selector_expression + operand: (identifier) @constant + field: (field_identifier) @function.method)) + +(perm_expression + (stabby) @operator + . + (identifier) @function) + +; misc +[ + (plus_literal) + (minus_literal) + (amp_literal) + (pipe_literal) +] @operator + +[ + (true) + (false) +] @boolean + +(nil) @constant.builtin + +[ + (caveat_literal) + (definition_literal) +] @keyword + +[ + (hash_literal) + (comment) +] @comment diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/authzed/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/authzed/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/authzed/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/awk/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/awk/highlights.scm new file mode 100644 index 00000000..4faf496e --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/awk/highlights.scm @@ -0,0 +1,195 @@ +; adapted from https://github.com/Beaglefoot/tree-sitter-awk + +[ + (identifier) + (field_ref) +] @variable +(field_ref (_) @variable) + +; https://www.gnu.org/software/gawk/manual/html_node/Auto_002dset.html +((identifier) @constant.builtin + (#any-of? @constant.builtin + "ARGC" + "ARGV" + "ARGIND" + "ENVIRON" + "ERRNO" + "FILENAME" + "FNR" + "NF" + "FUNCTAB" + "NR" + "PROCINFO" + "RLENGTH" + "RSTART" + "RT" + "SYMTAB")) + +; https://www.gnu.org/software/gawk/manual/html_node/User_002dmodified.html +((identifier) @variable.builtin + (#any-of? @variable.builtin + "BINMODE" + "CONVFMT" + "FIELDWIDTHS" + "FPAT" + "FS" + "IGNORECASE" + "LINT" + "OFMT" + "OFS" + "ORS" + "PREC" + "ROUNDMODE" + "RS" + "SUBSEP" + "TEXTDOMAIN")) + +(number) @number + +(string) @string +(regex) @string.regex +(escape_sequence) @string.escape + +(comment) @comment @spell + +((program . (comment) @preproc) + (#lua-match? @preproc "^#!/")) + +(ns_qualified_name (namespace) @namespace) +(ns_qualified_name "::" @punctuation.delimiter) + +(func_def name: (_ (identifier) @function) @function) +(func_call name: (_ (identifier) @function) @function) + +(func_def (param_list (identifier) @parameter)) + +[ + "print" + "printf" + "getline" +] @function.builtin + +[ + (delete_statement) + (break_statement) + (continue_statement) + (next_statement) + (nextfile_statement) +] @keyword + +[ + "func" + "function" +] @keyword.function + +[ + "return" + "exit" +] @keyword.return + +[ + "do" + "while" + "for" + "in" +] @repeat + +[ + "if" + "else" + "switch" + "case" + "default" +] @conditional + +[ + "@include" + "@load" +] @include + +"@namespace" @preproc + +[ + "BEGIN" + "END" + "BEGINFILE" + "ENDFILE" +] @label + +(binary_exp [ + "^" + "**" + "*" + "/" + "%" + "+" + "-" + "<" + ">" + "<=" + ">=" + "==" + "!=" + "~" + "!~" + "in" + "&&" + "||" +] @operator) + +(unary_exp [ + "!" + "+" + "-" +] @operator) + +(assignment_exp [ + "=" + "+=" + "-=" + "*=" + "/=" + "%=" + "^=" +] @operator) + +(ternary_exp [ + "?" + ":" +] @conditional.ternary) + +(update_exp [ + "++" + "--" +] @operator) + +(redirected_io_statement [ + ">" + ">>" +] @operator) + +(piped_io_statement [ + "|" + "|&" +] @operator) + +(piped_io_exp [ + "|" + "|&" +] @operator) + +(field_ref "$" @punctuation.delimiter) + +(regex "/" @punctuation.delimiter) +(regex_constant "@" @punctuation.delimiter) + +[ ";" "," ] @punctuation.delimiter + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/awk/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/awk/injections.scm new file mode 100644 index 00000000..bc35c831 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/awk/injections.scm @@ -0,0 +1,5 @@ +((comment) @injection.content + (#set! injection.language "comment")) + +((regex) @injection.content + (#set! injection.language "regex")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bash/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bash/folds.scm new file mode 100644 index 00000000..766dbe59 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bash/folds.scm @@ -0,0 +1,9 @@ +[ + (function_definition) + (if_statement) + (case_statement) + (for_statement) + (while_statement) + (c_style_for_statement) + (heredoc_redirect) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bash/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bash/highlights.scm new file mode 100644 index 00000000..4ffae437 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bash/highlights.scm @@ -0,0 +1,186 @@ +[ + "(" ")" + "{" "}" + "[" "]" + "[[" "]]" + "((" "))" +] @punctuation.bracket + +[ + ";" + ";;" + ";&" + ";;&" + "&" +] @punctuation.delimiter + +[ + ">" + ">>" + "<" + "<<" + "&&" + "|" + "|&" + "||" + "=" + "+=" + "=~" + "==" + "!=" + + "&>" + "&>>" + "<&" + ">&" + ">|" + "<&-" + ">&-" + + "<<-" + "<<<" + + ".." +] @operator + +; Do *not* spell check strings since they typically have some sort of +; interpolation in them, or, are typically used for things like filenames, URLs, +; flags and file content. +[ + (string) + (raw_string) + (ansi_c_string) + (heredoc_body) +] @string + +[ + (heredoc_start) + (heredoc_end) +] @label + +(variable_assignment (word) @string) +(command argument: "$" @string) ; bare dollar + +[ + "if" + "then" + "else" + "elif" + "fi" + "case" + "in" + "esac" +] @conditional + +[ + "for" + "do" + "done" + "select" + "until" + "while" +] @repeat + +[ + "declare" + "typeset" + "export" + "readonly" + "local" + "unset" + "unsetenv" +] @keyword + +"function" @keyword.function + +(special_variable_name) @constant + +; trap -l +((word) @constant.builtin + (#match? @constant.builtin "^SIG(HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR[12]|SEGV|PIPE|ALRM|TERM|STKFLT|CHLD|CONT|STOP|TSTP|TT(IN|OU)|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS|RTMIN([+]([1-9]|1[0-5]))?|RTMAX(-([1-9]|1[0-4]))?)$")) + +((word) @boolean + (#any-of? @boolean "true" "false")) + +(comment) @comment @spell + +(test_operator) @operator + +(command_substitution "$(" @punctuation.bracket) +(process_substitution "<(" @punctuation.bracket) + +(arithmetic_expansion + [ "$((" "((" ] @punctuation.special + "))" @punctuation.special) + +(arithmetic_expansion "," @punctuation.delimiter) + +(ternary_expression [ "?" ":" ] @conditional.ternary) + +(binary_expression operator: _ @operator) +(unary_expression operator: _ @operator) +(postfix_expression operator: _ @operator) + +(function_definition + name: (word) @function) + +(command_name (word) @function.call) + +((command_name (word) @function.builtin) + (#any-of? @function.builtin + "alias" "bg" "bind" "break" "builtin" "caller" "cd" + "command" "compgen" "complete" "compopt" "continue" + "coproc" "dirs" "disown" "echo" "enable" "eval" + "exec" "exit" "fc" "fg" "getopts" "hash" "help" + "history" "jobs" "kill" "let" "logout" "mapfile" + "popd" "printf" "pushd" "pwd" "read" "readarray" + "return" "set" "shift" "shopt" "source" "suspend" + "test" "time" "times" "trap" "type" "typeset" + "ulimit" "umask" "unalias" "wait")) + +(command + argument: [ + (word) @parameter + (concatenation (word) @parameter) + ]) + +(number) @number +((word) @number + (#lua-match? @number "^[0-9]+$")) + +(file_redirect + destination: (word) @parameter) + +(file_descriptor) @operator + +(simple_expansion + "$" @punctuation.special) @none +(expansion + "${" @punctuation.special + "}" @punctuation.special) @none + +(expansion operator: _ @punctuation.special) +(expansion "@" . operator: _ @character.special) + +((expansion + (subscript + index: (word) @character.special)) + (#any-of? @character.special "@" "*")) + +"``" @punctuation.special + +(variable_name) @variable + +((variable_name) @constant + (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) + +(case_item + value: (word) @parameter) + +[ + (regex) + (extglob_pattern) +] @string.regex + +((program . (comment) @preproc) + (#lua-match? @preproc "^#!/")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bash/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bash/injections.scm new file mode 100644 index 00000000..fdb03cda --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bash/injections.scm @@ -0,0 +1,10 @@ +((comment) @injection.content + (#set! injection.language "comment")) + +((regex) @injection.content + (#set! injection.language "regex")) + +((heredoc_redirect + (heredoc_body) @injection.content + (heredoc_end) @injection.language) + (#downcase! @injection.language)) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bash/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bash/locals.scm new file mode 100644 index 00000000..a03bc3a5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bash/locals.scm @@ -0,0 +1,13 @@ +; Scopes +(function_definition) @scope + +; Definitions +(variable_assignment + name: (variable_name) @definition.var) + +(function_definition + name: (word) @definition.function) + +; References +(variable_name) @reference +(word) @reference diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bass/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bass/folds.scm new file mode 100644 index 00000000..d99e0c1a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bass/folds.scm @@ -0,0 +1,5 @@ +[ + (list) + (scope) + (cons) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bass/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bass/highlights.scm new file mode 100644 index 00000000..296443d5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bass/highlights.scm @@ -0,0 +1,109 @@ +;; Variables + +(list (symbol) @variable) + +(cons (symbol) @variable) + +(scope (symbol) @variable) + +(symbind (symbol) @variable) + +;; Constants + +((symbol) @constant + (#lua-match? @constant "^_*[A-Z][A-Z0-9_]*$")) + +;; Functions + +(list + . (symbol) @function) + +;; Namespaces + +(symbind + (symbol) @namespace + . (keyword)) + +;; Includes + +((symbol) @include + (#any-of? @include "use" "import" "load")) + +;; Keywords + +((symbol) @keyword + (#any-of? @keyword "do" "doc")) + +;; Special Functions + +; Keywords construct a symbol + +(keyword) @constructor + +((list + . (symbol) @keyword.function + . (symbol) @function + (symbol)? @parameter) + (#any-of? @keyword.function "def" "defop" "defn" "fn")) + +((cons + . (symbol) @keyword.function + . (symbol) @function + (symbol)? @parameter) + (#any-of? @keyword.function "def" "defop" "defn" "fn")) + +((symbol) @function.builtin + (#any-of? @function.builtin "dump" "mkfs" "json" "log" "error" "now" "cons" "wrap" "unwrap" "eval" "make-scope" "bind" "meta" "with-meta" "null?" "ignore?" "boolean?" "number?" "string?" "symbol?" "scope?" "sink?" "source?" "list?" "pair?" "applicative?" "operative?" "combiner?" "path?" "empty?" "thunk?" "+" "*" "quot" "-" "max" "min" "=" ">" ">=" "<" "<=" "list->source" "across" "emit" "next" "reduce-kv" "assoc" "symbol->string" "string->symbol" "str" "substring" "trim" "scope->list" "string->fs-path" "string->cmd-path" "string->dir" "subpath" "path-name" "path-stem" "with-image" "with-dir" "with-args" "with-cmd" "with-stdin" "with-env" "with-insecure" "with-label" "with-port" "with-tls" "with-mount" "thunk-cmd" "thunk-args" "resolve" "start" "addr" "wait" "read" "cache-dir" "binds?" "recall-memo" "store-memo" "mask" "list" "list*" "first" "rest" "length" "second" "third" "map" "map-pairs" "foldr" "foldl" "append" "filter" "conj" "list->scope" "merge" "apply" "id" "always" "vals" "keys" "memo" "succeeds?" "run" "last" "take" "take-all" "insecure!" "from" "cd" "wrap-cmd" "mkfile" "path-base" "not")) + +((symbol) @function.macro + (#any-of? @function.macro "op" "current-scope" "quote" "let" "provide" "module" "or" "and" "curryfn" "for" "$" "linux")) + +;; Conditionals + +((symbol) @conditional + (#any-of? @conditional "if" "case" "cond" "when")) + +;; Repeats + +((symbol) @repeat + (#any-of? @repeat "each")) + +;; Operators + +((symbol) @operator (#any-of? @operator "&" "*" "+" "-" "<" "<=" "=" ">" ">=")) + +;; Punctuation + +[ "(" ")" ] @punctuation.bracket + +[ "{" "}" ] @punctuation.bracket + +[ "[" "]" ] @punctuation.bracket + +((symbol) @punctuation.delimiter + (#eq? @punctuation.delimiter "->")) + +;; Literals + +(string) @string + +(escape_sequence) @string.escape + +(path) @text.uri @string.special + +(number) @number + +(boolean) @boolean + +[ + (ignore) + (null) +] @constant.builtin + +[ + "^" +] @character.special + +;; Comments + +(comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bass/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bass/indents.scm new file mode 100644 index 00000000..60c5df4e --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bass/indents.scm @@ -0,0 +1,22 @@ +[ + (list) + (scope) + (cons) +] @indent.begin + +[ + ")" + "}" + "]" +] @indent.end + +[ "(" ")" ] @indent.branch + +[ "{" "}" ] @indent.branch + +[ "[" "]" ] @indent.branch + +[ + (ERROR) + (comment) +] @indent.auto diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bass/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bass/injections.scm new file mode 100644 index 00000000..6adae45a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bass/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bass/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bass/locals.scm new file mode 100644 index 00000000..5a94e753 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bass/locals.scm @@ -0,0 +1,25 @@ +; Scopes + +[ + (list) + (scope) + (cons) +] @scope + +; References + +(symbol) @reference + +; Definitions + +((list + . (symbol) @_fnkw + . (symbol) @definition.function + (symbol)? @definition.parameter) + (#any-of? @_fnkw "def" "defop" "defn" "fn")) + +((cons + . (symbol) @_fnkw + . (symbol) @definition.function + (symbol)? @definition.parameter) + (#any-of? @_fnkw "def" "defop" "defn" "fn")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/beancount/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/beancount/folds.scm new file mode 100644 index 00000000..ffe31950 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/beancount/folds.scm @@ -0,0 +1,4 @@ +[ + (transaction) + (section) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/beancount/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/beancount/highlights.scm new file mode 100644 index 00000000..5817fb2e --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/beancount/highlights.scm @@ -0,0 +1,24 @@ +(date) @field +(txn) @attribute +(account) @type +(amount) @number +(incomplete_amount) @number +(compound_amount) @number +(amount_tolerance) @number +(currency) @property +(key) @label +(string) @string +(narration) @string @spell +(payee) @string @spell +(tag) @constant +(link) @constant +[ + (minus) (plus) (slash) (asterisk) +] @operator +(comment) @comment @spell +[ + (balance) (open) (close) (commodity) (pad) + (event) (price) (note) (document) (query) + (custom) (pushtag) (poptag) (pushmeta) + (popmeta) (option) (include) (plugin) +] @keyword diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bibtex/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bibtex/folds.scm new file mode 100644 index 00000000..3b24d5fe --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bibtex/folds.scm @@ -0,0 +1,3 @@ +[ + (entry) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bibtex/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bibtex/highlights.scm new file mode 100644 index 00000000..bd240f58 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bibtex/highlights.scm @@ -0,0 +1,51 @@ +; CREDITS @pfoerster (adapted from https://github.com/latex-lsp/tree-sitter-bibtex) + +[ + (string_type) + (preamble_type) + (entry_type) +] @keyword + +[ + (junk) + (comment) +] @comment + +(comment) @spell + +[ + "=" + "#" +] @operator + +(command) @function.builtin + +(number) @number + +(field + name: (identifier) @field) + +(token + (identifier) @parameter) + +[ + (brace_word) + (quote_word) +] @string + +[ + (key_brace) + (key_paren) +] @symbol + +(string + name: (identifier) @constant) + +[ + "{" + "}" + "(" + ")" +] @punctuation.bracket + +"," @punctuation.delimiter diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bibtex/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bibtex/indents.scm new file mode 100644 index 00000000..1ba3e6b4 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bibtex/indents.scm @@ -0,0 +1,10 @@ +[ + (entry) +] @indent.begin + +[ + "{" + "}" +] @indent.branch + +(comment) @indent.ignore diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bicep/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bicep/folds.scm new file mode 100644 index 00000000..8ec5ba20 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bicep/folds.scm @@ -0,0 +1,25 @@ +[ + (module_declaration) + (metadata_declaration) + (output_declaration) + (parameter_declaration) + (resource_declaration) + (type_declaration) + (variable_declaration) + + (parenthesized_expression) + + (decorators) + (array) + (object) + + (if_statement) + (for_statement) + + (subscript_expression) + (ternary_expression) + + (string) + + (comment) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bicep/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bicep/highlights.scm new file mode 100644 index 00000000..b555edb3 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bicep/highlights.scm @@ -0,0 +1,230 @@ +; Includes + +(import_statement + "import" @include) + +(import_with_statement + "import" @include + "with" @include) + +; Namespaces + +(module_declaration + (identifier) @namespace) + +; Builtins + +(primitive_type) @type.builtin + +((member_expression + object: (identifier) @type.builtin) + (#eq? @type.builtin "sys")) + +; Functions + +(call_expression + function: (identifier) @function.call) + +; Properties + +(object_property + (identifier) @property + ":" @punctuation.delimiter + (_)) + +(object_property + (compatible_identifier) @property + ":" @punctuation.delimiter + (_)) + +(property_identifier) @property + +; Attributes + +(decorator + "@" @attribute) + +(decorator + (call_expression (identifier) @attribute)) + +(decorator + (call_expression + (member_expression + object: (identifier) @attribute + property: (property_identifier) @attribute))) + +; Types + +(type_declaration + (identifier) @type) + +(type_declaration + (identifier) + "=" + (identifier) @type) + +(type_declaration + (identifier) + "=" + (array_type (identifier) @type)) + +(type + (identifier) @type) + +(resource_declaration + (identifier) @type) + +(resource_expression + (identifier) @type) + +; Parameters + +(parameter_declaration + (identifier) @parameter + (_)) + +(call_expression + function: (_) + (arguments (identifier) @parameter)) + +(call_expression + function: (_) + (arguments (member_expression object: (identifier) @parameter))) + +; Variables + +(variable_declaration + (identifier) @variable + (_)) + +(metadata_declaration + (identifier) @variable + (_)) + +(output_declaration + (identifier) @variable + (_)) + +(object_property + (_) + ":" + (identifier) @variable) + +(for_statement + "for" + (for_loop_parameters + (loop_variable) @variable + (loop_enumerator) @variable)) + +; Conditionals + +"if" @conditional + +(ternary_expression + "?" @conditional.ternary + ":" @conditional.ternary) + +; Loops + +(for_statement + "for" @repeat + "in" + ":" @punctuation.delimiter) + +; Keywords + +[ + "module" + "metadata" + "output" + "param" + "resource" + "existing" + "targetScope" + "type" + "var" +] @keyword + +; Operators + +[ + "+" + "-" + "*" + "/" + "%" + "||" + "&&" + "|" + "==" + "!=" + "=~" + "!~" + ">" + ">=" + "<=" + "<" + "??" + "=" + "!" +] @operator + +[ + "in" +] @keyword.operator + + +; Literals + +(string) @string +(import_string + "'" @string + (import_name) @namespace + "@" @symbol + (import_version) @string.special) + +(escape_sequence) @string.escape + +(number) @number + +(boolean) @boolean + +(null) @constant.builtin + +; Misc + +(compatible_identifier + "?" @punctuation.special) + +(nullable_return_type) @punctuation.special + +["{" "}"] @punctuation.bracket + +["[" "]"] @punctuation.bracket + +["(" ")"] @punctuation.bracket + +[ + "." + "::" + "=>" +] @punctuation.delimiter + + +; Interpolation + +(interpolation) @none + +(interpolation + "${" @punctuation.special + "}" @punctuation.special) + +(interpolation + (identifier) @variable) + +; Comments + +[ + (comment) + (diagnostic_comment) +] @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bicep/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bicep/indents.scm new file mode 100644 index 00000000..cf2e6e1c --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bicep/indents.scm @@ -0,0 +1,18 @@ +[ + (array) + (object) +] @indent.begin + +"}" @indent.end + +[ "{" "}" ] @indent.branch + +[ "[" "]" ] @indent.branch + +[ "(" ")" ] @indent.branch + +[ + (ERROR) + (comment) + (diagnostic_comment) +] @indent.auto diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bicep/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bicep/injections.scm new file mode 100644 index 00000000..d3ff30b6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bicep/injections.scm @@ -0,0 +1,5 @@ +([ + (comment) + (diagnostic_comment) + ] @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bicep/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bicep/locals.scm new file mode 100644 index 00000000..361be94f --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bicep/locals.scm @@ -0,0 +1,74 @@ +; Scopes + +[ + (infrastructure) + (call_expression) + + (lambda_expression) + (subscript_expression) + + (if_statement) + (for_statement) + + (array) + (object) + (interpolation) +] @scope + +; References + +(property_identifier) @reference + +(call_expression + (identifier) @reference) + +(object_property + (_) + ":" + (identifier) @reference) + +(resource_expression + (identifier) @reference) + +; Definitions + +(type) @definition.associated + +(object_property + (identifier) @definition.field + (_)) + +(object_property + (compatible_identifier) @definition.field + (_)) + +(import_name) @definition.import + +(module_declaration + (identifier) @definition.namespace) + +(parameter_declaration + (identifier) @definition.parameter + (_)) + +(type_declaration + (identifier) @definition.type + (_)) + +(variable_declaration + (identifier) @definition.var + (_)) + +(metadata_declaration + (identifier) @definition.var + (_)) + +(output_declaration + (identifier) @definition.var + (_)) + +(for_statement + "for" + (for_loop_parameters + (loop_variable) @definition.var + (loop_enumerator) @definition.var)) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bitbake/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bitbake/folds.scm new file mode 100644 index 00000000..9fc865e8 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bitbake/folds.scm @@ -0,0 +1,29 @@ +[ + (function_definition) + (anonymous_python_function) + (python_function_definition) + + (while_statement) + (for_statement) + (if_statement) + (with_statement) + (try_statement) + + (import_from_statement) + (parameters) + (argument_list) + + (parenthesized_expression) + (generator_expression) + (list_comprehension) + (set_comprehension) + (dictionary_comprehension) + + (tuple) + (list) + (set) + (dictionary) + + (string) + (python_string) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bitbake/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bitbake/highlights.scm new file mode 100644 index 00000000..46eaf11e --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bitbake/highlights.scm @@ -0,0 +1,358 @@ +; Includes + +[ + "inherit" + "include" + "require" + "export" + "import" +] @include + +; Keywords + +[ + "unset" + "EXPORT_FUNCTIONS" + "python" + + "assert" + "exec" + "global" + "nonlocal" + "pass" + "print" + "with" + "as" +] @keyword + +[ + "async" + "await" +] @keyword.coroutine + +[ + "return" + "yield" +] @keyword.return +(yield "from" @keyword.return) + +(future_import_statement + "from" @include + "__future__" @constant.builtin) +(import_from_statement "from" @include) +"import" @include + +(aliased_import "as" @include) + +["if" "elif" "else"] @conditional + +["for" "while" "break" "continue"] @repeat + +[ + "try" + "except" + "except*" + "raise" + "finally" +] @exception + +(raise_statement "from" @exception) + +(try_statement + (else_clause + "else" @exception)) + +[ + "addtask" + "deltask" + "addhandler" + "def" + "lambda" +] @keyword.function + +[ + "before" + "after" +] @storageclass + +[ + "append" + "prepend" + "remove" +] @type.qualifier + +; Variables + +[ + (identifier) + (python_identifier) +] @variable + +[ + "noexec" + "INHERIT" + "OVERRIDES" + "$BB_ENV_PASSTHROUGH" + "$BB_ENV_PASSTHROUGH_ADDITIONS" +] @variable.builtin + +; Reset highlighting in f-string interpolations +(interpolation) @none + +;; Identifier naming conventions +((python_identifier) @type + (#lua-match? @type "^[A-Z].*[a-z]")) +([(identifier) (python_identifier)] @constant + (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) + +((python_identifier) @constant.builtin + (#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$")) + +((python_identifier) @constant.builtin + (#any-of? @constant.builtin + ;; https://docs.python.org/3/library/constants.html + "NotImplemented" + "Ellipsis" + "quit" + "exit" + "copyright" + "credits" + "license")) + +((assignment + left: (python_identifier) @type.definition + (type (python_identifier) @_annotation)) + (#eq? @_annotation "TypeAlias")) + +((assignment + left: (python_identifier) @type.definition + right: (call + function: (python_identifier) @_func)) + (#any-of? @_func "TypeVar" "NewType")) + +; Fields + +(flag) @field + +((attribute + attribute: (python_identifier) @field) + (#lua-match? @field "^[%l_].*$")) + +; Functions + +(call + function: (python_identifier) @function.call) + +(call + function: (attribute + attribute: (python_identifier) @method.call)) + +((call + function: (python_identifier) @constructor) + (#lua-match? @constructor "^%u")) + +((call + function: (attribute + attribute: (python_identifier) @constructor)) + (#lua-match? @constructor "^%u")) + +((call + function: (python_identifier) @function.builtin) + (#any-of? @function.builtin + "abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr" "classmethod" + "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" "filter" "float" "format" + "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id" "input" "int" "isinstance" "issubclass" + "iter" "len" "list" "locals" "map" "max" "memoryview" "min" "next" "object" "oct" "open" "ord" "pow" + "print" "property" "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" + "sum" "super" "tuple" "type" "vars" "zip" "__import__")) + +(python_function_definition + name: (python_identifier) @function) + +(type (python_identifier) @type) +(type + (subscript + (python_identifier) @type)) ; type subscript: Tuple[int] + +((call + function: (python_identifier) @_isinstance + arguments: (argument_list + (_) + (python_identifier) @type)) + (#eq? @_isinstance "isinstance")) + +(anonymous_python_function (identifier) @function) + +(function_definition (identifier) @function) + +(addtask_statement (identifier) @function) + +(deltask_statement (identifier) @function) + +(export_functions_statement (identifier) @function) + +(addhandler_statement (identifier) @function) + +(python_function_definition + body: + (block + . (expression_statement (python_string) @string.documentation @spell))) + +; Namespace + +(inherit_path) @namespace + +;; Normal parameters +(parameters + (python_identifier) @parameter) +;; Lambda parameters +(lambda_parameters + (python_identifier) @parameter) +(lambda_parameters + (tuple_pattern + (python_identifier) @parameter)) +; Default parameters +(keyword_argument + name: (python_identifier) @parameter) +; Naming parameters on call-site +(default_parameter + name: (python_identifier) @parameter) +(typed_parameter + (python_identifier) @parameter) +(typed_default_parameter + (python_identifier) @parameter) +; Variadic parameters *args, **kwargs +(parameters + (list_splat_pattern ; *args + (python_identifier) @parameter)) +(parameters + (dictionary_splat_pattern ; **kwargs + (python_identifier) @parameter)) + +;; Literals + +(none) @constant.builtin +[(true) (false)] @boolean +((python_identifier) @variable.builtin + (#eq? @variable.builtin "self")) +((python_identifier) @variable.builtin + (#eq? @variable.builtin "cls")) + +(integer) @number +(float) @float + +; Operators + +[ + "?=" + "??=" + ":=" + "=+" + ".=" + "=." + "-" + "-=" + ":=" + "!=" + "*" + "**" + "**=" + "*=" + "/" + "//" + "//=" + "/=" + "&" + "&=" + "%" + "%=" + "^" + "^=" + "+" + "+=" + "<" + "<<" + "<<=" + "<=" + "<>" + "=" + "==" + ">" + ">=" + ">>" + ">>=" + "@" + "@=" + "|" + "|=" + "~" + "->" +] @operator + +[ + "and" + "in" + "is" + "not" + "or" + "is not" + "not in" + + "del" +] @keyword.operator + +; Literals + +[ + (string) + (python_string) + "\"" +] @string + +(include_path) @string.special + +[ + (escape_sequence) + (escape_interpolation) +] @string.escape + +; Punctuation + +[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket + +[ + ":" + "->" + ";" + "." + "," + (ellipsis) +] @punctuation.delimiter + +(variable_expansion [ "${" "}" ] @punctuation.special) +(inline_python [ "${@" "}" ] @punctuation.special) +(interpolation + "{" @punctuation.special + "}" @punctuation.special) + +(type_conversion) @function.macro + +([(identifier) (python_identifier)] @type.builtin + (#any-of? @type.builtin + ;; https://docs.python.org/3/library/exceptions.html + "BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError" "AttributeError" + "EOFError" "FloatingPointError" "GeneratorExit" "ImportError" "ModuleNotFoundError" "IndexError" "KeyError" + "KeyboardInterrupt" "MemoryError" "NameError" "NotImplementedError" "OSError" "OverflowError" "RecursionError" + "ReferenceError" "RuntimeError" "StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError" + "SystemError" "SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError" "UnicodeDecodeError" + "UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError" "IOError" "WindowsError" + "BlockingIOError" "ChildProcessError" "ConnectionError" "BrokenPipeError" "ConnectionAbortedError" + "ConnectionRefusedError" "ConnectionResetError" "FileExistsError" "FileNotFoundError" "InterruptedError" + "IsADirectoryError" "NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning" + "UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning" "RuntimeWarning" + "FutureWarning" "ImportWarning" "UnicodeWarning" "BytesWarning" "ResourceWarning" + ;; https://docs.python.org/3/library/stdtypes.html + "bool" "int" "float" "complex" "list" "tuple" "range" "str" + "bytes" "bytearray" "memoryview" "set" "frozenset" "dict" "type" "object")) + +(comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bitbake/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bitbake/indents.scm new file mode 100644 index 00000000..01d8aeb3 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bitbake/indents.scm @@ -0,0 +1,127 @@ +[ + (import_from_statement) + + (parenthesized_expression) + (generator_expression) + (list_comprehension) + (set_comprehension) + (dictionary_comprehension) + + (tuple_pattern) + (list_pattern) + (binary_operator) + + (lambda) + + (concatenated_string) +] @indent.begin + +((list) @indent.align + (#set! indent.open_delimiter "[") + (#set! indent.close_delimiter "]") +) +((dictionary) @indent.align + (#set! indent.open_delimiter "{") + (#set! indent.close_delimiter "}") +) +((set) @indent.align + (#set! indent.open_delimiter "{") + (#set! indent.close_delimiter "}") +) + +((for_statement) @indent.begin + (#set! indent.immediate 1)) +((if_statement) @indent.begin + (#set! indent.immediate 1)) +((while_statement) @indent.begin + (#set! indent.immediate 1)) +((try_statement) @indent.begin + (#set! indent.immediate 1)) +(ERROR "try" ":" @indent.begin (#set! indent.immediate 1)) +((python_function_definition) @indent.begin + (#set! indent.immediate 1)) +(function_definition) @indent.begin +(anonymous_python_function) @indent.begin +((with_statement) @indent.begin + (#set! indent.immediate 1)) + +(if_statement + condition: (parenthesized_expression) @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")") + (#set! indent.avoid_last_matching_next 1)) +(while_statement + condition: (parenthesized_expression) @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")") + (#set! indent.avoid_last_matching_next 1)) + +(ERROR "(" @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")") . (_)) +((argument_list) @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) +((parameters) @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")") + (#set! indent.avoid_last_matching_next 1)) +((tuple) @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) + +(ERROR "[" @indent.align (#set! indent.open_delimiter "[") (#set! indent.close_delimiter "]") . (_)) + +(ERROR "{" @indent.align (#set! indent.open_delimiter "{") (#set! indent.close_delimiter "}") . (_)) + +[ + (break_statement) + (continue_statement) +] @indent.dedent + +(ERROR + (_) @indent.branch ":" . + (#lua-match? @indent.branch "^else")) + +(ERROR + (_) @indent.branch @indent.dedent ":" . + (#lua-match? @indent.branch "^elif")) + +(parenthesized_expression ")" @indent.end) +(generator_expression ")" @indent.end) +(list_comprehension "]" @indent.end) +(set_comprehension "}" @indent.end) +(dictionary_comprehension "}" @indent.end) + +(tuple_pattern ")" @indent.end) +(list_pattern "]" @indent.end) + +(function_definition "}" @indent.end) +(anonymous_python_function "}" @indent.end) + +(return_statement + [ + (_) @indent.end + (_ + [ + (_) + ")" + "}" + "]" + ] @indent.end .) + (attribute + attribute: (_) @indent.end) + (call + arguments: (_ ")" @indent.end)) + "return" @indent.end + ] .) + +[ + ")" + "]" + "}" + (elif_clause) + (else_clause) + (except_clause) + (finally_clause) +] @indent.branch + +(string) @indent.auto diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bitbake/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bitbake/injections.scm new file mode 100644 index 00000000..819487bc --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bitbake/injections.scm @@ -0,0 +1,14 @@ +(call + function: (attribute + object: (python_identifier) @_re) + arguments: (argument_list (python_string + (string_content) @injection.content) @_string) + (#eq? @_re "re") + (#lua-match? @_string "^r.*") + (#set! injection.language "regex")) + +((shell_content) @injection.content + (#set! injection.language "bash")) + +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bitbake/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bitbake/locals.scm new file mode 100644 index 00000000..baf835cc --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/bitbake/locals.scm @@ -0,0 +1,99 @@ +; References +[ + (python_identifier) + (identifier) +] @reference + +; Imports +(aliased_import + alias: (python_identifier) @definition.import) +(import_statement + name: (dotted_name ((python_identifier) @definition.import))) +(import_from_statement + name: (dotted_name ((python_identifier) @definition.import))) + +; Function with parameters, defines parameters +(parameters + (python_identifier) @definition.parameter) + +(default_parameter + (python_identifier) @definition.parameter) + +(typed_parameter + (python_identifier) @definition.parameter) + +(typed_default_parameter + (python_identifier) @definition.parameter) + +; *args parameter +(parameters + (list_splat_pattern + (python_identifier) @definition.parameter)) + +; **kwargs parameter +(parameters + (dictionary_splat_pattern + (python_identifier) @definition.parameter)) + +; Function defines function and scope +((python_function_definition + name: (python_identifier) @definition.function) @scope + (#set! definition.function.scope "parent")) + +(function_definition (identifier) @definition.function) + +(anonymous_python_function (identifier) @definition.function) + +;;; Loops +; not a scope! +(for_statement + left: (pattern_list + (python_identifier) @definition.var)) +(for_statement + left: (tuple_pattern + (python_identifier) @definition.var)) +(for_statement + left: (python_identifier) @definition.var) + +; not a scope! +;(while_statement) @scope + +; for in list comprehension +(for_in_clause + left: (python_identifier) @definition.var) +(for_in_clause + left: (tuple_pattern + (python_identifier) @definition.var)) +(for_in_clause + left: (pattern_list + (python_identifier) @definition.var)) + +(dictionary_comprehension) @scope +(list_comprehension) @scope +(set_comprehension) @scope + +;;; Assignments + +(assignment + left: (python_identifier) @definition.var) + +(assignment + left: (pattern_list + (python_identifier) @definition.var)) +(assignment + left: (tuple_pattern + (python_identifier) @definition.var)) + +(assignment + left: (attribute + (python_identifier) + (python_identifier) @definition.field)) + +(variable_assignment (identifier) operator: [ "=" "?=" "??=" ":=" ] @definition.var) + +; Walrus operator x := 1 +(named_expression + (python_identifier) @definition.var) + +(as_pattern + alias: (as_pattern_target) @definition.var) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/blueprint/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/blueprint/highlights.scm new file mode 100644 index 00000000..d85986ff --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/blueprint/highlights.scm @@ -0,0 +1,57 @@ +(object_id) @variable + +(string) @string +(escape_sequence) @string.escape + +(comment) @comment @spell + +(constant) @constant.builtin + +(boolean) @boolean + +(using) @include + +(template) @keyword + +(decorator) @attribute + +(property_definition (property_name) @property) + +(object) @type + +(signal_binding (signal_name) @function.builtin) +(signal_binding (function (identifier)) @function) +(signal_binding "swapped" @keyword) + +(styles_list "styles" @function.macro) +(layout_definition "layout" @function.macro) + +(gettext_string "_" @function.builtin) + +(menu_definition "menu" @keyword) +(menu_section "section" @keyword) +(menu_item "item" @function.macro) + +(template_definition (template_name_qualifier) @type.qualifier) + +(import_statement (gobject_library) @namespace) + +(import_statement (version_number) @float) + +(float) @float +(number) @number + +[ + ";" + "." + "," +] @punctuation.delimiter + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c/folds.scm new file mode 100644 index 00000000..42ca3fb6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c/folds.scm @@ -0,0 +1,22 @@ +[ + (for_statement) + (if_statement) + (while_statement) + (do_statement) + (switch_statement) + (case_statement) + (function_definition) + (struct_specifier) + (enum_specifier) + (comment) + (preproc_if) + (preproc_elif) + (preproc_else) + (preproc_ifdef) + (preproc_function_def) + (initializer_list) + (gnu_asm_expression) +] @fold + +(compound_statement + (compound_statement) @fold) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c/highlights.scm new file mode 100644 index 00000000..74656e33 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c/highlights.scm @@ -0,0 +1,284 @@ +; Lower priority to prefer @parameter when identifier appears in parameter_declaration. +((identifier) @variable (#set! "priority" 95)) +(preproc_def (preproc_arg) @variable) + +[ + "default" + "enum" + "struct" + "typedef" + "union" + "goto" + "asm" + "__asm__" +] @keyword + +[ + "sizeof" + "offsetof" +] @keyword.operator +(alignof_expression . _ @keyword.operator) + +"return" @keyword.return + +[ + "while" + "for" + "do" + "continue" + "break" +] @repeat + +[ + "if" + "else" + "case" + "switch" +] @conditional + +[ + "#if" + "#ifdef" + "#ifndef" + "#else" + "#elif" + "#endif" + "#elifdef" + "#elifndef" + (preproc_directive) +] @preproc + +"#define" @define + +"#include" @include + +[ ";" ":" "," "::" ] @punctuation.delimiter + +"..." @punctuation.special + +[ "(" ")" "[" "]" "{" "}"] @punctuation.bracket + +[ + "=" + + "-" + "*" + "/" + "+" + "%" + + "~" + "|" + "&" + "^" + "<<" + ">>" + + "->" + "." + + "<" + "<=" + ">=" + ">" + "==" + "!=" + + "!" + "&&" + "||" + + "-=" + "+=" + "*=" + "/=" + "%=" + "|=" + "&=" + "^=" + ">>=" + "<<=" + "--" + "++" +] @operator + +;; Make sure the comma operator is given a highlight group after the comma +;; punctuator so the operator is highlighted properly. +(comma_expression [ "," ] @operator) + +[ + (true) + (false) +] @boolean + +(conditional_expression [ "?" ":" ] @conditional.ternary) + +(string_literal) @string +(system_lib_string) @string +(escape_sequence) @string.escape + +(null) @constant.builtin +(number_literal) @number +(char_literal) @character + +((preproc_arg) @function.macro (#set! "priority" 90)) +(preproc_defined) @function.macro + +(((field_expression + (field_identifier) @property)) @_parent + (#not-has-parent? @_parent template_method function_declarator call_expression)) + +(field_designator) @property +(((field_identifier) @property) + (#has-ancestor? @property field_declaration) + (#not-has-ancestor? @property function_declarator)) + +(statement_identifier) @label + +[ + (type_identifier) + (type_descriptor) +] @type + +(storage_class_specifier) @storageclass + +[ + (type_qualifier) + (gnu_asm_qualifier) + "__extension__" +] @type.qualifier + +(linkage_specification + "extern" @storageclass) + +(type_definition + declarator: (type_identifier) @type.definition) + +(primitive_type) @type.builtin + +(sized_type_specifier _ @type.builtin type: _?) + +((identifier) @constant + (#lua-match? @constant "^[A-Z][A-Z0-9_]+$")) +(preproc_def (preproc_arg) @constant + (#lua-match? @constant "^[A-Z][A-Z0-9_]+$")) +(enumerator + name: (identifier) @constant) +(case_statement + value: (identifier) @constant) + +((identifier) @constant.builtin + (#any-of? @constant.builtin + "stderr" "stdin" "stdout" + "__FILE__" "__LINE__" "__DATE__" "__TIME__" + "__STDC__" "__STDC_VERSION__" "__STDC_HOSTED__" + "__cplusplus" "__OBJC__" "__ASSEMBLER__" + "__BASE_FILE__" "__FILE_NAME__" "__INCLUDE_LEVEL__" + "__TIMESTAMP__" "__clang__" "__clang_major__" + "__clang_minor__" "__clang_patchlevel__" + "__clang_version__" "__clang_literal_encoding__" + "__clang_wide_literal_encoding__" + "__FUNCTION__" "__func__" "__PRETTY_FUNCTION__" + "__VA_ARGS__" "__VA_OPT__")) +(preproc_def (preproc_arg) @constant.builtin + (#any-of? @constant.builtin + "stderr" "stdin" "stdout" + "__FILE__" "__LINE__" "__DATE__" "__TIME__" + "__STDC__" "__STDC_VERSION__" "__STDC_HOSTED__" + "__cplusplus" "__OBJC__" "__ASSEMBLER__" + "__BASE_FILE__" "__FILE_NAME__" "__INCLUDE_LEVEL__" + "__TIMESTAMP__" "__clang__" "__clang_major__" + "__clang_minor__" "__clang_patchlevel__" + "__clang_version__" "__clang_literal_encoding__" + "__clang_wide_literal_encoding__" + "__FUNCTION__" "__func__" "__PRETTY_FUNCTION__" + "__VA_ARGS__" "__VA_OPT__")) + +(attribute_specifier + (argument_list (identifier) @variable.builtin)) +((attribute_specifier + (argument_list (call_expression + function: (identifier) @variable.builtin)))) + +((call_expression + function: (identifier) @function.builtin) + (#lua-match? @function.builtin "^__builtin_")) +((call_expression + function: (identifier) @function.builtin) + (#has-ancestor? @function.builtin attribute_specifier)) + +;; Preproc def / undef +(preproc_def + name: (_) @constant) +(preproc_call + directive: (preproc_directive) @_u + argument: (_) @constant + (#eq? @_u "#undef")) + +(call_expression + function: (identifier) @function.call) +(call_expression + function: (field_expression + field: (field_identifier) @function.call)) +(function_declarator + declarator: (identifier) @function) +(function_declarator + declarator: (parenthesized_declarator + (pointer_declarator + declarator: (field_identifier) @function))) +(preproc_function_def + name: (identifier) @function.macro) + +(comment) @comment @spell + +((comment) @comment.documentation + (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$")) + +;; Parameters +(parameter_declaration + declarator: (identifier) @parameter) + +(parameter_declaration + declarator: (array_declarator) @parameter) + +(parameter_declaration + declarator: (pointer_declarator) @parameter) + +; K&R functions +; To enable support for K&R functions, +; add the following lines to your own query config and uncomment them. +; They are commented out as they'll conflict with C++ +; Note that you'll need to have `; extends` at the top of your query file. +; +; (parameter_list (identifier) @parameter) +; +; (function_definition +; declarator: _ +; (declaration +; declarator: (identifier) @parameter)) +; +; (function_definition +; declarator: _ +; (declaration +; declarator: (array_declarator) @parameter)) +; +; (function_definition +; declarator: _ +; (declaration +; declarator: (pointer_declarator) @parameter)) + +(preproc_params (identifier) @parameter) + +[ + "__attribute__" + "__declspec" + "__based" + "__cdecl" + "__clrcall" + "__stdcall" + "__fastcall" + "__thiscall" + "__vectorcall" + (ms_pointer_modifier) + (attribute_declaration) +] @attribute diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c/indents.scm new file mode 100644 index 00000000..cf4c8fa6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c/indents.scm @@ -0,0 +1,90 @@ +[ + (compound_statement) + (field_declaration_list) + (case_statement) + (enumerator_list) + (compound_literal_expression) + (initializer_list) + (init_declarator) +] @indent.begin + +; With current indent logic, if we capture expression_statement with @indent.begin +; It will be affected by _parent_ node with error subnodes deep down the tree +; So narrow indent capture to check for error inside expression statement only, +(expression_statement + (_) @indent.begin + ";" @indent.end) + +(ERROR + "for" "(" @indent.begin ";" ";" ")" @indent.end) + +((for_statement + body: (_) @_body) @indent.begin + (#not-has-type? @_body compound_statement)) + +(while_statement + condition: (_) @indent.begin) + +((while_statement + body: (_) @_body) @indent.begin + (#not-has-type? @_body compound_statement)) + +( + (if_statement) + . + (ERROR "else" @indent.begin)) + +(if_statement + condition: (_) @indent.begin) + +;; Supports if without braces (but not both if-else without braces) +((if_statement + consequence: + (_ ";" @indent.end) @_consequence + (#not-has-type? @_consequence compound_statement) + alternative: + (else_clause + "else" @indent.branch + [ + (if_statement (compound_statement) @indent.dedent)? @indent.dedent + (compound_statement)? @indent.dedent + (_)? @indent.dedent + ] + )? + ) @indent.begin) + +(else_clause (_ . "{" @indent.branch)) + + +(compound_statement "}" @indent.end) + +[ + ")" + "}" + (statement_identifier) +] @indent.branch + +[ + "#define" + "#ifdef" + "#ifndef" + "#elif" + "#if" + "#else" + "#endif" +] @indent.zero + +[ + (preproc_arg) + (string_literal) +] @indent.ignore + +((ERROR (parameter_declaration)) @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) +([(argument_list) (parameter_list)] @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) + +(comment) @indent.auto + diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c/injections.scm new file mode 100644 index 00000000..6b1fc352 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c/injections.scm @@ -0,0 +1,19 @@ +((preproc_arg) @injection.content + (#set! injection.language "c")) + +((comment) @injection.content + (#set! injection.language "comment")) + +((comment) @injection.content + (#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c") + (#set! injection.language "re2c")) + +((comment) @injection.content + (#lua-match? @injection.content "/[*][!<*][^a-zA-Z]") + (#set! injection.language "doxygen")) + +; TODO: add when asm is added +; (gnu_asm_expression assembly_code: (string_literal) @injection.content +; (#set! injection.language "asm")) +; (gnu_asm_expression assembly_code: (concatenated_string (string_literal) @injection.content) +; (#set! injection.language "asm")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c/locals.scm new file mode 100644 index 00000000..b59f8f37 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c/locals.scm @@ -0,0 +1,53 @@ +;; Functions definitions +(function_declarator + declarator: (identifier) @definition.function) +(preproc_function_def + name: (identifier) @definition.macro) @scope + +(preproc_def + name: (identifier) @definition.macro) +(pointer_declarator + declarator: (identifier) @definition.var) +(parameter_declaration + declarator: (identifier) @definition.parameter) +(init_declarator + declarator: (identifier) @definition.var) +(array_declarator + declarator: (identifier) @definition.var) +(declaration + declarator: (identifier) @definition.var) +(enum_specifier + name: (_) @definition.type + (enumerator_list + (enumerator name: (identifier) @definition.var))) + +;; Type / Struct / Enum +(field_declaration + declarator: (field_identifier) @definition.field) +(type_definition + declarator: (type_identifier) @definition.type) +(struct_specifier + name: (type_identifier) @definition.type) + +;; goto +(labeled_statement (statement_identifier) @definition) + +;; References +(identifier) @reference +((field_identifier) @reference + (#set! reference.kind "field")) +((type_identifier) @reference + (#set! reference.kind "type")) + +(goto_statement (statement_identifier) @reference) + +;; Scope +[ + (for_statement) + (if_statement) + (while_statement) + (translation_unit) + (function_definition) + (compound_statement) ; a block in curly braces + (struct_specifier) +] @scope diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c_sharp/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c_sharp/folds.scm new file mode 100644 index 00000000..4b5d9427 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c_sharp/folds.scm @@ -0,0 +1,15 @@ +body: [ + (declaration_list) + (switch_body) + (enum_member_declaration_list) +] @fold + +accessors: [ + (accessor_list) +] @fold + +initializer: [ + (initializer_expression) +] @fold + +(block) @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c_sharp/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c_sharp/highlights.scm new file mode 100644 index 00000000..c67d29eb --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c_sharp/highlights.scm @@ -0,0 +1,416 @@ +(identifier) @variable + +((identifier) @keyword + (#eq? @keyword "value") + (#has-ancestor? @keyword accessor_declaration)) + +(method_declaration + name: (identifier) @method) + +(local_function_statement + name: (identifier) @method) + +(method_declaration + type: (identifier) @type) + +(local_function_statement + type: (identifier) @type) + +(interpolation) @none + +(invocation_expression + (member_access_expression + name: (identifier) @method.call)) + +(invocation_expression + function: (conditional_access_expression + (member_binding_expression + name: (identifier) @method.call))) + +(namespace_declaration + name: [(qualified_name) (identifier)] @namespace) + +(qualified_name + (identifier) @type) + +(invocation_expression + (identifier) @method.call) + +(field_declaration + (variable_declaration + (variable_declarator + (identifier) @field))) + +(initializer_expression + (assignment_expression + left: (identifier) @field)) + +(parameter_list + (parameter + name: (identifier) @parameter)) + +(parameter_list + (parameter + type: (identifier) @type)) + +(integer_literal) @number +(real_literal) @float + +(null_literal) @constant.builtin +(character_literal) @character + +[ + (string_literal) + (verbatim_string_literal) + (interpolated_string_expression) +] @string + +(boolean_literal) @boolean + +[ + (predefined_type) +] @type.builtin + +(implicit_type) @keyword + +(comment) @comment @spell + +((comment) @comment.documentation + (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$")) + +((comment) @comment.documentation + (#lua-match? @comment.documentation "^///[^/]")) +((comment) @comment.documentation + (#lua-match? @comment.documentation "^///$")) + +(using_directive + (identifier) @type) + +(using_directive + (name_equals (identifier) @type.definition)) + +(property_declaration + name: (identifier) @property) + +(property_declaration + type: (identifier) @type) + +(nullable_type + (identifier) @type) + +(catch_declaration + type: (identifier) @type) + +(interface_declaration + name: (identifier) @type) +(class_declaration + name: (identifier) @type) +(record_declaration + name: (identifier) @type) +(enum_declaration + name: (identifier) @type) +(constructor_declaration + name: (identifier) @constructor) +(constructor_initializer [ + "base" @constructor +]) + +(variable_declaration + (identifier) @type) +(object_creation_expression + (identifier) @type) + +; Generic Types. +(type_of_expression + (generic_name + (identifier) @type)) + +(type_argument_list + (generic_name + (identifier) @type)) + +(base_list + (generic_name + (identifier) @type)) + +(type_constraint + (generic_name + (identifier) @type)) + +(object_creation_expression + (generic_name + (identifier) @type)) + +(property_declaration + (generic_name + (identifier) @type)) + +(_ + type: (generic_name + (identifier) @type)) +; Generic Method invocation with generic type +(invocation_expression + function: (generic_name + . (identifier) @method.call)) + +(invocation_expression + (member_access_expression + (generic_name + (identifier) @method))) + +(base_list + (identifier) @type) + +(type_argument_list + (identifier) @type) + +(type_parameter_list + (type_parameter) @type) + +(type_parameter_constraints_clause + target: (identifier) @type) + +(attribute + name: (identifier) @attribute) + +(for_each_statement + type: (identifier) @type) + +(tuple_element + type: (identifier) @type) + +(tuple_expression + (argument + (declaration_expression + type: (identifier) @type))) + +(as_expression + right: (identifier) @type) + +(type_of_expression + (identifier) @type) + +(name_colon + (identifier) @parameter) + +(warning_directive) @text.warning +(error_directive) @exception + +(define_directive + (identifier) @constant) @constant.macro +(undef_directive + (identifier) @constant) @constant.macro + +(line_directive) @constant.macro +(line_directive + (preproc_integer_literal) @constant + (preproc_string_literal)? @string) + +(pragma_directive + (identifier) @constant) @constant.macro +(pragma_directive + (preproc_string_literal) @string) @constant.macro + +[ + (nullable_directive) + (region_directive) + (endregion_directive) +] @constant.macro + +[ + "if" + "else" + "switch" + "break" + "case" + "when" + (if_directive) + (elif_directive) + (else_directive) + (endif_directive) +] @conditional + +(if_directive + (identifier) @constant) +(elif_directive + (identifier) @constant) + +[ + "while" + "for" + "do" + "continue" + "goto" + "foreach" +] @repeat + +[ + "try" + "catch" + "throw" + "finally" +] @exception + +[ + "+" + "?" + ":" + "++" + "-" + "--" + "&" + "&&" + "|" + "||" + "!" + "!=" + "==" + "*" + "/" + "%" + "<" + "<=" + ">" + ">=" + "=" + "-=" + "+=" + "*=" + "/=" + "%=" + "^" + "^=" + "&=" + "|=" + "~" + ">>" + ">>>" + "<<" + "<<=" + ">>=" + ">>>=" + "=>" + "??" + "??=" +] @operator + +[ + ";" + "." + "," + ":" +] @punctuation.delimiter + +(conditional_expression ["?" ":"] @conditional.ternary) + +[ + "[" + "]" + "{" + "}" + "(" + ")" +] @punctuation.bracket + +(type_argument_list ["<" ">"] @punctuation.bracket) + +[ + (this_expression) + (base_expression) +] @variable.builtin + +[ + "using" + "as" +] @include + +(alias_qualified_name + (identifier "global") @include) + +[ + "with" + "new" + "typeof" + "sizeof" + "is" + "and" + "or" + "not" + "stackalloc" + "in" + "out" + "ref" +] @keyword.operator + +[ + "lock" + "params" + "operator" + "default" + "implicit" + "explicit" + "override" + "class" + "delegate" + "enum" + "interface" + "namespace" + "struct" + "get" + "set" + "init" + "where" + "record" + "event" + "add" + "remove" + "checked" + "unchecked" + "fixed" + "alias" +] @keyword + +[ + "async" + "await" +] @keyword.coroutine + +[ + "const" + "extern" + "readonly" + "static" + "volatile" + "required" +] @storageclass + +[ + "abstract" + "private" + "protected" + "internal" + "public" + "partial" + "sealed" + "virtual" +] @type.qualifier + +(parameter_modifier) @operator + +(query_expression + (_ [ + "from" + "orderby" + "select" + "group" + "by" + "ascending" + "descending" + "equals" + "let" + ] @keyword)) + +[ + "return" + "yield" +] @keyword.return diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c_sharp/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c_sharp/injections.scm new file mode 100644 index 00000000..6adae45a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c_sharp/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c_sharp/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c_sharp/locals.scm new file mode 100644 index 00000000..c53eb1a1 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/c_sharp/locals.scm @@ -0,0 +1,41 @@ +;; Definitions +(variable_declarator + . (identifier) @definition.var) + +(variable_declarator + (tuple_pattern + (identifier) @definition.var)) + +(declaration_expression + name: (identifier) @definition.var) + +(for_each_statement + left: (identifier) @definition.var) + +(for_each_statement + left: (tuple_pattern + (identifier) @definition.var)) + +(parameter + (identifier) @definition.parameter) + +(method_declaration + name: (identifier) @definition.method) + +(local_function_statement + name: (identifier) @definition.method) + +(property_declaration + name: (identifier) @definition) + +(type_parameter + (identifier) @definition.type) + +(class_declaration + name: (identifier) @definition) + +;; References +(identifier) @reference + +;; Scope +(block) @scope diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cairo/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cairo/folds.scm new file mode 100644 index 00000000..1c7af9fc --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cairo/folds.scm @@ -0,0 +1,31 @@ +[ + (mod_item) + (struct_item) + (trait_item) + (enum_item) + (impl_item) + (type_item) + + (use_declaration) + (let_declaration) + (namespace_definition) + + (arguments) + (implicit_arguments) + (tuple_type) + + (import_statement) + (attribute_statement) + (with_statement) + (if_statement) + + (function_definition) + (struct_definition) + (loop_expression) + (if_expression) + (match_expression) + (call_expression) + (tuple_expression) + + (attribute_item) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cairo/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cairo/highlights.scm new file mode 100644 index 00000000..715644fc --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cairo/highlights.scm @@ -0,0 +1,334 @@ +; Preproc + +[ + "%builtins" + "%lang" +] @preproc + +; Includes + +(import_statement [ "from" "import" ] @include module_name: (dotted_name (identifier) @namespace . )) + +[ + "as" + "use" + "mod" +] @include + +; Variables + +(identifier) @variable + +; Namespaces + +(namespace_definition (identifier) @namespace) + +(mod_item + name: (identifier) @namespace) + +(use_list (self) @namespace) + +(scoped_use_list (self) @namespace) + +(scoped_identifier + path: (identifier) @namespace) + +(scoped_identifier + (scoped_identifier + name: (identifier) @namespace)) + +(scoped_type_identifier + path: (identifier) @namespace) + +((scoped_identifier + path: (identifier) @type) + (#lua-match? @type "^[A-Z]")) + +((scoped_identifier + name: (identifier) @type) + (#lua-match? @type "^[A-Z]")) + +((scoped_identifier + name: (identifier) @constant) + (#lua-match? @constant "^[A-Z][A-Z%d_]*$")) + +((scoped_identifier + path: (identifier) @type + name: (identifier) @constant) + (#lua-match? @type "^[A-Z]") + (#lua-match? @constant "^[A-Z]")) + +((scoped_type_identifier + path: (identifier) @type + name: (type_identifier) @constant) + (#lua-match? @type "^[A-Z]") + (#lua-match? @constant "^[A-Z]")) + +(scoped_use_list + path: (identifier) @namespace) + +(scoped_use_list + path: (scoped_identifier + (identifier) @namespace)) + +(use_list (scoped_identifier (identifier) @namespace . (_))) + +(use_list (identifier) @type (#lua-match? @type "^[A-Z]")) + +(use_as_clause alias: (identifier) @type (#lua-match? @type "^[A-Z]")) + +; Keywords + +[ + ; 0.x + "using" + "namespace" + "struct" + "let" + "const" + "local" + "rel" + "abs" + "dw" + "alloc_locals" + (inst_ret) + "with_attr" + "with" + "call" + "nondet" + + ; 1.0 + "type" + "impl" + "implicits" + "of" + "ref" + "mut" + "trait" + "enum" +] @keyword + +[ + "func" + "fn" + "end" +] @keyword.function + +"return" @keyword.return + +[ + "cast" + "new" + "and" +] @keyword.operator + +[ + "tempvar" + "extern" +] @storageclass + +[ + "if" + "else" + "match" +] @conditional + +[ + "loop" +] @repeat + +[ + "assert" + "static_assert" + "nopanic" +] @exception + +; Fields + +(implicit_arguments (typed_identifier (identifier) @field)) + +(member_expression "." (identifier) @field) + +(call_expression (assignment_expression left: (identifier) @field)) + +(tuple_expression (assignment_expression left: (identifier) @field)) + +(field_identifier) @field + +(shorthand_field_initializer (identifier) @field) + +; Parameters + +(arguments (typed_identifier (identifier) @parameter)) + +(call_expression (tuple_expression (assignment_expression left: (identifier) @parameter))) + +(return_type (tuple_type (named_type . (identifier) @parameter))) + +(parameter (identifier) @parameter) + +; Builtins + +(builtin_directive (identifier) @variable.builtin) +(lang_directive (identifier) @variable.builtin) + +[ + "ap" + "fp" + (self) +] @variable.builtin + +; Functions + +(function_definition "func" (identifier) @function) +(function_definition "fn" (identifier) @function) +(function_signature "fn" (identifier) @function) +(extern_function_statement (identifier) @function) + +(call_expression + function: (identifier) @function.call) + +(call_expression + function: (scoped_identifier + (identifier) @function.call .)) + +(call_expression + function: (field_expression + field: (field_identifier) @function.call)) + +[ + "jmp" +] @function.builtin + +; Types + +(struct_definition . (identifier) @type (typed_identifier (identifier) @field)?) + +(named_type (identifier) @type .) + +[ + (builtin_type) + (primitive_type) +] @type.builtin + +((identifier) @type + (#lua-match? @type "^[A-Z][a-zA-Z0-9_]*$")) + +(type_identifier) @type + +; Constants + +((identifier) @constant + (#lua-match? @constant "^[A-Z_][A-Z0-9_]*$")) + +(enum_variant + name: (identifier) @constant) + +(call_expression + function: (scoped_identifier + "::" + name: (identifier) @constant) + (#lua-match? @constant "^[A-Z]")) + +((match_arm + pattern: (match_pattern (identifier) @constant)) + (#lua-match? @constant "^[A-Z]")) + +((match_arm + pattern: (match_pattern + (scoped_identifier + name: (identifier) @constant))) + (#lua-match? @constant "^[A-Z]")) + +((identifier) @constant.builtin + (#any-of? @constant.builtin "Some" "None" "Ok" "Err")) + +; Constructors + +(unary_expression "new" (call_expression . (identifier) @constructor)) + +((call_expression . (identifier) @constructor) + (#lua-match? @constructor "^%u")) + +; Attributes + +(decorator "@" @attribute (identifier) @attribute) + +(attribute_item (identifier) @function.macro) + +(attribute_item (scoped_identifier (identifier) @function.macro .)) + +; Labels + +(label . (identifier) @label) + +(inst_jmp_to_label "jmp" . (identifier) @label) + +(inst_jnz_to_label "jmp" . (identifier) @label) + +; Operators + +[ + "+" + "-" + "*" + "/" + "**" + "==" + "!=" + "&" + "=" + "++" + "+=" + "@" + "!" + "~" + ".." + "&&" + "||" + "^" + "<" + "<=" + ">" + ">=" + "<<" + ">>" + "%" + "-=" + "*=" + "/=" + "%=" + "&=" + "|=" + "^=" + "<<=" + ">>=" + "?" +] @operator + +; Literals + +(number) @number + +(boolean) @boolean + +[ + (string) + (short_string) +] @string + +; Punctuation + +(attribute_item "#" @punctuation.special) + +[ "." "," ":" ";" "->" "=>" "::" ] @punctuation.delimiter + +[ "{" "}" "(" ")" "[" "]" "%{" "%}" ] @punctuation.bracket + +(type_parameters [ "<" ">" ] @punctuation.bracket) + +(type_arguments [ "<" ">" ] @punctuation.bracket) + +; Comment + +(comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cairo/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cairo/indents.scm new file mode 100644 index 00000000..76a22e70 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cairo/indents.scm @@ -0,0 +1,45 @@ +[ + (mod_item) + (struct_item) + (enum_item) + (impl_item) + (struct_expression) + (match_expression) + (tuple_expression) + (match_arm) + (match_block) + (call_expression) + (assignment_expression) + (arguments) + (block) + (use_list) + (field_declaration_list) + (enum_variant_list) + (tuple_pattern) +] @indent.begin + +(import_statement "(") @indent.begin + +(block "}" @indent.end) +(enum_item + body: (enum_variant_list "}" @indent.end)) +(match_expression + body: (match_block "}" @indent.end)) +(mod_item + body: (declaration_list "}" @indent.end)) +(struct_item + body: (field_declaration_list "}" @indent.end)) +(trait_item + body: (declaration_list "}" @indent.end)) + +[ + ")" + "]" + "}" +] @indent.branch + +[ + (comment) + (string) + (short_string) +] @indent.ignore diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cairo/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cairo/injections.scm new file mode 100644 index 00000000..675a81a7 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cairo/injections.scm @@ -0,0 +1,3 @@ +(python_code) @python + +(comment) @comment diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cairo/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cairo/locals.scm new file mode 100644 index 00000000..53b33c01 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cairo/locals.scm @@ -0,0 +1,68 @@ +; References + +(identifier) @reference +((type_identifier) @reference + (#set! reference.kind "type")) +((field_identifier) @reference + (#set! reference.kind "field")) + +; Scopes + +[ + (program) + (block) + (function_definition) + (loop_expression) + (if_expression) + (match_expression) + (match_arm) + + (struct_item) + (enum_item) + (impl_item) +] @scope + +(use_declaration + argument: (scoped_identifier + name: (identifier) @definition.import)) + +(use_as_clause + alias: (identifier) @definition.import) + +(use_list + (identifier) @definition.import) ; use std::process::{Child, Command, Stdio}; + +; Functions + +(function_definition + (identifier) @definition.function) + +(function_definition + (identifier) @definition.method + (parameter (self))) + +; Function with parameters, defines parameters + +(parameter + [ (identifier) (self) ] @definition.parameter) + +; Types + +(struct_item + name: (type_identifier) @definition.type) + +(constrained_type_parameter + left: (type_identifier) @definition.type) ; the P in remove_file>(path: P) + +(enum_item + name: (type_identifier) @definition.type) + +; Module + +(mod_item + name: (identifier) @definition.namespace) + +; Variables + +(assignment_expression + left: (identifier) @definition.var) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/capnp/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/capnp/folds.scm new file mode 100644 index 00000000..6e3f9c18 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/capnp/folds.scm @@ -0,0 +1,14 @@ +[ + (annotation_targets) + (const_list) + (enum) + (interface) + (implicit_generics) + (generics) + (group) + (method_parameters) + (named_return_types) + (struct) + (struct_shorthand) + (union) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/capnp/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/capnp/highlights.scm new file mode 100644 index 00000000..f3954ae8 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/capnp/highlights.scm @@ -0,0 +1,150 @@ +; Preproc + +[ + (unique_id) + (top_level_annotation_body) +] @preproc + +; Includes + +[ + "import" + "$import" + "embed" + "using" +] @include + +(import_path) @string @text.uri + +; Keywords + +[ + "annotation" + "enum" + "group" + "interface" + "struct" + "union" + "extends" + "namespace" +] @keyword + +; Builtins + +[ + "const" +] @type.qualifier + +[ + (primitive_type) + "List" +] @type.builtin + +; Typedefs + +(type_definition) @type.definition + +; Labels (@number, @number!) + +(field_version) @label + +; Methods + +[ + (annotation_definition_identifier) + (method_identifier) +] @method + +; Fields + +(field_identifier) @field + +; Properties + +(property) @property + +; Parameters + +[ + (param_identifier) + (return_identifier) +] @parameter + +(annotation_target) @parameter.builtin + +; Constants + +[ + (const_identifier) + (local_const) + (enum_member) +] @constant + +(void) @constant.builtin + +; Types + +[ + (enum_identifier) + (extend_type) + (type_identifier) +] @type + +; Attributes + +[ + (annotation_identifier) + (attribute) +] @attribute + +; Operators + +"=" @operator + +; Literals + +[ + (string) + (concatenated_string) + (block_text) + (namespace) +] @string + +(namespace) @text.underline + +(escape_sequence) @string.escape + +(data_string) @string.special + +(number) @number + +(float) @float + +(boolean) @boolean + +(data_hex) @symbol + +; Punctuation + +[ + "*" + "$" + ":" +] @punctuation.special + +["{" "}"] @punctuation.bracket + +["(" ")"] @punctuation.bracket + +["[" "]"] @punctuation.bracket + +[ + "." + "," + ";" + "->" +] @punctuation.delimiter + +; Comments + +(comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/capnp/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/capnp/indents.scm new file mode 100644 index 00000000..bc7979ae --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/capnp/indents.scm @@ -0,0 +1,38 @@ +[ + (annotation_targets) + (const) + (enum) + (interface) + (implicit_generics) + (generics) + (group) + (method_parameters) + (named_return_types) + (struct) + (union) + (field) +] @indent.begin + +((struct_shorthand (property)) @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) + +((method (field_version)) @indent.align + (#set! indent.open_delimiter field_version)) + +((const_list (const_value)) @indent.align + (#set! indent.open_delimiter "[") + (#set! indent.close_delimiter "]")) + +(concatenated_string) @indent.align + +[ + "}" + ")" +] @indent.end @indent.branch + + +[ + (ERROR) + (comment) +] @indent.auto diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/capnp/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/capnp/injections.scm new file mode 100644 index 00000000..6adae45a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/capnp/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/capnp/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/capnp/locals.scm new file mode 100644 index 00000000..fb436bf0 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/capnp/locals.scm @@ -0,0 +1,90 @@ +[ + (message) + (annotation_targets) + (const_list) + (enum) + (interface) + (implicit_generics) + (generics) + (group) + (method_parameters) + (named_return_types) + (struct) + (struct_shorthand) + (union) +] @scope + +[ + (extend_type) + (field_type) +] @reference +(custom_type (type_identifier) @reference) +(custom_type + (generics + (generic_parameters + (generic_identifier) @reference))) + +(annotation_definition_identifier) @definition + +(const_identifier) @definition.constant + +(enum (enum_identifier) @definition.enum) + +[ + (enum_member) + (field_identifier) +] @definition.field + +(method_identifier) @definition.method + +(namespace) @definition.namespace + +[ + (param_identifier) + (return_identifier) +] @definition.parameter + +(group (type_identifier) @definition.type) + +(struct (type_identifier) @definition.type) + +(union (type_identifier) @definition.type) + +(interface (type_identifier) @definition.type) + +; Generics Related (don't know how to combine these) + +(struct + (generics + (generic_parameters + (generic_identifier) @definition.parameter))) + +(interface + (generics + (generic_parameters + (generic_identifier) @definition.parameter))) + +(method + (implicit_generics + (implicit_generic_parameters + (generic_identifier) @definition.parameter))) + +(method + (generics + (generic_parameters + (generic_identifier) @definition.parameter))) + +(annotation + (generics + (generic_parameters + (generic_identifier) @definition.type))) + +(replace_using + (generics + (generic_parameters + (generic_identifier) @definition.type))) + +(return_type + (generics + (generic_parameters + (generic_identifier) @definition.type))) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/chatito/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/chatito/folds.scm new file mode 100644 index 00000000..20cb5194 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/chatito/folds.scm @@ -0,0 +1,5 @@ +[ + (intent_def) + (slot_def) + (alias_def) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/chatito/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/chatito/highlights.scm new file mode 100644 index 00000000..12a34452 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/chatito/highlights.scm @@ -0,0 +1,50 @@ +;; Punctuation + +[ + "%[" + "@[" + "~[" + "*[" + "]" + "(" + ")" +] @punctuation.bracket + +[":" ","] @punctuation.delimiter + +(["\"" "'"] @punctuation.special @conceal + (#set! conceal "")) + +["%" "?" "#"] @character.special + +;; Entities + +(intent) @namespace + +(slot) @type + +(variation) @type.qualifier + +(alias) @property + +(number) @number + +(argument + key: (string) @label + value: (string) @string) + +(escape) @string.escape + +;; Import + +"import" @include + +(file) @string.special + +;; Text + +(word) @text @spell + +;; Comment + +(comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/chatito/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/chatito/indents.scm new file mode 100644 index 00000000..64b4674b --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/chatito/indents.scm @@ -0,0 +1,7 @@ +[ + (intent_def) + (slot_def) + (alias_def) +] @indent.begin + +(ERROR "]") @indent.begin diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/chatito/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/chatito/injections.scm new file mode 100644 index 00000000..6adae45a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/chatito/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/chatito/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/chatito/locals.scm new file mode 100644 index 00000000..4d7a6c1a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/chatito/locals.scm @@ -0,0 +1,10 @@ +;; Definitions + +(intent_def (intent) @definition) +(slot_def (slot) @definition) +(alias_def (alias) @definition) + +;; References + +(slot_ref (slot) @reference) +(alias_ref (alias) @reference) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/clojure/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/clojure/folds.scm new file mode 100644 index 00000000..d54daade --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/clojure/folds.scm @@ -0,0 +1 @@ +(source (list_lit) @fold) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/clojure/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/clojure/highlights.scm new file mode 100644 index 00000000..2d3922ad --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/clojure/highlights.scm @@ -0,0 +1,381 @@ +;; >> Explanation +;; Parsers for lisps are a bit weird in that they just return the raw forms. +;; This means we have to do a bit of extra work in the queries to get things +;; highlighted as they should be. +;; +;; For the most part this means that some things have to be assigned multiple +;; groups. +;; By doing this we can add a basic capture and then later refine it with more +;; specialized captures. +;; This can mean that sometimes things are highlighted weirdly because they +;; have multiple highlight groups applied to them. + + +;; >> Literals + +( + (dis_expr) @comment + (#set! "priority" 105) ; Higher priority to mark the whole sexpr as a comment +) +(kwd_lit) @symbol +(str_lit) @string +(num_lit) @number +(char_lit) @character +(bool_lit) @boolean +(nil_lit) @constant.builtin +(comment) @comment @spell +(regex_lit) @string.regex + +["'" "`"] @string.escape + +["~" "~@" "#"] @punctuation.special + +["{" "}" "[" "]" "(" ")"] @punctuation.bracket + + + +;; >> Symbols + +; General symbol highlighting +(sym_lit) @variable + +; General function calls +(list_lit + . + (sym_lit) @function.call) +(anon_fn_lit + . + (sym_lit) @function.call) + +; Quoted symbols +(quoting_lit + (sym_lit) @symbol) +(syn_quoting_lit + (sym_lit) @symbol) + +; Used in destructure pattern +((sym_lit) @parameter + (#lua-match? @parameter "^[&]")) + +; Inline function variables +((sym_lit) @variable.builtin + (#lua-match? @variable.builtin "^%%")) + +; Constructor +((sym_lit) @constructor + (#lua-match? @constructor "^-%>[^>].*")) + +; Builtin dynamic variables +((sym_lit) @variable.builtin + (#any-of? @variable.builtin + "*agent*" "*allow-unresolved-vars*" "*assert*" + "*clojure-version*" "*command-line-args*" + "*compile-files*" "*compile-path*" "*compiler-options*" + "*data-readers*" "*default-data-reader-fn*" + "*err*" "*file*" "*flush-on-newline*" "*fn-loader*" + "*in*" "*math-context*" "*ns*" "*out*" + "*print-dup*" "*print-length*" "*print-level*" + "*print-meta*" "*print-namespace-maps*" "*print-readably*" + "*read-eval*" "*reader-resolver*" + "*source-path*" "*suppress-read*" + "*unchecked-math*" "*use-context-classloader*" + "*verbose-defrecords*" "*warn-on-reflection*")) + +; Builtin repl variables +((sym_lit) @variable.builtin + (#any-of? @variable.builtin + "*1" "*2" "*3" "*e")) + +; Gensym +;; Might not be needed +((sym_lit) @variable + (#lua-match? @variable "^.*#$")) + +; Types +;; TODO: improve? +((sym_lit) @type + (#lua-match? @type "^[%u][^/]*$")) +;; Symbols with `.` but not `/` +((sym_lit) @type + (#lua-match? @type "^[^/]+[.][^/]*$")) + +; Interop +; (.instanceMember instance args*) +; (.instanceMember Classname args*) +((sym_lit) @method + (#lua-match? @method "^%.[^-]")) +; (.-instanceField instance) +((sym_lit) @field + (#lua-match? @field "^%.%-.*")) +; Classname/staticField +((sym_lit) @field + (#lua-match? @field "^[%u].*/.+")) +; (Classname/staticMethod args*) +(list_lit + . + (sym_lit) @method + (#lua-match? @method "^[%u].*/.+")) +;; TODO: Special casing for the `.` macro + +; Operators +((sym_lit) @operator + (#any-of? @operator + "*" "*'" "+" "+'" "-" "-'" "/" + "<" "<=" ">" ">=" "=" "==")) +((sym_lit) @keyword.operator + (#any-of? @keyword.operator + "not" "not=" "and" "or")) + +; Definition functions +((sym_lit) @keyword + (#any-of? @keyword + "def" "defonce" "defrecord" "defmacro" "definline" "definterface" + "defmulti" "defmethod" "defstruct" "defprotocol" + "deftype")) +((sym_lit) @keyword + (#eq? @keyword "declare")) +((sym_name) @keyword.coroutine + (#any-of? @keyword.coroutine + "alts!" "alts!!" "await" "await-for" "await1" "chan" "close!" "future" "go" "sync" "thread" "timeout" "!" ">!!")) +((sym_lit) @keyword.function + (#any-of? @keyword.function "defn" "defn-" "fn" "fn*")) + +; Comment +((sym_lit) @comment + (#any-of? @comment "comment")) + +; Conditionals +((sym_lit) @conditional + (#any-of? @conditional + "case" "cond" "cond->" "cond->>" "condp")) +((sym_lit) @conditional + (#any-of? @conditional + "if" "if-let" "if-not" "if-some")) +((sym_lit) @conditional + (#any-of? @conditional + "when" "when-first" "when-let" "when-not" "when-some")) + +; Repeats +((sym_lit) @repeat + (#any-of? @repeat + "doseq" "dotimes" "for" "loop" "recur" "while")) + +; Exception +((sym_lit) @exception + (#any-of? @exception + "throw" "try" "catch" "finally")) + +; Includes +((sym_lit) @include + (#any-of? @include "ns" "import" "require" "use")) + +; Builtin macros +;; TODO: Do all these items belong here? +((sym_lit) @function.macro + (#any-of? @function.macro + "." ".." "->" "->>" "amap" "areduce" "as->" "assert" + "binding" "bound-fn" "delay" "do" "dosync" + "doto" "extend-protocol" "extend-type" + "gen-class" "gen-interface" "io!" "lazy-cat" + "lazy-seq" "let" "letfn" "locking" "memfn" "monitor-enter" + "monitor-exit" "proxy" "proxy-super" "pvalues" + "refer-clojure" "reify" "set!" "some->" "some->>" + "time" "unquote" "unquote-splicing" "var" "vswap!" + "with-bindings" "with-in-str" "with-loading-context" "with-local-vars" + "with-open" "with-out-str" "with-precision" "with-redefs")) + +; All builtin functions +; (->> (ns-publics *ns*) +; (keep (fn [[s v]] (when-not (:macro (meta v)) s))) +; sort +; clojure.pprint/pprint)) +;; ...and then lots of manual filtering... +((sym_lit) @function.builtin + (#any-of? @function.builtin + "->ArrayChunk" "->Eduction" "->Vec" "->VecNode" "->VecSeq" + "-cache-protocol-fn" "-reset-methods" "PrintWriter-on" + "StackTraceElement->vec" "Throwable->map" "accessor" + "aclone" "add-classpath" "add-tap" "add-watch" "agent" + "agent-error" "agent-errors" "aget" "alength" "alias" + "all-ns" "alter" "alter-meta!" "alter-var-root" "ancestors" + "any?" "apply" "array-map" "aset" "aset-boolean" "aset-byte" + "aset-char" "aset-double" "aset-float" "aset-int" + "aset-long" "aset-short" "assoc" "assoc!" "assoc-in" + "associative?" "atom" "bases" "bean" "bigdec" "bigint" "biginteger" + "bit-and" "bit-and-not" "bit-clear" "bit-flip" "bit-not" "bit-or" + "bit-set" "bit-shift-left" "bit-shift-right" "bit-test" + "bit-xor" "boolean" "boolean-array" "boolean?" + "booleans" "bound-fn*" "bound?" "bounded-count" + "butlast" "byte" "byte-array" "bytes" "bytes?" + "cast" "cat" "char" "char-array" "char-escape-string" + "char-name-string" "char?" "chars" "chunk" "chunk-append" + "chunk-buffer" "chunk-cons" "chunk-first" "chunk-next" + "chunk-rest" "chunked-seq?" "class" "class?" + "clear-agent-errors" "clojure-version" "coll?" + "commute" "comp" "comparator" "compare" "compare-and-set!" + "compile" "complement" "completing" "concat" "conj" + "conj!" "cons" "constantly" "construct-proxy" "contains?" + "count" "counted?" "create-ns" "create-struct" "cycle" + "dec" "dec'" "decimal?" "dedupe" "default-data-readers" + "delay?" "deliver" "denominator" "deref" "derive" + "descendants" "destructure" "disj" "disj!" "dissoc" + "dissoc!" "distinct" "distinct?" "doall" "dorun" "double" + "double-array" "eduction" "empty" "empty?" "ensure" "ensure-reduced" + "enumeration-seq" "error-handler" "error-mode" "eval" + "even?" "every-pred" "every?" "extend" "extenders" "extends?" + "false?" "ffirst" "file-seq" "filter" "filterv" "find" + "find-keyword" "find-ns" "find-protocol-impl" + "find-protocol-method" "find-var" "first" "flatten" + "float" "float-array" "float?" "floats" "flush" "fn?" + "fnext" "fnil" "force" "format" "frequencies" + "future-call" "future-cancel" "future-cancelled?" + "future-done?" "future?" "gensym" "get" "get-in" + "get-method" "get-proxy-class" "get-thread-bindings" + "get-validator" "group-by" "halt-when" "hash" + "hash-combine" "hash-map" "hash-ordered-coll" "hash-set" + "hash-unordered-coll" "ident?" "identical?" "identity" + "ifn?" "in-ns" "inc" "inc'" "indexed?" "init-proxy" + "inst-ms" "inst-ms*" "inst?" "instance?" "int" "int-array" + "int?" "integer?" "interleave" "intern" "interpose" "into" + "into-array" "ints" "isa?" "iterate" "iterator-seq" "juxt" + "keep" "keep-indexed" "key" "keys" "keyword" "keyword?" + "last" "line-seq" "list" "list*" "list?" "load" "load-file" + "load-reader" "load-string" "loaded-libs" "long" "long-array" + "longs" "macroexpand" "macroexpand-1" "make-array" "make-hierarchy" + "map" "map-entry?" "map-indexed" "map?" "mapcat" "mapv" + "max" "max-key" "memoize" "merge" "merge-with" "meta" + "method-sig" "methods" "min" "min-key" "mix-collection-hash" + "mod" "munge" "name" "namespace" "namespace-munge" "nat-int?" + "neg-int?" "neg?" "newline" "next" "nfirst" "nil?" "nnext" + "not-any?" "not-empty" "not-every?" "ns-aliases" + "ns-imports" "ns-interns" "ns-map" "ns-name" "ns-publics" + "ns-refers" "ns-resolve" "ns-unalias" "ns-unmap" "nth" + "nthnext" "nthrest" "num" "number?" "numerator" "object-array" + "odd?" "parents" "partial" "partition" "partition-all" + "partition-by" "pcalls" "peek" "persistent!" "pmap" "pop" + "pop!" "pop-thread-bindings" "pos-int?" "pos?" "pr" + "pr-str" "prefer-method" "prefers" "primitives-classnames" + "print" "print-ctor" "print-dup" "print-method" "print-simple" + "print-str" "printf" "println" "println-str" "prn" "prn-str" + "promise" "proxy-call-with-super" "proxy-mappings" "proxy-name" + "push-thread-bindings" "qualified-ident?" "qualified-keyword?" + "qualified-symbol?" "quot" "rand" "rand-int" "rand-nth" "random-sample" + "range" "ratio?" "rational?" "rationalize" "re-find" "re-groups" + "re-matcher" "re-matches" "re-pattern" "re-seq" "read" + "read+string" "read-line" "read-string" "reader-conditional" + "reader-conditional?" "realized?" "record?" "reduce" + "reduce-kv" "reduced" "reduced?" "reductions" "ref" "ref-history-count" + "ref-max-history" "ref-min-history" "ref-set" "refer" + "release-pending-sends" "rem" "remove" "remove-all-methods" + "remove-method" "remove-ns" "remove-tap" "remove-watch" + "repeat" "repeatedly" "replace" "replicate" + "requiring-resolve" "reset!" "reset-meta!" "reset-vals!" + "resolve" "rest" "restart-agent" "resultset-seq" "reverse" + "reversible?" "rseq" "rsubseq" "run!" "satisfies?" + "second" "select-keys" "send" "send-off" "send-via" + "seq" "seq?" "seqable?" "seque" "sequence" "sequential?" + "set" "set-agent-send-executor!" "set-agent-send-off-executor!" + "set-error-handler!" "set-error-mode!" "set-validator!" + "set?" "short" "short-array" "shorts" "shuffle" + "shutdown-agents" "simple-ident?" "simple-keyword?" + "simple-symbol?" "slurp" "some" "some-fn" "some?" + "sort" "sort-by" "sorted-map" "sorted-map-by" + "sorted-set" "sorted-set-by" "sorted?" "special-symbol?" + "spit" "split-at" "split-with" "str" "string?" + "struct" "struct-map" "subs" "subseq" "subvec" "supers" + "swap!" "swap-vals!" "symbol" "symbol?" "tagged-literal" + "tagged-literal?" "take" "take-last" "take-nth" "take-while" + "tap>" "test" "the-ns" "thread-bound?" "to-array" + "to-array-2d" "trampoline" "transduce" "transient" + "tree-seq" "true?" "type" "unchecked-add" "unchecked-add-int" + "unchecked-byte" "unchecked-char" "unchecked-dec" + "unchecked-dec-int" "unchecked-divide-int" "unchecked-double" + "unchecked-float" "unchecked-inc" "unchecked-inc-int" + "unchecked-int" "unchecked-long" "unchecked-multiply" + "unchecked-multiply-int" "unchecked-negate" "unchecked-negate-int" + "unchecked-remainder-int" "unchecked-short" "unchecked-subtract" + "unchecked-subtract-int" "underive" "unquote" + "unquote-splicing" "unreduced" "unsigned-bit-shift-right" + "update" "update-in" "update-proxy" "uri?" "uuid?" + "val" "vals" "var-get" "var-set" "var?" "vary-meta" "vec" + "vector" "vector-of" "vector?" "volatile!" "volatile?" + "vreset!" "with-bindings*" "with-meta" "with-redefs-fn" "xml-seq" + "zero?" "zipmap" + ;; earlier + "drop" "drop-last" "drop-while" + "double?" "doubles" + "ex-data" "ex-info" + ;; 1.10 + "ex-cause" "ex-message" + ;; 1.11 + "NaN?" "abs" "infinite?" "iteration" "random-uuid" + "parse-boolean" "parse-double" "parse-long" "parse-uuid" + "seq-to-map-for-destructuring" "update-keys" "update-vals" + ;; 1.12 + "partitionv" "partitionv-all" "splitv-at")) + + + +;; >> Context based highlighting + +;; def-likes +;; Correctly highlight docstrings +;(list_lit + ;. + ;(sym_lit) @_keyword ; Don't really want to highlight twice + ;(#any-of? @_keyword + ;"def" "defonce" "defrecord" "defmacro" "definline" + ;"defmulti" "defmethod" "defstruct" "defprotocol" + ;"deftype") + ;. + ;(sym_lit) + ;. + ;;; TODO: Add @comment highlight + ;(str_lit)? + ;. + ;(_)) + +; Function definitions +(list_lit + . + (sym_lit) @_keyword.function + (#any-of? @_keyword.function "fn" "fn*" "defn" "defn-") + . + (sym_lit)? @function + . + ;; TODO: Add @comment highlight + (str_lit)?) +;; TODO: Fix parameter highlighting +;; I think there's a bug here in nvim-treesitter +;; TODO: Reproduce bug and file ticket + ;. + ;[(vec_lit + ; (sym_lit)* @parameter) + ; (list_lit + ; (vec_lit + ; (sym_lit)* @parameter))]) + +;[((list_lit +; (vec_lit +; (sym_lit) @parameter) +; (_) +; + +; ((vec_lit +; (sym_lit) @parameter) +; (_))) + + +; Meta punctuation +;; NOTE: When the above `Function definitions` query captures the +;; the @function it also captures the child meta_lit +;; We capture the meta_lit symbol (^) after so that the later +;; highlighting overrides the former +"^" @punctuation.special + +;; namespaces +(list_lit + . + (sym_lit) @_include + (#eq? @_include "ns") + . + (sym_lit) @namespace) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/clojure/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/clojure/injections.scm new file mode 100644 index 00000000..6adae45a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/clojure/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/clojure/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/clojure/locals.scm new file mode 100644 index 00000000..e47adce4 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/clojure/locals.scm @@ -0,0 +1 @@ +; placeholder file to get incremental selection to work diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cmake/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cmake/folds.scm new file mode 100644 index 00000000..9ac59ad4 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cmake/folds.scm @@ -0,0 +1,8 @@ +[ + (if_condition) + (foreach_loop) + (while_loop) + (function_def) + (macro_def) + (block_def) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cmake/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cmake/highlights.scm new file mode 100644 index 00000000..af6b70cc --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cmake/highlights.scm @@ -0,0 +1,217 @@ +(normal_command + (identifier) + (argument_list + (argument (unquoted_argument)) @constant + ) + (#lua-match? @constant "^[%u@][%u%d_]+$") +) + +[ + (quoted_argument) + (bracket_argument) +] @string + +(variable_ref) @none +(variable) @variable + +[ + (bracket_comment) + (line_comment) +] @comment @spell + +(normal_command (identifier) @function) + +["ENV" "CACHE"] @storageclass +["$" "{" "}" "<" ">"] @punctuation.special +["(" ")"] @punctuation.bracket + +[ + (function) + (endfunction) + (macro) + (endmacro) +] @keyword.function + +[ + (if) + (elseif) + (else) + (endif) +] @conditional + +[ + (foreach) + (endforeach) + (while) + (endwhile) +] @repeat + +(normal_command + (identifier) @repeat + (#match? @repeat "\\c^(continue|break)$") +) +(normal_command + (identifier) @keyword.return + (#match? @keyword.return "\\c^return$") +) + +(function_command + (function) + (argument_list + . (argument) @function + (argument)* @parameter + ) +) + +(macro_command + (macro) + (argument_list + . (argument) @function.macro + (argument)* @parameter + ) +) + +(block_def + (block_command + (block) @function.builtin + (argument_list + (argument (unquoted_argument) @constant) + ) + (#any-of? @constant "SCOPE_FOR" "POLICIES" "VARIABLES" "PROPAGATE") + ) + (endblock_command (endblock) @function.builtin) +) +; +((argument) @boolean + (#match? @boolean "\\c^(1|on|yes|true|y|0|off|no|false|n|ignore|notfound|.*-notfound)$") +) +; +(if_command + (if) + (argument_list + (argument) @keyword.operator + ) + (#any-of? @keyword.operator "NOT" "AND" "OR" + "COMMAND" "POLICY" "TARGET" "TEST" "DEFINED" "IN_LIST" + "EXISTS" "IS_NEWER_THAN" "IS_DIRECTORY" "IS_SYMLINK" "IS_ABSOLUTE" + "MATCHES" + "LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL" + "STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL" + "VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL" + ) +) +(elseif_command + (elseif) + (argument_list + (argument) @keyword.operator + ) + (#any-of? @keyword.operator "NOT" "AND" "OR" + "COMMAND" "POLICY" "TARGET" "TEST" "DEFINED" "IN_LIST" + "EXISTS" "IS_NEWER_THAN" "IS_DIRECTORY" "IS_SYMLINK" "IS_ABSOLUTE" + "MATCHES" + "LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL" + "STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL" + "VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL" + ) +) + +(normal_command + (identifier) @function.builtin + (#match? @function.builtin "\\c^(cmake_host_system_information|cmake_language|cmake_minimum_required|cmake_parse_arguments|cmake_path|cmake_policy|configure_file|execute_process|file|find_file|find_library|find_package|find_path|find_program|foreach|get_cmake_property|get_directory_property|get_filename_component|get_property|include|include_guard|list|macro|mark_as_advanced|math|message|option|separate_arguments|set|set_directory_properties|set_property|site_name|string|unset|variable_watch|add_compile_definitions|add_compile_options|add_custom_command|add_custom_target|add_definitions|add_dependencies|add_executable|add_library|add_link_options|add_subdirectory|add_test|aux_source_directory|build_command|create_test_sourcelist|define_property|enable_language|enable_testing|export|fltk_wrap_ui|get_source_file_property|get_target_property|get_test_property|include_directories|include_external_msproject|include_regular_expression|install|link_directories|link_libraries|load_cache|project|remove_definitions|set_source_files_properties|set_target_properties|set_tests_properties|source_group|target_compile_definitions|target_compile_features|target_compile_options|target_include_directories|target_link_directories|target_link_libraries|target_link_options|target_precompile_headers|target_sources|try_compile|try_run|ctest_build|ctest_configure|ctest_coverage|ctest_empty_binary_directory|ctest_memcheck|ctest_read_custom_files|ctest_run_script|ctest_sleep|ctest_start|ctest_submit|ctest_test|ctest_update|ctest_upload)$") +) + +(normal_command + (identifier) @_function + (argument_list + . (argument) @variable + ) + (#match? @_function "\\c^set$") +) + +(normal_command + (identifier) @_function + (#match? @_function "\\c^set$") + (argument_list + . (argument) + ( + (argument) @_cache @storageclass + . + (argument) @_type @type + (#any-of? @_cache "CACHE") + (#any-of? @_type "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL") + ) + ) +) + +(normal_command + (identifier) @_function + (#match? @_function "\\c^unset$") + (argument_list + . (argument) + (argument) @storageclass + (#any-of? @storageclass "CACHE" "PARENT_SCOPE") + ) +) + +(normal_command + (identifier) @_function + (#match? @_function "\\c^list$") + (argument_list + . (argument) @constant + (#any-of? @constant "LENGTH" "GET" "JOIN" "SUBLIST" "FIND") + . (argument) @variable + (argument) @variable . + ) +) +(normal_command + (identifier) @_function + (#match? @_function "\\c^list$") + (argument_list + . (argument) @constant + . (argument) @variable + (#any-of? @constant "APPEND" "FILTER" "INSERT" + "POP_BACK" "POP_FRONT" "PREPEND" + "REMOVE_ITEM" "REMOVE_AT" "REMOVE_DUPLICATES" + "REVERSE" "SORT") + ) +) +(normal_command + (identifier) @_function + (#match? @_function "\\c^list$") + (argument_list + . (argument) @_transform @constant + . (argument) @variable + . (argument) @_action @constant + (#eq? @_transform "TRANSFORM") + (#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE") + ) +) +(normal_command + (identifier) @_function + (#match? @_function "\\c^list$") + (argument_list + . (argument) @_transform @constant + . (argument) @variable + . (argument) @_action @constant + . (argument)? @_selector @constant + (#eq? @_transform "TRANSFORM") + (#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE") + (#any-of? @_selector "AT" "FOR" "REGEX") + ) +) +(normal_command + (identifier) @_function + (#match? @_function "\\c^list$") + (argument_list + . (argument) @_transform @constant + (argument) @constant . + (argument) @variable + (#eq? @_transform "TRANSFORM") + (#eq? @constant "OUTPUT_VARIABLE") + ) +) + +(escape_sequence) @string.escape + +((source_file . (line_comment) @preproc) + (#lua-match? @preproc "^#!/")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cmake/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cmake/indents.scm new file mode 100644 index 00000000..787cc2c9 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cmake/indents.scm @@ -0,0 +1,25 @@ +[ + (normal_command) + (if_condition) + (foreach_loop) + (while_loop) + (function_def) + (macro_def) + (block_def) +] @indent.begin + +[ + (elseif_command) + (else_command) + (endif_command) + (endforeach_command) + (endwhile_command) + (endfunction_command) + (endmacro_command) + (endblock_command) +] @indent.branch + +(")" @indent.branch) +(")" @indent.end) + +(argument_list) @indent.auto diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/comment/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/comment/highlights.scm new file mode 100644 index 00000000..87491c7a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/comment/highlights.scm @@ -0,0 +1,41 @@ +((tag + (name) @text.todo @nospell + ("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)? + ":" @punctuation.delimiter) + (#any-of? @text.todo "TODO" "WIP")) + +("text" @text.todo @nospell + (#any-of? @text.todo "TODO" "WIP")) + +((tag + (name) @text.note @nospell + ("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)? + ":" @punctuation.delimiter) + (#any-of? @text.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST")) + +("text" @text.note @nospell + (#any-of? @text.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST")) + +((tag + (name) @text.warning @nospell + ("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)? + ":" @punctuation.delimiter) + (#any-of? @text.warning "HACK" "WARNING" "WARN" "FIX")) + +("text" @text.warning @nospell + (#any-of? @text.warning "HACK" "WARNING" "WARN" "FIX")) + +((tag + (name) @text.danger @nospell + ("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)? + ":" @punctuation.delimiter) + (#any-of? @text.danger "FIXME" "BUG" "ERROR")) + +("text" @text.danger @nospell + (#any-of? @text.danger "FIXME" "BUG" "ERROR")) + +; Issue number (#123) +("text" @number + (#lua-match? @number "^#[0-9]+$")) + +((uri) @text.uri @nospell) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/commonlisp/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/commonlisp/folds.scm new file mode 100644 index 00000000..d54daade --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/commonlisp/folds.scm @@ -0,0 +1 @@ +(source (list_lit) @fold) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/commonlisp/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/commonlisp/highlights.scm new file mode 100644 index 00000000..55c0c8fc --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/commonlisp/highlights.scm @@ -0,0 +1,145 @@ +(sym_lit) @variable + +;; A highlighting for functions/macros in th cl namespace is available in theHamsta/nvim-treesitter-commonlisp +;(list_lit . (sym_lit) @function.builtin (#cl-standard-function? @function.builtin)) +;(list_lit . (sym_lit) @function.builtin (#cl-standard-macro? @function.macro)) + +(dis_expr) @comment + +(defun_keyword) @function.macro +(defun_header + function_name: (_) @function) +(defun_header + lambda_list: (list_lit (sym_lit) @parameter)) +(defun_header + keyword: (defun_keyword "defmethod") + lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @symbol))) +(defun_header + lambda_list: (list_lit (list_lit . (sym_lit) @parameter . (_)))) +(defun_header + specifier: (sym_lit) @symbol) + +[":" "::" "."] @punctuation.special + +[ + (accumulation_verb) + (for_clause_word) + "for" + "and" + "finally" + "thereis" + "always" + "when" + "if" + "unless" + "else" + "do" + "loop" + "below" + "in" + "from" + "across" + "repeat" + "being" + "into" + "with" + "as" + "while" + "until" + "return" + "initially" +] @function.macro +"=" @operator + +(include_reader_macro) @symbol +["#C" "#c"] @number + +[(kwd_lit) (self_referential_reader_macro)] @symbol + +(package_lit + package: (_) @namespace) +"cl" @namespace + +(str_lit) @string + +(num_lit) @number + +((sym_lit) @boolean (#any-of? @boolean "t" "T")) + +(nil_lit) @constant.builtin + +(comment) @comment @spell + +;; dynamic variables +((sym_lit) @variable.builtin + (#lua-match? @variable.builtin "^[*].+[*]$")) + +;; quote +"'" @string.escape +(format_specifier) @string.escape +(quoting_lit) @string.escape + +;; syntax quote +"`" @string.escape +"," @string.escape +",@" @string.escape +(syn_quoting_lit) @string.escape +(unquoting_lit) @none +(unquote_splicing_lit) @none + + +["(" ")"] @punctuation.bracket + +(block_comment) @comment @spell + + +(with_clause + type: (_) @type) +(for_clause + type: (_) @type) + +;; defun-like things +(list_lit + . + (sym_lit) @function.macro + . + (sym_lit) @function + (#eq? @function.macro "deftest")) + +;;; Macros and Special Operators +(list_lit + . + (sym_lit) @function.macro + ;; Generated via https://github.com/theHamsta/nvim-treesitter-commonlisp/blob/22fdc9fd6ed594176cc7299cc6f68dd21c94c63b/scripts/generate-symbols.lisp#L1-L21 + (#any-of? @function.macro + "do*" "step" "handler-bind" "decf" "prog1" "destructuring-bind" "defconstant" "do" "lambda" "with-standard-io-syntax" "case" "restart-bind" "ignore-errors" "with-slots" "prog2" "defclass" "define-condition" "print-unreadable-object" "defvar" "when" "with-open-file" "prog" "incf" "declaim" "and" "loop-finish" "multiple-value-bind" "pop" "psetf" "defmacro" "with-open-stream" "define-modify-macro" "defsetf" "formatter" "call-method" "handler-case" "pushnew" "or" "with-hash-table-iterator" "ecase" "cond" "defun" "remf" "ccase" "define-compiler-macro" "dotimes" "multiple-value-list" "assert" "deftype" "with-accessors" "trace" "with-simple-restart" "do-symbols" "nth-value" "define-symbol-macro" "psetq" "rotatef" "dolist" "check-type" "multiple-value-setq" "push" "pprint-pop" "loop" "define-setf-expander" "pprint-exit-if-list-exhausted" "with-condition-restarts" "defstruct" "with-input-from-string" "with-compilation-unit" "defgeneric" "with-output-to-string" "untrace" "defparameter" "ctypecase" "do-external-symbols" "etypecase" "do-all-symbols" "with-package-iterator" "unless" "defmethod" "in-package" "defpackage" "return" "typecase" "shiftf" "setf" "pprint-logical-block" "time" "restart-case" "prog*" "define-method-combination" "optimize")) + +;; constant +((sym_lit) @constant + (#lua-match? @constant "^[+].+[+]$")) + +(var_quoting_lit + marker: "#'" @symbol + value: (_) @symbol) + +["#" "#p" "#P"] @symbol + +(list_lit + . + (sym_lit) @function.builtin + ;; Generated via https://github.com/theHamsta/nvim-treesitter-commonlisp/blob/22fdc9fd6ed594176cc7299cc6f68dd21c94c63b/scripts/generate-symbols.lisp#L1-L21 + (#any-of? @function.builtin + "apropos-list" "subst" "substitute" "pprint-linear" "file-namestring" "write-char" "do*" "slot-exists-p" "file-author" "macro-function" "rassoc" "make-echo-stream" "arithmetic-error-operation" "position-if-not" "list" "cdadr" "lisp-implementation-type" "vector-push" "let" "length" "string-upcase" "adjoin" "digit-char" "step" "member-if" "handler-bind" "lognot" "apply" "gcd" "slot-unbound" "stringp" "values-list" "stable-sort" "decode-float" "make-list" "rplaca" "isqrt" "export" "synonym-stream-symbol" "function-keywords" "replace" "tanh" "maphash" "code-char" "decf" "array-displacement" "string-not-lessp" "slot-value" "remove-if" "cell-error-name" "vectorp" "cdddar" "two-way-stream-output-stream" "parse-integer" "get-internal-real-time" "fourth" "make-string" "slot-missing" "byte-size" "string-trim" "nstring-downcase" "cdaddr" "<" "labels" "interactive-stream-p" "fifth" "max" "logxor" "pathname-name" "function" "realp" "eql" "logand" "short-site-name" "prog1" "user-homedir-pathname" "list-all-packages" "exp" "cadar" "read-char-no-hang" "package-error-package" "stream-external-format" "bit-andc2" "nsubstitute-if" "mapcar" "complement" "load-logical-pathname-translations" "pprint-newline" "oddp" "caaar" "destructuring-bind" "copy-alist" "acos" "go" "bit-nor" "defconstant" "fceiling" "tenth" "nreverse" "=" "nunion" "slot-boundp" "string>" "count-if" "atom" "char=" "random-state-p" "row-major-aref" "bit-andc1" "translate-pathname" "simple-vector-p" "coerce" "substitute-if-not" "zerop" "invalid-method-error" "compile" "realpart" "remove-if-not" "pprint-tab" "hash-table-rehash-threshold" "invoke-restart" "if" "count" "/=" "do" "initialize-instance" "abs" "schar" "simple-condition-format-control" "delete-package" "subst-if" "lambda" "hash-table-count" "array-has-fill-pointer-p" "bit" "with-standard-io-syntax" "parse-namestring" "proclaim" "array-in-bounds-p" "multiple-value-call" "rplacd" "some" "graphic-char-p" "read-from-string" "consp" "cadaar" "acons" "every" "make-pathname" "mask-field" "case" "set-macro-character" "bit-and" "restart-bind" "echo-stream-input-stream" "compile-file" "fill-pointer" "numberp" "acosh" "array-dimensions" "documentation" "minusp" "inspect" "copy-structure" "integer-length" "ensure-generic-function" "char>=" "quote" "lognor" "make-two-way-stream" "ignore-errors" "tailp" "with-slots" "fboundp" "logical-pathname-translations" "equal" "float-sign" "shadow" "sleep" "numerator" "prog2" "getf" "ldb-test" "round" "locally" "echo-stream-output-stream" "log" "get-macro-character" "alphanumericp" "find-method" "nintersection" "defclass" "define-condition" "print-unreadable-object" "defvar" "broadcast-stream-streams" "floatp" "subst-if-not" "integerp" "translate-logical-pathname" "subsetp" "when" "write-string" "with-open-file" "clrhash" "apropos" "intern" "min" "string-greaterp" "import" "nset-difference" "prog" "incf" "both-case-p" "multiple-value-prog1" "characterp" "streamp" "digit-char-p" "random" "string-lessp" "make-string-input-stream" "copy-symbol" "read-sequence" "logcount" "bit-not" "boundp" "encode-universal-time" "third" "declaim" "map" "cons" "set-syntax-from-char" "and" "cis" "symbol-plist" "loop-finish" "standard-char-p" "multiple-value-bind" "asin" "string" "pop" "complex" "fdefinition" "psetf" "type-error-datum" "output-stream-p" "floor" "write-line" "<=" "defmacro" "rational" "hash-table-test" "with-open-stream" "read-char" "string-capitalize" "get-properties" "y-or-n-p" "use-package" "remove" "compiler-macro-function" "read" "package-nicknames" "remove-duplicates" "make-load-form-saving-slots" "dribble" "define-modify-macro" "make-dispatch-macro-character" "close" "cosh" "open" "finish-output" "string-downcase" "car" "nstring-capitalize" "software-type" "read-preserving-whitespace" "cadr" "fround" "nsublis" "defsetf" "find-all-symbols" "char>" "no-applicable-method" "compute-restarts" "pathname" "bit-orc2" "write-sequence" "pprint-tabular" "symbol-value" "char-name" "get-decoded-time" "formatter" "bit-vector-p" "intersection" "pathname-type" "clear-input" "call-method" "princ-to-string" "symbolp" "make-load-form" "nsubst" "pprint-dispatch" "handler-case" "method-combination-error" "probe-file" "atan" "string<" "type-error-expected-type" "pushnew" "unread-char" "print" "or" "with-hash-table-iterator" "make-sequence" "ecase" "unwind-protect" "require" "sixth" "get-dispatch-macro-character" "char-not-lessp" "read-byte" "tagbody" "file-error-pathname" "catch" "rationalp" "char-downcase" "char-int" "array-rank" "cond" "last" "make-string-output-stream" "array-dimension" "host-namestring" "input-stream-p" "decode-universal-time" "defun" "eval-when" "char-code" "pathname-directory" "evenp" "subseq" "pprint" "ftruncate" "make-instance" "pathname-host" "logbitp" "remf" "1+" "copy-pprint-dispatch" "char-upcase" "error" "read-line" "second" "make-package" "directory" "special-operator-p" "open-stream-p" "rassoc-if-not" "ccase" "equalp" "substitute-if" "*" "char/=" "cdr" "sqrt" "lcm" "logical-pathname" "eval" "define-compiler-macro" "nsubstitute-if-not" "mapcon" "imagpart" "set-exclusive-or" "simple-condition-format-arguments" "expt" "concatenate" "file-position" "macrolet" "keywordp" "hash-table-rehash-size" "+" "eighth" "use-value" "char-equal" "bit-xor" "format" "byte" "dotimes" "namestring" "char-not-equal" "multiple-value-list" "assert" "append" "notany" "typep" "delete-file" "makunbound" "cdaar" "file-write-date" ">" "cdddr" "write-to-string" "funcall" "member-if-not" "deftype" "readtable-case" "with-accessors" "truename" "constantp" "rassoc-if" "caaadr" "tree-equal" "nset-exclusive-or" "nsubstitute" "make-instances-obsolete" "package-use-list" "invoke-debugger" "provide" "count-if-not" "trace" "logandc1" "nthcdr" "char<=" "functionp" "with-simple-restart" "set-dispatch-macro-character" "logorc2" "unexport" "rest" "unbound-slot-instance" "make-hash-table" "hash-table-p" "reinitialize-instance" "nth" "do-symbols" "nreconc" "macroexpand" "store-value" "float-precision" "remprop" "nth-value" "define-symbol-macro" "update-instance-for-redefined-class" "identity" "progv" "progn" "return-from" "readtablep" "rem" "symbol-name" "psetq" "wild-pathname-p" "char" "list*" "char<" "plusp" "pairlis" "cddar" "pprint-indent" "union" "compiled-function-p" "rotatef" "abort" "machine-type" "concatenated-stream-streams" "string-right-trim" "enough-namestring" "arithmetic-error-operands" "ceiling" "dolist" "delete" "make-condition" "string-left-trim" "integer-decode-float" "check-type" "notevery" "function-lambda-expression" "-" "multiple-value-setq" "name-char" "push" "pprint-pop" "compile-file-pathname" "list-length" "nstring-upcase" "eq" "find-if" "method-qualifiers" "caadr" "cddr" "string=" "let*" "remove-method" "pathname-match-p" "find-package" "truncate" "caaddr" "get-setf-expansion" "loop" "define-setf-expander" "caddr" "package-shadowing-symbols" "force-output" "slot-makunbound" "string-not-greaterp" "cdadar" "cdaadr" "logandc2" "make-array" "merge-pathnames" "sin" "1-" "machine-version" "ffloor" "packagep" "set-pprint-dispatch" "flet" "gensym" "pprint-exit-if-list-exhausted" "cos" "get" "mapl" "delete-if" "with-condition-restarts" "atanh" "copy-list" "fill" "char-not-greaterp" "bit-orc1" "mod" "package-used-by-list" "warn" "add-method" "simple-string-p" "find-restart" "describe" "pathname-version" "peek-char" "yes-or-no-p" "complexp" "aref" "not" "position-if" "string>=" "defstruct" "float-radix" "ninth" "caadar" "subtypep" "set" "butlast" "allocate-instance" "with-input-from-string" "assoc" "write" "make-random-state" "bit-eqv" "float-digits" "long-site-name" "with-compilation-unit" "delete-duplicates" "make-symbol" "room" "cdar" "pprint-fill" "defgeneric" "macroexpand-1" "scale-float" "cdaaar" "update-instance-for-different-class" "array-row-major-index" "ed" "file-string-length" "ensure-directories-exist" "copy-readtable" "string<=" "seventh" "with-output-to-string" "signum" "elt" "untrace" "null" "defparameter" "block" "prin1" "revappend" "gentemp" "ctypecase" "ash" "sxhash" "listp" "do-external-symbols" "bit-ior" "etypecase" "sort" "change-class" "find-class" "alpha-char-p" "map-into" "terpri" "do-all-symbols" "ldb" "logorc1" "search" "fmakunbound" "load" "character" "string-not-equal" "pathnamep" "make-broadcast-stream" "arrayp" "mapcan" "cerror" "invoke-restart-interactively" "assoc-if-not" "with-package-iterator" "get-internal-run-time" "read-delimited-list" "unless" "lower-case-p" "restart-name" "/" "boole" "defmethod" "float" "software-version" "vector-pop" "vector-push-extend" "caar" "ldiff" "member" "find-symbol" "reduce" "svref" "describe-object" "logior" "string-equal" "type-of" "position" "cddadr" "pathname-device" "get-output-stream-string" "symbol-package" "tan" "compute-applicable-methods" "cddddr" "nsubst-if-not" "sublis" "set-difference" "two-way-stream-input-stream" "adjustable-array-p" "machine-instance" "signal" "conjugate" "caaaar" "endp" "lisp-implementation-version" "cddaar" "package-name" "adjust-array" "bit-nand" "gethash" "in-package" "symbol-function" "make-concatenated-stream" "defpackage" "class-of" "no-next-method" "logeqv" "deposit-field" "disassemble" "unuse-package" "copy-tree" "find" "asinh" "class-name" "rename-file" "values" "print-not-readable-object" "mismatch" "cadadr" "shadowing-import" "delete-if-not" "maplist" "listen" "return" "stream-element-type" "unintern" "merge" "make-synonym-stream" "prin1-to-string" "nsubst-if" "byte-position" "phase" "muffle-warning" "remhash" "continue" "load-time-value" "hash-table-size" "upgraded-complex-part-type" "char-lessp" "sbit" "upgraded-array-element-type" "file-length" "typecase" "cadddr" "first" "rationalize" "logtest" "find-if-not" "dpb" "mapc" "sinh" "char-greaterp" "shiftf" "denominator" "get-universal-time" "nconc" "setf" "lognand" "rename-package" "pprint-logical-block" "break" "symbol-macrolet" "the" "fresh-line" "clear-output" "assoc-if" "string/=" "princ" "directory-namestring" "stream-error-stream" "array-element-type" "setq" "copy-seq" "time" "restart-case" "prog*" "shared-initialize" "array-total-size" "simple-bit-vector-p" "define-method-combination" "write-byte" "constantly" "caddar" "print-object" "vector" "throw" "reverse" ">=" "upper-case-p" "nbutlast")) + +(list_lit + . + (sym_lit) @operator + (#match? @operator "^([+*-+=<>]|<=|>=|/=)$")) + + +((sym_lit) @symbol +(#lua-match? @symbol "^[&]")) + +[(array_dimension) "#0A" "#0a"] @number + +(char_lit) @character diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/commonlisp/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/commonlisp/locals.scm new file mode 100644 index 00000000..471fad40 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/commonlisp/locals.scm @@ -0,0 +1,72 @@ + +(defun_header + function_name: (sym_lit) @definition.function (#set! definition.function.scope "parent")) +(defun_header + lambda_list: (list_lit (sym_lit) @definition.parameter)) + +(defun_header + keyword: (defun_keyword "defmethod") + lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @definition.type))) +(defun_header + lambda_list: (list_lit (list_lit . (sym_lit) @definition.parameter . (_)))) + +(sym_lit) @reference + +(defun) @scope + +((list_lit . (sym_lit) @_defvar . (sym_lit) @definition.var) +(#match? @_defvar "^(cl:)?(defvar|defparameter)$")) + +(list_lit + . + (sym_lit) @_deftest + . + (sym_lit) @definition.function + (#eq? @_deftest "deftest")) @scope + +(list_lit + . + (sym_lit) @_deftest + . + (sym_lit) @definition.function + (#eq? @_deftest "deftest")) @scope + +(for_clause . (sym_lit) @definition.var) +(with_clause . (sym_lit) @definition.var) +(loop_macro) @scope + +(list_lit + . + (sym_lit) @_let (#match? @_let "(cl:|cffi:)?(with-accessors|with-foreign-objects|let[*]?)") + . + (list_lit (list_lit . (sym_lit) @definition.var))) @scope + +(list_lit + . + (sym_lit) @_let (#match? @_let "(cl:|alexandria:)?(with-gensyms|dotimes|with-foreign-object)") + . + (list_lit . (sym_lit) @definition.var)) @scope + +(list_lit + . + (kwd_lit) @_import_from (#eq? @_import_from ":import-from") + . + (_) + (kwd_lit (kwd_symbol) @definition.import)) + +(list_lit + . + (kwd_lit) @_import_from (#eq? @_import_from ":import-from") + . + (_) + (sym_lit) @definition.import) + +(list_lit + . + (kwd_lit) @_use (#eq? @_use ":use") + (kwd_lit (kwd_symbol) @definition.import)) + +(list_lit + . + (kwd_lit) @_use (#eq? @_use ":use") + (sym_lit) @definition.import) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cooklang/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cooklang/highlights.scm new file mode 100644 index 00000000..4ced465b --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cooklang/highlights.scm @@ -0,0 +1,22 @@ +(metadata) @comment + +(ingredient + "@" @tag + (name)? @text.title + (amount + (quantity)? @number + (units)? @tag.attribute)?) + +(timer + "~" @tag + (name)? @text.title + (amount + (quantity)? @number + (units)? @tag.attribute)?) + +(cookware + "#" @tag + (name)? @text.title + (amount + (quantity)? @number + (units)? @tag.attribute)?) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/corn/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/corn/folds.scm new file mode 100644 index 00000000..c081ecb4 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/corn/folds.scm @@ -0,0 +1,5 @@ +[ + (object) + (array) + (assign_block) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/corn/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/corn/highlights.scm new file mode 100644 index 00000000..200c33e1 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/corn/highlights.scm @@ -0,0 +1,20 @@ +"let" @keyword +"in" @keyword + +[ + "{" + "}" + "[" + "]" +] @punctuation.bracket + +"." @punctuation.delimiter + +(input) @constant +(comment) @comment @spell + +(string) @string +(integer) @number +(float) @float +(boolean) @boolean +(null) @keyword diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/corn/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/corn/indents.scm new file mode 100644 index 00000000..1f5a2c40 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/corn/indents.scm @@ -0,0 +1,14 @@ +[ + (assign_block "{") + (object) + (array) +] @indent.begin + +(assign_block "}" @indent.branch) +(assign_block "}" @indent.end) + +(object "}" @indent.branch) +(object "}" @indent.end) + +(array "]" @indent.branch) +(array "]" @indent.end) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/corn/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/corn/locals.scm new file mode 100644 index 00000000..f6b0d4c7 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/corn/locals.scm @@ -0,0 +1,16 @@ +; scopes + +[ + (object) + (array) +] @scope + +; definitions + +(assign_block + (assignment + (input) + @definition.constant)) + +(value (input) @reference) + diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpon/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpon/folds.scm new file mode 100644 index 00000000..02feec4e --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpon/folds.scm @@ -0,0 +1,5 @@ +[ + (meta_map) + (map) + (array) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpon/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpon/highlights.scm new file mode 100644 index 00000000..36df3555 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpon/highlights.scm @@ -0,0 +1,46 @@ +; Literals + +(string) @string +(escape_sequence) @string.escape + +(hex_blob + "x" @character.special + (_) @string) + +(esc_blob + "b" @character.special + (_) @string) + +(datetime + "d" @character.special + (_) @string.special) + +(_ key: (_) @label) + +(number) @number + +(float) @float + +(boolean) @boolean + +(null) @constant.builtin + +; Punctuation + +[ + "," + ":" +] @punctuation.delimiter + +[ "{" "}" ] @punctuation.bracket + +[ "[" "]" ] @punctuation.bracket + +[ "<" ">" ] @punctuation.bracket + +(("\"" @conceal) + (#set! conceal "")) + +; Comments + +(comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpon/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpon/indents.scm new file mode 100644 index 00000000..8ec2ff57 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpon/indents.scm @@ -0,0 +1,17 @@ +[ + (meta_map) + (map) + (imap) + (array) +] @indent.begin + +[ + "]" + "}" + ">" +] @indent.end @indent.branch + +[ + (ERROR) + (comment) +] @indent.auto diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpon/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpon/injections.scm new file mode 100644 index 00000000..6adae45a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpon/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpon/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpon/locals.scm new file mode 100644 index 00000000..c1854af9 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpon/locals.scm @@ -0,0 +1,7 @@ +[ + (document) + + (meta_map) + (map) + (array) +] @scope diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpp/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpp/folds.scm new file mode 100644 index 00000000..23d623b0 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpp/folds.scm @@ -0,0 +1,14 @@ +; inherits: c + +[ + (for_range_loop) + (class_specifier) + (field_declaration + type: (enum_specifier) + default_value: (initializer_list)) + (template_declaration) + (namespace_definition) + (try_statement) + (catch_clause) + (lambda_expression) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpp/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpp/highlights.scm new file mode 100644 index 00000000..b9a8cfec --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpp/highlights.scm @@ -0,0 +1,241 @@ +; inherits: c + +((identifier) @field + (#lua-match? @field "^m_.*$")) + +(parameter_declaration + declarator: (reference_declarator) @parameter) + +; function(Foo ...foo) +(variadic_parameter_declaration + declarator: (variadic_declarator + (_) @parameter)) +; int foo = 0 +(optional_parameter_declaration + declarator: (_) @parameter) + +;(field_expression) @parameter ;; How to highlight this? + +(((field_expression + (field_identifier) @method)) @_parent + (#has-parent? @_parent template_method function_declarator)) + +(field_declaration + (field_identifier) @field) + +(field_initializer + (field_identifier) @property) + +(function_declarator + declarator: (field_identifier) @method) + +(concept_definition + name: (identifier) @type.definition) + +(alias_declaration + name: (type_identifier) @type.definition) + +(auto) @type.builtin + +(namespace_identifier) @namespace +((namespace_identifier) @type + (#lua-match? @type "^[%u]")) + +(case_statement + value: (qualified_identifier (identifier) @constant)) + +(using_declaration . "using" . "namespace" . [(qualified_identifier) (identifier)] @namespace) + +(destructor_name + (identifier) @method) + +; functions +(function_declarator + (qualified_identifier + (identifier) @function)) +(function_declarator + (qualified_identifier + (qualified_identifier + (identifier) @function))) +(function_declarator + (qualified_identifier + (qualified_identifier + (qualified_identifier + (identifier) @function)))) +((qualified_identifier + (qualified_identifier + (qualified_identifier + (qualified_identifier + (identifier) @function)))) @_parent + (#has-ancestor? @_parent function_declarator)) + +(function_declarator + (template_function + (identifier) @function)) + +(operator_name) @function +"operator" @function +"static_assert" @function.builtin + +(call_expression + (qualified_identifier + (identifier) @function.call)) +(call_expression + (qualified_identifier + (qualified_identifier + (identifier) @function.call))) +(call_expression + (qualified_identifier + (qualified_identifier + (qualified_identifier + (identifier) @function.call)))) +((qualified_identifier + (qualified_identifier + (qualified_identifier + (qualified_identifier + (identifier) @function.call)))) @_parent + (#has-ancestor? @_parent call_expression)) + +(call_expression + (template_function + (identifier) @function.call)) +(call_expression + (qualified_identifier + (template_function + (identifier) @function.call))) +(call_expression + (qualified_identifier + (qualified_identifier + (template_function + (identifier) @function.call)))) +(call_expression + (qualified_identifier + (qualified_identifier + (qualified_identifier + (template_function + (identifier) @function.call))))) +((qualified_identifier + (qualified_identifier + (qualified_identifier + (qualified_identifier + (template_function + (identifier) @function.call))))) @_parent + (#has-ancestor? @_parent call_expression)) + +; methods +(function_declarator + (template_method + (field_identifier) @method)) +(call_expression + (field_expression + (field_identifier) @method.call)) + +; constructors + +((function_declarator + (qualified_identifier + (identifier) @constructor)) + (#lua-match? @constructor "^%u")) + +((call_expression + function: (identifier) @constructor) +(#lua-match? @constructor "^%u")) +((call_expression + function: (qualified_identifier + name: (identifier) @constructor)) +(#lua-match? @constructor "^%u")) + +((call_expression + function: (field_expression + field: (field_identifier) @constructor)) +(#lua-match? @constructor "^%u")) + +;; constructing a type in an initializer list: Constructor (): **SuperType (1)** +((field_initializer + (field_identifier) @constructor + (argument_list)) + (#lua-match? @constructor "^%u")) + + +; Constants + +(this) @variable.builtin +(null "nullptr" @constant.builtin) + +(true) @boolean +(false) @boolean + +; Literals + +(raw_string_literal) @string + +; Keywords + +[ + "try" + "catch" + "noexcept" + "throw" +] @exception + + +[ + "class" + "decltype" + "explicit" + "friend" + "namespace" + "override" + "template" + "typename" + "using" + "concept" + "requires" + "constexpr" +] @keyword + +[ + "co_await" +] @keyword.coroutine + +[ + "co_yield" + "co_return" +] @keyword.coroutine.return + +[ + "public" + "private" + "protected" + "virtual" + "final" +] @type.qualifier + +[ + "new" + "delete" + + "xor" + "bitand" + "bitor" + "compl" + "not" + "xor_eq" + "and_eq" + "or_eq" + "not_eq" + "and" + "or" +] @keyword.operator + +"<=>" @operator + +"::" @punctuation.delimiter + +(template_argument_list + ["<" ">"] @punctuation.bracket) + +(template_parameter_list + ["<" ">"] @punctuation.bracket) + +(literal_suffix) @operator diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpp/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpp/indents.scm new file mode 100644 index 00000000..6faa6f14 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpp/indents.scm @@ -0,0 +1,9 @@ +; inherits: c + +[ + (condition_clause) +] @indent.begin + +((field_initializer_list) @indent.begin + (#set! indent.start_at_same_line 1)) +(access_specifier) @indent.branch diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpp/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpp/injections.scm new file mode 100644 index 00000000..75f85136 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpp/injections.scm @@ -0,0 +1,13 @@ +((preproc_arg) @injection.content + (#set! injection.language "cpp")) + +((comment) @injection.content + (#set! injection.language "comment")) + +((comment) @injection.content + (#lua-match? @injection.content "/[*][!<*][^a-zA-Z]") + (#set! injection.language "doxygen")) + +(raw_string_literal + delimiter: (raw_string_delimiter) @injection.language + (raw_string_content) @injection.content) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpp/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpp/locals.scm new file mode 100644 index 00000000..570a22af --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cpp/locals.scm @@ -0,0 +1,75 @@ +; inherits: c + +;; Parameters +(variadic_parameter_declaration + declarator: (variadic_declarator + (identifier) @definition.parameter)) +(optional_parameter_declaration + declarator: (identifier) @definition.parameter) +;; Class / struct definitions +(class_specifier) @scope + +(reference_declarator + (identifier) @definition.var) + +(variadic_declarator + (identifier) @definition.var) + +(struct_specifier + name: (qualified_identifier + name: (type_identifier) @definition.type)) + +(class_specifier + name: (type_identifier) @definition.type) + +(concept_definition + name: (identifier) @definition.type) + +(class_specifier + name: (qualified_identifier + name: (type_identifier) @definition.type)) + +(alias_declaration + name: (type_identifier) @definition.type) + +;template +(type_parameter_declaration + (type_identifier) @definition.type) +(template_declaration) @scope + +;; Namespaces +(namespace_definition + name: (namespace_identifier) @definition.namespace + body: (_) @scope) + +(namespace_definition + name: (nested_namespace_specifier) @definition.namespace + body: (_) @scope) + +((namespace_identifier) @reference + (#set! reference.kind "namespace")) + +;; Function definitions +(template_function + name: (identifier) @definition.function) @scope + +(template_method + name: (field_identifier) @definition.method) @scope + +(function_declarator + declarator: (qualified_identifier + name: (identifier) @definition.function)) @scope + +(field_declaration + declarator: (function_declarator + (field_identifier) @definition.method)) + +(lambda_expression) @scope + +;; Control structures +(try_statement + body: (_) @scope) + +(catch_clause) @scope + +(requires_expression) @scope diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/css/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/css/folds.scm new file mode 100644 index 00000000..9d2995c4 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/css/folds.scm @@ -0,0 +1,3 @@ +[ + (rule_set) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/css/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/css/highlights.scm new file mode 100644 index 00000000..383d6b7d --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/css/highlights.scm @@ -0,0 +1,92 @@ +[ + "@media" + "@charset" + "@namespace" + "@supports" + "@keyframes" + (at_keyword) + (to) + (from) + ] @keyword + +"@import" @include + +(comment) @comment @spell + +[ + (tag_name) + (nesting_selector) + (universal_selector) + ] @type + +(function_name) @function + +[ + "~" + ">" + "+" + "-" + "*" + "/" + "=" + "^=" + "|=" + "~=" + "$=" + "*=" + ] @operator + +[ + "and" + "or" + "not" + "only" + ] @keyword.operator + +(important) @type.qualifier + +(attribute_selector (plain_value) @string) +(pseudo_element_selector "::" (tag_name) @property) +(pseudo_class_selector (class_name) @property) + +[ + (class_name) + (id_name) + (property_name) + (feature_name) + (attribute_name) + ] @property + +(namespace_name) @namespace + +((property_name) @type.definition + (#lua-match? @type.definition "^[-][-]")) +((plain_value) @type + (#lua-match? @type "^[-][-]")) + +[ + (string_value) + (color_value) + (unit) + ] @string + +[ + (integer_value) + (float_value) + ] @number + +[ + "#" + "," + "." + ":" + "::" + ";" + ] @punctuation.delimiter + +[ + "{" + ")" + "(" + "}" + ] @punctuation.bracket diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/css/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/css/indents.scm new file mode 100644 index 00000000..cd22ed66 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/css/indents.scm @@ -0,0 +1,9 @@ +[ + (block) + (declaration) +] @indent.begin + +(block ("}") @indent.branch) +("}") @indent.dedent + +(comment) @indent.ignore diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/css/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/css/injections.scm new file mode 100644 index 00000000..6adae45a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/css/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/csv/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/csv/highlights.scm new file mode 100644 index 00000000..de2213aa --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/csv/highlights.scm @@ -0,0 +1,3 @@ +; inherits: tsv + +"," @punctuation.delimiter diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cuda/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cuda/folds.scm new file mode 100644 index 00000000..b617fdc5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cuda/folds.scm @@ -0,0 +1 @@ +; inherits: cpp diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cuda/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cuda/highlights.scm new file mode 100644 index 00000000..275871de --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cuda/highlights.scm @@ -0,0 +1,13 @@ +; inherits: cpp + +[ "<<<" ">>>" ] @punctuation.bracket + +[ + "__host__" + "__device__" + "__global__" + "__forceinline__" + "__noinline__" +] @storageclass + +"__launch_bounds__" @type.qualifier diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cuda/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cuda/indents.scm new file mode 100644 index 00000000..b617fdc5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cuda/indents.scm @@ -0,0 +1 @@ +; inherits: cpp diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cuda/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cuda/injections.scm new file mode 100644 index 00000000..82aac968 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cuda/injections.scm @@ -0,0 +1,5 @@ +((preproc_arg) @injection.content + (#set! injection.language "cuda")) + +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cuda/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cuda/locals.scm new file mode 100644 index 00000000..b617fdc5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cuda/locals.scm @@ -0,0 +1 @@ +; inherits: cpp diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cue/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cue/folds.scm new file mode 100644 index 00000000..934b59e6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cue/folds.scm @@ -0,0 +1,5 @@ +[ + (import_spec_list) + (field) + (string) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cue/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cue/highlights.scm new file mode 100644 index 00000000..00088dec --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cue/highlights.scm @@ -0,0 +1,160 @@ +; Includes + +[ + "package" + "import" +] @include + +; Namespaces + +(package_identifier) @namespace + +(import_spec ["." "_"] @punctuation.special) + +[ + (attr_path) + (package_path) +] @text.uri ;; In attributes + +; Attributes + +(attribute) @attribute + +; Conditionals + +"if" @conditional + +; Repeats + +[ + "for" +] @repeat + +(for_clause "_" @punctuation.special) + +; Keywords + +[ + "let" +] @keyword + +[ + "in" +] @keyword.operator + +; Operators + +[ + "+" + "-" + "*" + "/" + "|" + "&" + "||" + "&&" + "==" + "!=" + "<" + "<=" + ">" + ">=" + "=~" + "!~" + "!" + "=" +] @operator + +; Fields & Properties + +(field + (label + (identifier) @field)) + +(selector_expression + (_) + (identifier) @property) + +; Functions + +(call_expression + function: (identifier) @function.call) +(call_expression + function: (selector_expression + (_) + (identifier) @function.call)) +(call_expression + function: (builtin_function) @function.call) + +(builtin_function) @function.builtin + +; Variables + +(identifier) @variable + +; Types + +(primitive_type) @type.builtin + +((identifier) @type + (#lua-match? @type "^_?#")) + +[ + (slice_type) + (pointer_type) +] @type ;; In attributes + +; Punctuation + +[ + "," + ":" +] @punctuation.delimiter + +[ "{" "}" ] @punctuation.bracket + +[ "[" "]" ] @punctuation.bracket + +[ "(" ")" ] @punctuation.bracket + +[ "<" ">" ] @punctuation.bracket + +[ + (ellipsis) + "?" +] @punctuation.special + +; Literals + +(string) @string + +[ + (escape_char) + (escape_unicode) +] @string.escape + +(number) @number + +(float) @float + +(si_unit + (float) + (_) @symbol) + +(boolean) @boolean + +[ + (null) + (top) + (bottom) +] @constant.builtin + +; Interpolations + +(interpolation "\\(" @punctuation.special (_) ")" @punctuation.special) @none + +(interpolation "\\(" (identifier) @variable ")") + +; Comments + +(comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cue/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cue/indents.scm new file mode 100644 index 00000000..71a03a77 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cue/indents.scm @@ -0,0 +1,21 @@ +[ + (import_spec_list) + (field) +] @indent.begin + +[ + "}" + "]" + ")" +] @indent.end + +[ "{" "}" ] @indent.branch + +[ "[" "]" ] @indent.branch + +[ "(" ")" ] @indent.branch + +[ + (ERROR) + (comment) +] @indent.auto diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cue/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cue/injections.scm new file mode 100644 index 00000000..6adae45a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cue/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cue/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cue/locals.scm new file mode 100644 index 00000000..b99a4fca --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/cue/locals.scm @@ -0,0 +1,34 @@ +; Scopes + +[ + (source_file) + (field) + (for_clause) +] @scope + +; References + +(identifier) @reference + +; Definitions + +(import_spec + path: (string) @definition.import) + +(field + (label + (identifier) @definition.field)) + +(package_identifier) @definition.namespace + +(for_clause + (identifier) @definition.variable + (expression)) + +(for_clause + (identifier) + (identifier) @definition.variable + (expression)) + +(let_clause + (identifier) @definition.variable) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/d/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/d/folds.scm new file mode 100644 index 00000000..be4dee45 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/d/folds.scm @@ -0,0 +1 @@ +(block_statement) @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/d/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/d/highlights.scm new file mode 100644 index 00000000..229a9bf5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/d/highlights.scm @@ -0,0 +1,288 @@ +;; Misc + +[ + (line_comment) + (block_comment) + (nesting_block_comment) +] @comment @spell + +((line_comment) @comment.documentation + (#lua-match? @comment.documentation "^///[^/]")) +((line_comment) @comment.documentation + (#lua-match? @comment.documentation "^///$")) + +((block_comment) @comment.documentation + (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$")) + +((nesting_block_comment) @comment.documentation + (#lua-match? @comment.documentation "^/[+][+][^+].*[+]/$")) + +[ + "(" ")" + "[" "]" + "{" "}" +] @punctuation.bracket + +[ + "," + ";" + "." + ":" +] @punctuation.delimiter + +[ + ".." + "$" +] @punctuation.special + +;; Constants + +[ + "__FILE_FULL_PATH__" + "__FILE__" + "__FUNCTION__" + "__LINE__" + "__MODULE__" + "__PRETTY_FUNCTION__" +] @constant.macro + +[ + (wysiwyg_string) + (alternate_wysiwyg_string) + (double_quoted_string) + (hex_string) + (delimited_string) + (token_string) +] @string + +(character_literal) @character + +(integer_literal) @number + +(float_literal) @float + +[ + "true" + "false" +] @boolean + +;; Functions + +(func_declarator + (identifier) @function +) + +[ + "__traits" + "__vector" + "assert" + "is" + "mixin" + "pragma" + "typeid" +] @function.builtin + +(import_expression + "import" @function.builtin +) + +(parameter + (var_declarator + (identifier) @parameter + ) +) + +(function_literal + (identifier) @parameter +) + +(constructor + "this" @constructor +) + +(destructor + "this" @constructor +) + +;; Keywords + +[ + "case" + "default" + "else" + "if" + "switch" +] @conditional + +[ + "break" + "continue" + "do" + "for" + "foreach" + "foreach_reverse" + "while" +] @repeat + +[ + "__parameters" + "alias" + "align" + "asm" + "auto" + "body" + "class" + "debug" + "enum" + "export" + "goto" + "interface" + "invariant" + "macro" + "out" + "override" + "package" + "static" + "struct" + "template" + "union" + "unittest" + "version" + "with" +] @keyword + +[ + "delegate" + "function" +] @keyword.function + +"return" @keyword.return + +[ + "cast" + "new" +] @keyword.operator + +[ + "+" + "++" + "+=" + "-" + "--" + "-=" + "*" + "*=" + "%" + "%=" + "^" + "^=" + "^^" + "^^=" + "/" + "/=" + "|" + "|=" + "||" + "~" + "~=" + "=" + "==" + "=>" + "<" + "<=" + "<<" + "<<=" + ">" + ">=" + ">>" + ">>=" + ">>>" + ">>>=" + "!" + "!=" + "&" + "&&" +] @operator + +[ + "catch" + "finally" + "throw" + "try" +] @exception + +"null" @constant.builtin + +[ + "__gshared" + "const" + "immutable" + "shared" +] @storageclass + +[ + "abstract" + "deprecated" + "extern" + "final" + "inout" + "lazy" + "nothrow" + "private" + "protected" + "public" + "pure" + "ref" + "scope" + "synchronized" +] @type.qualifier + +(alias_assignment + . (identifier) @type.definition) + +(module_declaration + "module" @include +) + +(import_declaration + "import" @include +) + +(type) @type + +(catch_parameter + (qualified_identifier) @type +) + +(var_declarations + (qualified_identifier) @type +) + +(func_declaration + (qualified_identifier) @type +) + +(parameter + (qualified_identifier) @type +) + +(class_declaration + (identifier) @type +) + +(fundamental_type) @type.builtin + +(module_fully_qualified_name (packages (package_name) @namespace)) +(module_name) @namespace + +(at_attribute) @attribute + +(user_defined_attribute + "@" @attribute +) + +;; Variables + +(primary_expression + "this" @variable.builtin +) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/d/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/d/indents.scm new file mode 100644 index 00000000..9ced7527 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/d/indents.scm @@ -0,0 +1,17 @@ +[ + (block_statement) + (case_statement) + (token_string) +] @indent.begin + +[ + "(" ")" + "{" "}" + "[" "]" +] @indent.branch + +[ + (line_comment) + (block_comment) + (nesting_block_comment) +] @indent.ignore diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/d/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/d/injections.scm new file mode 100644 index 00000000..6dd8aeac --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/d/injections.scm @@ -0,0 +1,9 @@ +([ + (line_comment) + (block_comment) + (nesting_block_comment) + ] @injection.content + (#set! injection.language "comment")) + +((token_string_tokens) @injection.content + (#set! injection.language "d")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dart/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dart/folds.scm new file mode 100644 index 00000000..ea398a4b --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dart/folds.scm @@ -0,0 +1,15 @@ +[ + (class_definition) + (enum_declaration) + (extension_declaration) + + (arguments) + (function_body) + + (block) + (switch_block) + + (list_literal) + (set_or_map_literal) + (string_literal) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dart/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dart/highlights.scm new file mode 100644 index 00000000..3ebdae0e --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dart/highlights.scm @@ -0,0 +1,270 @@ +(dotted_identifier_list) @string + +; Methods +; -------------------- +(super) @function + +; TODO: add method/call_expression to grammar and +; distinguish method call from variable access +(function_expression_body (identifier) @function) +; ((identifier)(selector (argument_part)) @function) + +; NOTE: This query is a bit of a work around for the fact that the dart grammar doesn't +; specifically identify a node as a function call +(((identifier) @function (#lua-match? @function "^_?[%l]")) + . (selector . (argument_part))) @function + +; Annotations +; -------------------- +(annotation + name: (identifier) @attribute) + +; Operators and Tokens +; -------------------- +(template_substitution + "$" @punctuation.special + "{" @punctuation.special + "}" @punctuation.special +) @none + +(template_substitution + "$" @punctuation.special + (identifier_dollar_escaped) @variable +) @none + +(escape_sequence) @string.escape + +[ + "@" + "=>" + ".." + "??" + "==" + "?" + ":" + "&&" + "%" + "<" + ">" + "=" + ">=" + "<=" + "||" + (multiplicative_operator) + (increment_operator) + (is_operator) + (prefix_operator) + (equality_operator) + (additive_operator) +] @operator + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +; Delimiters +; -------------------- +[ + ";" + "." + "," +] @punctuation.delimiter + +; Types +; -------------------- +(class_definition + name: (identifier) @type) +(constructor_signature + name: (identifier) @type) +(scoped_identifier + scope: (identifier) @type) +(function_signature + name: (identifier) @method) +(getter_signature + (identifier) @method) +(setter_signature + name: (identifier) @method) +(enum_declaration + name: (identifier) @type) +(enum_constant + name: (identifier) @type) +(void_type) @type + +((scoped_identifier + scope: (identifier) @type + name: (identifier) @type) + (#lua-match? @type "^[%u%l]")) + +(type_identifier) @type + +(type_alias + (type_identifier) @type.definition) + +; Variables +; -------------------- +; var keyword +(inferred_type) @keyword + +((identifier) @type + (#lua-match? @type "^_?[%u].*[%l]")) ; catch Classes or IClasses not CLASSES + +("Function" @type) + +; properties +(unconditional_assignable_selector + (identifier) @property) + +(conditional_assignable_selector + (identifier) @property) + +; assignments +(assignment_expression + left: (assignable_expression) @variable) + +(this) @variable.builtin + +; Parameters +; -------------------- +(formal_parameter + name: (identifier) @parameter) + +(named_argument + (label (identifier) @parameter)) + +; Literals +; -------------------- +[ + (hex_integer_literal) + (decimal_integer_literal) + (decimal_floating_point_literal) + ; TODO: inaccessible nodes + ; (octal_integer_literal) + ; (hex_floating_point_literal) +] @number + +(symbol_literal) @symbol +(string_literal) @string +(true) @boolean +(false) @boolean +(null_literal) @constant.builtin + +(comment) @comment @spell +(documentation_comment) @comment.documentation @spell + +; Keywords +; -------------------- +[ + "import" + "library" + "export" + "as" + "show" + "hide" +] @include + +; Reserved words (cannot be used as identifiers) +[ + ; TODO: + ; "rethrow" cannot be targeted at all and seems to be an invisible node + ; TODO: + ; the assert keyword cannot be specifically targeted + ; because the grammar selects the whole node or the content + ; of the assertion not just the keyword + ; assert + (case_builtin) + "late" + "required" + "extension" + "on" + "class" + "enum" + "extends" + "in" + "is" + "new" + "super" + "with" +] @keyword + +[ + "return" +] @keyword.return + + +; Built in identifiers: +; alone these are marked as keywords +[ + "deferred" + "factory" + "get" + "implements" + "interface" + "library" + "operator" + "mixin" + "part" + "set" + "typedef" +] @keyword + +[ + "async" + "async*" + "sync*" + "await" + "yield" +] @keyword.coroutine + +[ + (const_builtin) + (final_builtin) + "abstract" + "covariant" + "dynamic" + "external" + "static" + "final" + "base" + "sealed" +] @type.qualifier + +; when used as an identifier: +((identifier) @variable.builtin + (#any-of? @variable.builtin + "abstract" + "as" + "covariant" + "deferred" + "dynamic" + "export" + "external" + "factory" + "Function" + "get" + "implements" + "import" + "interface" + "library" + "operator" + "mixin" + "part" + "set" + "static" + "typedef")) + +["if" "else" "switch" "default"] @conditional + +[ + "try" + "throw" + "catch" + "finally" + (break_statement) +] @exception + +["do" "while" "continue" "for"] @repeat diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dart/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dart/indents.scm new file mode 100644 index 00000000..87befcf6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dart/indents.scm @@ -0,0 +1,45 @@ +[ + (class_body) + (function_body) + (function_expression_body) + (declaration (initializers)) + (switch_block) + (if_statement) + (formal_parameter_list) + (formal_parameter) + (list_literal) + (return_statement) + (arguments) + (try_statement) +] @indent.begin + +(switch_block + (_) @indent.begin + (#set! indent.immediate 1) + (#set! indent.start_at_same_line 1)) + +[ + (switch_statement_case) + (switch_statement_default) +] @indent.branch + +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @indent.branch + +[ + "}" +] @indent.end + +(return_statement ";" @indent.end) +(break_statement ";" @indent.end) + +; this one is for dedenting the else block +(if_statement (block) @indent.branch) + +(comment) @indent.ignore diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dart/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dart/injections.scm new file mode 100644 index 00000000..6adae45a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dart/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dart/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dart/locals.scm new file mode 100644 index 00000000..2184bab1 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dart/locals.scm @@ -0,0 +1,34 @@ +;; Definitions + +(function_signature + name: (identifier) @definition.function) + +(formal_parameter + name: (identifier) @definition.parameter) + +(initialized_variable_definition + name: (identifier) @definition.var) + +(initialized_identifier + (identifier) @definition.var) + +(static_final_declaration + (identifier) @definition.var) + +;; References + +(identifier) @reference + +;; Scopes + +(class_definition + body: (_) @scope) +[ + (block) + (if_statement) + (for_statement) + (while_statement) + (try_statement) + (catch_clause) + (finally_clause) +] @scope diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/devicetree/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/devicetree/folds.scm new file mode 100644 index 00000000..206c4bed --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/devicetree/folds.scm @@ -0,0 +1 @@ +(node) @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/devicetree/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/devicetree/highlights.scm new file mode 100644 index 00000000..a7504260 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/devicetree/highlights.scm @@ -0,0 +1,35 @@ +(comment) @comment @spell + +[ + (preproc_include) + (dtsi_include) +] @include + +(preproc_def) @constant.macro +(preproc_function_def) @function.macro + +[ + (memory_reservation) + (file_version) +] @attribute + +[ + (string_literal) + (byte_string_literal) + (system_lib_string) +] @string + +(integer_literal) @number + +(identifier) @variable +(node (identifier) @namespace) +(property (identifier) @property) +(labeled_item (identifier) @label) +(call_expression (identifier) @function.macro) + +(reference) @label ; referencing labeled_item.identifier +(unit_address) @constant + +[ "=" ] @operator +[ "(" ")" "[" "]" "{" "}" "<" ">" ] @punctuation.bracket +[ ";" ":" "," "@" ] @punctuation.delimiter diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/devicetree/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/devicetree/indents.scm new file mode 100644 index 00000000..6cfc81cf --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/devicetree/indents.scm @@ -0,0 +1,14 @@ +[ + (node) + (property) + (integer_cells) +] @indent.begin + +[ + "}" + ">" +] @indent.branch + +[ + (comment) +] @indent.ignore diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/devicetree/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/devicetree/injections.scm new file mode 100644 index 00000000..6adae45a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/devicetree/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/devicetree/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/devicetree/locals.scm new file mode 100644 index 00000000..95b124bd --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/devicetree/locals.scm @@ -0,0 +1,4 @@ +[ + (node) + (integer_cells) +]@scope diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dhall/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dhall/folds.scm new file mode 100644 index 00000000..305079aa --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dhall/folds.scm @@ -0,0 +1,14 @@ +[ + (let_binding) + + (application_expression) + (lambda_expression) + + (record_type) + (union_type) + + (list_literal) + (record_literal) + + (block_comment) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dhall/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dhall/highlights.scm new file mode 100644 index 00000000..cd068efd --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dhall/highlights.scm @@ -0,0 +1,171 @@ +;; Text + +;; Imports + +(missing_import) @include + +(local_import) @string.special.path + +(http_import) @string @text.uri + +[ + (env_variable) + (import_hash) +] @string.special + +[ (import_as_location) (import_as_text) ] @type + +;; Types + +([ + (let_binding (label) @type) + (union_type_entry (label) @type) +] (#lua-match? @type "^%u")) + +((primitive_expression + (identifier (label) @type) + (selector (label) @type)) @variable + (#lua-match? @variable "^[A-Z][^.]*$")) + +;; Parameters + +(lambda_expression label: (label) @parameter) + +;; Variables + +(label) @variable + +(identifier [ + (label) @variable + (de_bruijn_index) @operator +]) + +(let_binding label: (label) @variable) + +; Fields + +(record_literal_entry (label) @field) + +(record_type_entry (label) @field) + +(selector + (selector_dot) + (_) @field) + +;; Keywords + +(env_import) @keyword + +[ + "let" + "in" + "assert" +] @keyword + +[ + "using" + "as" + "with" +] @keyword.operator + +;; Operators + +[ + (type_operator) + (assign_operator) + (lambda_operator) + (arrow_operator) + (infix_operator) + (completion_operator) + (assert_operator) + (forall_operator) + (empty_record_literal) +] @operator + +;; Builtins + +(builtin_function) @function.builtin +(builtin [ + "Natural" + "Natural/build" + "Natural/fold" + "Natural/isZero" + "Natural/even" + "Natural/odd" + "Natural/subtract" + "Natural/toInteger" + "Natural/show" + "Integer" + "Integer/toDouble" + "Integer/show" + "Integer/negate" + "Integer/clamp" + "Double" + "Double/show" + "List" + "List/build" + "List/fold" + "List/length" + "List/head" + "List/last" + "List/indexed" + "List/reverse" + "Text" + "Text/show" + "Text/replace" + "Optional" + "Date" + "Time" + "TimeZone" + "Type" + "Kind" + "Sort" +] @type.builtin) + +;; Punctuation + +[ "," "|" ] @punctuation.delimiter +(selector_dot) @punctuation.delimiter + +[ "{" "}" ] @punctuation.bracket + +[ "[" "]" ] @punctuation.bracket + +[ "(" ")" ] @punctuation.bracket + +[ "<" ">" ] @punctuation.bracket + +;; Conditionals + +[ + "if" + "then" + "else" +] @conditional + +;; Literals + +(text_literal) @string +(interpolation "}" @string) +[ + (double_quote_escaped) + (single_quote_escaped) +] @string.escape + +[ + (integer_literal) + (natural_literal) +] @number + +(double_literal) @float + +(boolean_literal) @boolean + +(builtin "None") @constant.builtin + +;; Comments + +[ + (line_comment) + (block_comment) +] @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dhall/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dhall/injections.scm new file mode 100644 index 00000000..43ae7287 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dhall/injections.scm @@ -0,0 +1,5 @@ +([ + (line_comment) + (block_comment) + ] @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/diff/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/diff/highlights.scm new file mode 100644 index 00000000..4b9cbad6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/diff/highlights.scm @@ -0,0 +1,6 @@ +[(addition) (new_file)] @text.diff.add +[(deletion) (old_file)] @text.diff.delete + +(commit) @constant +(location) @attribute +(command) @function diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dockerfile/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dockerfile/highlights.scm new file mode 100644 index 00000000..592e7042 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dockerfile/highlights.scm @@ -0,0 +1,57 @@ +[ + "FROM" + "AS" + "RUN" + "CMD" + "LABEL" + "EXPOSE" + "ENV" + "ADD" + "COPY" + "ENTRYPOINT" + "VOLUME" + "USER" + "WORKDIR" + "ARG" + "ONBUILD" + "STOPSIGNAL" + "HEALTHCHECK" + "SHELL" + "MAINTAINER" + "CROSS_BUILD" +] @keyword + +[ + ":" + "@" +] @operator + +(comment) @comment @spell + +(image_spec + (image_tag + ":" @punctuation.special) + (image_digest + "@" @punctuation.special)) + +(double_quoted_string) @string + +(expansion + [ + "$" + "{" + "}" + ] @punctuation.special +) + +((variable) @constant + (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) + +(arg_instruction + . (unquoted_string) @property) + +(env_instruction + (env_pair . (unquoted_string) @property)) + +(expose_instruction + (expose_port) @number) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dockerfile/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dockerfile/injections.scm new file mode 100644 index 00000000..0eb9ffdf --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dockerfile/injections.scm @@ -0,0 +1,6 @@ +((comment) @injection.content + (#set! injection.language "comment")) + +((shell_command) @injection.content + (#set! injection.language "bash") + (#set! injection.include-children)) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dot/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dot/highlights.scm new file mode 100644 index 00000000..6916d372 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dot/highlights.scm @@ -0,0 +1,53 @@ +(identifier) @type + +[ + "strict" + "graph" + "digraph" + "subgraph" + "node" + "edge" +] @keyword + +(string_literal) @string +(number_literal) @number + +[ + (edgeop) + (operator) +] @operator + +[ + "," + ";" +] @punctuation.delimiter + +[ + "{" + "}" + "[" + "]" + "<" + ">" +] @punctuation.bracket + +(subgraph + id: (id + (identifier) @namespace) +) + +(attribute + name: (id + (identifier) @field) +) + +(attribute + value: (id + (identifier) @constant) +) + +(comment) @comment + +(preproc) @preproc + +(comment) @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dot/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dot/injections.scm new file mode 100644 index 00000000..ac41393a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dot/injections.scm @@ -0,0 +1,5 @@ +((html_internal) @injection.content + (#set! injection.language "html")) + +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/doxygen/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/doxygen/highlights.scm new file mode 100644 index 00000000..42d76a44 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/doxygen/highlights.scm @@ -0,0 +1,53 @@ +((tag_name) @keyword + (#set! "priority" 105)) + +[ + "@code" + "@endcode" +] @keyword + +(identifier) @variable + +((tag + (tag_name) @_param + (identifier) @parameter) + (#any-of? @_param "@param" "\\param")) + +(function (identifier) @function) + +(function_link) @function + +(emphasis) @text.emphasis + +[ + "\\a" + "\\c" +] @tag + +(code_block_language) @label + +[ + "in" + "out" + "inout" +] @storageclass + +"~" @operator + +[ + "" + "" +] @tag + +[ + "." + "," + "::" + (code_block_start) + (code_block_end) +] @punctuation.delimiter + +[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket + +(code_block_content) @none diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/doxygen/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/doxygen/indents.scm new file mode 100644 index 00000000..ef30f1e7 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/doxygen/indents.scm @@ -0,0 +1 @@ +(document) @indent.auto diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/doxygen/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/doxygen/injections.scm new file mode 100644 index 00000000..8353dfd7 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/doxygen/injections.scm @@ -0,0 +1,12 @@ +((type) @injection.content + (#set! injection.parent)) + +([ (function_link) (code) ] @injection.content + (#set! injection.parent)) + +((link) @injection.content + (#set! injection.language "html")) + +((code_block + (code_block_language) @injection.language + (code_block_content) @injection.content)) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dtd/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dtd/folds.scm new file mode 100644 index 00000000..ba7ea121 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dtd/folds.scm @@ -0,0 +1,4 @@ +[ + (conditionalSect) + (Comment) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dtd/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dtd/highlights.scm new file mode 100644 index 00000000..678e61f9 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dtd/highlights.scm @@ -0,0 +1,119 @@ +;; XML declaration + +(XMLDecl "xml" @preproc) + +(XMLDecl [ "version" "encoding" ] @tag.attribute) + +(XMLDecl (EncName) @string.special) + +(XMLDecl (VersionNum) @number) + +;; Processing instructions + +(PI) @preproc + +;; Element declaration + +(elementdecl + "ELEMENT" @define + (Name) @tag) + +(contentspec + (_ (Name) @tag.attribute)) + +"#PCDATA" @type.builtin + +[ "EMPTY" "ANY" ] @type.qualifier + +[ "*" "?" "+" ] @character.special + +;; Entity declaration + +(GEDecl + "ENTITY" @define + (Name) @constant) + +(GEDecl (EntityValue) @string) + +(NDataDecl + "NDATA" @keyword + (Name) @label) + +;; Parsed entity declaration + +(PEDecl + "ENTITY" @define + "%" @operator + (Name) @function.macro) + +(PEDecl (EntityValue) @string) + +;; Notation declaration + +(NotationDecl + "NOTATION" @preproc + (Name) @label) + +((NotationDecl + (ExternalID + (SystemLiteral (URI) @string.special)) + (#set! "priority" 105))) + +;; Attlist declaration + +(AttlistDecl + "ATTLIST" @define + (Name) @tag) + +(AttDef (Name) @tag.attribute) + +(AttDef (Enumeration (Nmtoken) @string)) + +[ + (StringType) + (TokenizedType) +] @type.builtin + +(NotationType "NOTATION" @type.builtin) + +[ + "#REQUIRED" + "#IMPLIED" + "#FIXED" +] @attribute + +;; Entities + +(EntityRef) @constant + +((EntityRef) @constant.builtin + (#any-of? @constant.builtin + "&" "<" ">" """ "'")) + +(CharRef) @character + +(PEReference) @function.macro + +;; External references + +[ "PUBLIC" "SYSTEM" ] @keyword + +(PubidLiteral) @string.special + +(SystemLiteral (URI) @text.uri) + +;; Delimiters & punctuation + +[ "" "" "]]>" ] @tag.delimiter + +[ "(" ")" "[" ] @punctuation.bracket + +[ "\"" "'" ] @punctuation.delimiter + +[ "," "|" "=" ] @operator + +;; Misc + +[ "INCLUDE" "IGNORE" ] @include + +(Comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dtd/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dtd/injections.scm new file mode 100644 index 00000000..ed5557a0 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dtd/injections.scm @@ -0,0 +1 @@ +(Comment) @comment diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dtd/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dtd/locals.scm new file mode 100644 index 00000000..7efcdd03 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/dtd/locals.scm @@ -0,0 +1,7 @@ +(elementdecl (Name) @definition.type) + +(elementdecl + (contentspec + (children (Name) @reference))) + +(AttlistDecl . (Name) @reference) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ebnf/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ebnf/highlights.scm new file mode 100644 index 00000000..00acf59e --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ebnf/highlights.scm @@ -0,0 +1,43 @@ +;;;; Simple tokens ;;;; +(terminal) @string.grammar + +(special_sequence) @string.special.grammar + +(integer) @number + +(comment) @comment @spell + +;;;; Identifiers ;;;; + +; Allow different highlighting for specific casings +((identifier) @type + (#lua-match? @type "^%u")) + +((identifier) @symbol + (#lua-match? @symbol "^%l")) + +((identifier) @constant + (#lua-match? @constant "^%u[%u%d_]+$")) + +;;; Punctuation ;;;; +[ + ";" + "," +] @punctuation.delimiter + +[ + "|" + "*" + "-" +] @operator + +"=" @keyword.operator + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ecma/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ecma/folds.scm new file mode 100644 index 00000000..50f235a5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ecma/folds.scm @@ -0,0 +1,22 @@ +[ + (for_in_statement) + (for_statement) + (while_statement) + (arrow_function) + (function) + (function_declaration) + (class_declaration) + (method_definition) + (do_statement) + (with_statement) + (switch_statement) + (switch_case) + (switch_default) + (import_statement) + (if_statement) + (try_statement) + (catch_clause) + (object) + (generator_function) + (generator_function_declaration) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ecma/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ecma/highlights.scm new file mode 100644 index 00000000..66442170 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ecma/highlights.scm @@ -0,0 +1,360 @@ +; Types + +; Javascript + +; Variables +;----------- +(identifier) @variable + +; Properties +;----------- + +(property_identifier) @property +(shorthand_property_identifier) @property +(private_property_identifier) @property + +(variable_declarator + name: (object_pattern + (shorthand_property_identifier_pattern))) @variable + +; Special identifiers +;-------------------- + +((identifier) @type + (#lua-match? @type "^[A-Z]")) + +((identifier) @constant + (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) + +((shorthand_property_identifier) @constant + (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) + +((identifier) @variable.builtin + (#any-of? @variable.builtin + "arguments" + "module" + "console" + "window" + "document")) + +((identifier) @type.builtin + (#any-of? @type.builtin + "Object" + "Function" + "Boolean" + "Symbol" + "Number" + "Math" + "Date" + "String" + "RegExp" + "Map" + "Set" + "WeakMap" + "WeakSet" + "Promise" + "Array" + "Int8Array" + "Uint8Array" + "Uint8ClampedArray" + "Int16Array" + "Uint16Array" + "Int32Array" + "Uint32Array" + "Float32Array" + "Float64Array" + "ArrayBuffer" + "DataView" + "Error" + "EvalError" + "InternalError" + "RangeError" + "ReferenceError" + "SyntaxError" + "TypeError" + "URIError")) + +; Function and method definitions +;-------------------------------- + +(function + name: (identifier) @function) +(function_declaration + name: (identifier) @function) +(generator_function + name: (identifier) @function) +(generator_function_declaration + name: (identifier) @function) +(method_definition + name: [(property_identifier) (private_property_identifier)] @method) +(method_definition + name: (property_identifier) @constructor + (#eq? @constructor "constructor")) + +(pair + key: (property_identifier) @method + value: (function)) +(pair + key: (property_identifier) @method + value: (arrow_function)) + +(assignment_expression + left: (member_expression + property: (property_identifier) @method) + right: (arrow_function)) +(assignment_expression + left: (member_expression + property: (property_identifier) @method) + right: (function)) + +(variable_declarator + name: (identifier) @function + value: (arrow_function)) +(variable_declarator + name: (identifier) @function + value: (function)) + +(assignment_expression + left: (identifier) @function + right: (arrow_function)) +(assignment_expression + left: (identifier) @function + right: (function)) + +; Function and method calls +;-------------------------- + +(call_expression + function: (identifier) @function.call) + +(call_expression + function: (member_expression + property: [(property_identifier) (private_property_identifier)] @method.call)) + +; Builtins +;--------- + +((identifier) @namespace.builtin + (#eq? @namespace.builtin "Intl")) + +((identifier) @function.builtin + (#any-of? @function.builtin + "eval" + "isFinite" + "isNaN" + "parseFloat" + "parseInt" + "decodeURI" + "decodeURIComponent" + "encodeURI" + "encodeURIComponent" + "require")) + +; Constructor +;------------ + +(new_expression + constructor: (identifier) @constructor) + +; Variables +;---------- +(namespace_import + (identifier) @namespace) + +; Decorators +;---------- +(decorator "@" @attribute (identifier) @attribute) +(decorator "@" @attribute (call_expression (identifier) @attribute)) + +; Literals +;--------- + +[ + (this) + (super) +] @variable.builtin + +((identifier) @variable.builtin + (#eq? @variable.builtin "self")) + +[ + (true) + (false) +] @boolean + +[ + (null) + (undefined) +] @constant.builtin + +(comment) @comment @spell + +((comment) @comment.documentation + (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$")) + +(hash_bang_line) @preproc + +((string_fragment) @preproc + (#eq? @preproc "use strict")) + +(string) @string +(template_string) @string +(escape_sequence) @string.escape +(regex_pattern) @string.regex +(regex_flags) @character.special +(regex "/" @punctuation.bracket) ; Regex delimiters + +(number) @number +((identifier) @number + (#any-of? @number "NaN" "Infinity")) + +; Punctuation +;------------ + +";" @punctuation.delimiter +"." @punctuation.delimiter +"," @punctuation.delimiter + +(pair ":" @punctuation.delimiter) +(pair_pattern ":" @punctuation.delimiter) +(switch_case ":" @punctuation.delimiter) +(switch_default ":" @punctuation.delimiter) + +[ + "--" + "-" + "-=" + "&&" + "+" + "++" + "+=" + "&=" + "/=" + "**=" + "<<=" + "<" + "<=" + "<<" + "=" + "==" + "===" + "!=" + "!==" + "=>" + ">" + ">=" + ">>" + "||" + "%" + "%=" + "*" + "**" + ">>>" + "&" + "|" + "^" + "??" + "*=" + ">>=" + ">>>=" + "^=" + "|=" + "&&=" + "||=" + "??=" + "..." +] @operator + +(binary_expression "/" @operator) +(ternary_expression ["?" ":"] @conditional.ternary) +(unary_expression ["!" "~" "-" "+"] @operator) +(unary_expression ["delete" "void"] @keyword.operator) + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +((template_substitution ["${" "}"] @punctuation.special) @none) + +; Keywords +;---------- + +[ + "if" + "else" + "switch" + "case" +] @conditional + +[ + "import" + "from" +] @include + +(export_specifier "as" @include) +(import_specifier "as" @include) +(namespace_export "as" @include) +(namespace_import "as" @include) + +[ + "for" + "of" + "do" + "while" + "continue" +] @repeat + +[ + "break" + "class" + "const" + "debugger" + "export" + "extends" + "get" + "let" + "set" + "static" + "target" + "var" + "with" +] @keyword + +[ + "async" + "await" +] @keyword.coroutine + +[ + "return" + "yield" +] @keyword.return + +[ + "function" +] @keyword.function + +[ + "new" + "delete" + "in" + "instanceof" + "typeof" +] @keyword.operator + +[ + "throw" + "try" + "catch" + "finally" +] @exception + +(export_statement + "default" @keyword) +(switch_default + "default" @conditional) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ecma/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ecma/indents.scm new file mode 100644 index 00000000..538c5bdc --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ecma/indents.scm @@ -0,0 +1,57 @@ +[ + (arguments) + (array) + (binary_expression) + (class_body) + (export_clause) + (formal_parameters) + (named_imports) + (object) + (object_pattern) + (parenthesized_expression) + (return_statement) + (statement_block) + (switch_case) + (switch_default) + (switch_statement) + (template_substitution) + (ternary_expression) +] @indent.begin + +(arguments (call_expression) @indent.begin) +(binary_expression (call_expression) @indent.begin) +(expression_statement (call_expression) @indent.begin) +(arrow_function + body: (_) @_body + (#not-has-type? @_body statement_block) +) @indent.begin +(assignment_expression + right: (_) @_right + (#not-has-type? @_right arrow_function function) +) @indent.begin +(variable_declarator + value: (_) @_value + (#not-has-type? @_value arrow_function call_expression function) +) @indent.begin + +(arguments ")" @indent.end) +(object "}" @indent.end) +(statement_block "}" @indent.end) + +[ + (arguments (object)) + ")" + "}" + "]" +] @indent.branch +(statement_block "{" @indent.branch) + +(parenthesized_expression ("(" (_) ")" @indent.end)) +["}" "]"] @indent.end + +(template_string) @indent.ignore + +[ + (comment) + (ERROR) +] @indent.auto diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ecma/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ecma/injections.scm new file mode 100644 index 00000000..97dbbb62 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ecma/injections.scm @@ -0,0 +1,121 @@ +(((comment) @_jsdoc_comment + (#lua-match? @_jsdoc_comment "^/[*][*][^*].*[*]/$")) @injection.content + (#set! injection.language "jsdoc")) + +((comment) @injection.content + (#set! injection.language "comment")) + +; html(`...`), html`...`, sql(...) etc +(call_expression + function: ((identifier) @injection.language) + arguments: [ + (arguments + (template_string) @injection.content) + (template_string) @injection.content + ] + (#lua-match? @injection.language "^[a-zA-Z][a-zA-Z0-9]*$") + (#offset! @injection.content 0 1 0 -1) + (#not-eq? @injection.language "svg")) + +; svg`...` or svg(`...`), which uses the html parser, so is not included in the previous query +(call_expression + function: ((identifier) @_name (#eq? @_name "svg")) + arguments: [ + (arguments + (template_string) @injection.content) + (template_string) @injection.content + ] + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "html")) + + +(call_expression + function: ((identifier) @_name + (#eq? @_name "gql")) + arguments: ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "graphql"))) + +(call_expression + function: ((identifier) @_name + (#eq? @_name "hbs")) + arguments: ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "glimmer"))) + +((glimmer_template) @injection.content + (#set! injection.language "glimmer")) + +; styled.div`` +(call_expression + function: (member_expression + object: (identifier) @_name + (#eq? @_name "styled")) + arguments: ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "styled"))) + +; styled(Component)`` +(call_expression + function: (call_expression + function: (identifier) @_name + (#eq? @_name "styled")) + arguments: ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "styled"))) + +; styled.div.attrs({ prop: "foo" })`` +(call_expression + function: (call_expression + function: (member_expression + object: (member_expression + object: (identifier) @_name + (#eq? @_name "styled")))) + arguments: ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "styled"))) + + +; styled(Component).attrs({ prop: "foo" })`` +(call_expression + function: (call_expression + function: (member_expression + object: (call_expression + function: (identifier) @_name + (#eq? @_name "styled")))) + arguments: ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "styled"))) + +((regex_pattern) @injection.content + (#set! injection.language "regex")) + +; ((comment) @_gql_comment +; (#eq? @_gql_comment "/* GraphQL */") +; (template_string) @injection.content +; (#set! injection.language "graphql")) + +((template_string) @injection.content + (#lua-match? @injection.content "^`#graphql") + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "graphql")) + +; el.innerHTML = `` +(assignment_expression + left: + (member_expression + property: (property_identifier) @_prop + (#any-of? @_prop "outerHTML" "innerHTML")) + right: (template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "html")) + +; el.innerHTML = '' +(assignment_expression + left: + (member_expression + property: (property_identifier) @_prop + (#any-of? @_prop "outerHTML" "innerHTML")) + right: + (string (string_fragment) @injection.content) + (#set! injection.language "html")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ecma/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ecma/locals.scm new file mode 100644 index 00000000..4c035d26 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/ecma/locals.scm @@ -0,0 +1,37 @@ +; Scopes +;------- + +(statement_block) @scope +(function) @scope +(arrow_function) @scope +(function_declaration) @scope +(method_definition) @scope +(for_statement) @scope +(for_in_statement) @scope +(catch_clause) @scope + +; Definitions +;------------ + +(variable_declarator + name: (identifier) @definition.var) + +(import_specifier + (identifier) @definition.import) + +(namespace_import + (identifier) @definition.import) + +(function_declaration + ((identifier) @definition.function) + (#set! definition.var.scope parent)) + +(method_definition + ((property_identifier) @definition.function) + (#set! definition.var.scope parent)) + +; References +;------------ + +(identifier) @reference +(shorthand_property_identifier) @reference diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/eds/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/eds/folds.scm new file mode 100644 index 00000000..911798f5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/eds/folds.scm @@ -0,0 +1 @@ +(section) @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/eds/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/eds/highlights.scm new file mode 100644 index 00000000..42f40875 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/eds/highlights.scm @@ -0,0 +1,49 @@ +"=" @punctuation.delimiter + +[ "[" "]" ] @punctuation.bracket + +((section_name) @variable.builtin + (#match? @variable.builtin "\\c^(FileInfo|DeviceInfo|DummyUsage|MandatoryObjects|OptionalObjects)$")) + +((section_name) @variable.builtin + (#lua-match? @variable.builtin "^1")) + +(section + (section_name) @_name + (#match? @_name "\\c^Comments$")) @comment + +(section + (section_name) @_name + (statement (key) @_key) @string + (#match? @_key "\\c^ParameterName$") + (#not-match? @_name "\\c^Comments$")) + +(section + (section_name) @_name + (statement (key) @_key) @type + (#match? @_key "\\c^ObjectType$") + (#not-match? @_name "\\c^Comments$")) + +(section + (section_name) @_name + (statement (key) @_key) @type + (#match? @_key "\\c^DataType$") + (#not-match? @_name "\\c^Comments$")) + +(section + (section_name) @_name + (statement (key) @_key) @type.qualifier + (#match? @_key "\\c^AccessType$") + (#not-match? @_name "\\c^Comments$")) + +(section + (section_name) @_name + (statement (key) @_key) @attribute + (#match? @_key "\\c^PDOMapping$") + (#not-match? @_name "\\c^Comments$")) + +(section + (section_name) @_name + (statement (key) @_key) @number + (#match? @_key "\\c^(DefaultValue|LowLimit|HighLimit|SubNumber)$") + (#not-match? @_name "\\c^Comments$")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/eex/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/eex/highlights.scm new file mode 100644 index 00000000..d032a748 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/eex/highlights.scm @@ -0,0 +1,12 @@ +[ + "%>" + "--%>" + "<%!--" + "<%" + "<%#" + "<%%=" + "<%=" +] @tag.delimiter + +; EEx comments are highlighted as such +(comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/eex/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/eex/injections.scm new file mode 100644 index 00000000..9331f592 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/eex/injections.scm @@ -0,0 +1,8 @@ +; EEx expressions are Elixir +((expression) @injection.content + (#set! injection.language "elixir")) + +; EEx expressions can span multiple interpolated lines +((partial_expression) @injection.content + (#set! injection.language "elixir") + (#set! injection.combined)) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elixir/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elixir/folds.scm new file mode 100644 index 00000000..b99a6d9e --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elixir/folds.scm @@ -0,0 +1,9 @@ +[ + (anonymous_function) + (arguments) + (block) + (do_block) + (list) + (map) + (tuple) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elixir/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elixir/highlights.scm new file mode 100644 index 00000000..0fbde295 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elixir/highlights.scm @@ -0,0 +1,224 @@ +; Punctuation +[ + "," + ";" +] @punctuation.delimiter + +[ + "(" + ")" + "<<" + ">>" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +[ + "%" +] @punctuation.special + +; Identifiers +(identifier) @variable + +; Unused Identifiers +((identifier) @comment (#lua-match? @comment "^_")) + +; Comments +(comment) @comment @spell + +; Strings +(string) @string + +; Modules +(alias) @type + +; Atoms & Keywords +[ + (atom) + (quoted_atom) + (keyword) + (quoted_keyword) +] @symbol + +; Interpolation +(interpolation ["#{" "}"] @string.special) + +; Escape sequences +(escape_sequence) @string.escape + +; Integers +(integer) @number + +; Floats +(float) @float + +; Characters +[ + (char) + (charlist) +] @character + +; Booleans +(boolean) @boolean + +; Nil +(nil) @constant.builtin + +; Operators +(operator_identifier) @operator + +(unary_operator operator: _ @operator) + +(binary_operator operator: _ @operator) + +; Pipe Operator +(binary_operator operator: "|>" right: (identifier) @function) + +(dot operator: _ @operator) + +(stab_clause operator: _ @operator) + +; Local Function Calls +(call target: (identifier) @function.call) + +; Remote Function Calls +(call target: (dot left: [ + (atom) @type + (_) +] right: (identifier) @function.call) (arguments)) + +; Definition Function Calls +(call target: ((identifier) @keyword.function (#any-of? @keyword.function + "def" + "defdelegate" + "defexception" + "defguard" + "defguardp" + "defimpl" + "defmacro" + "defmacrop" + "defmodule" + "defn" + "defnp" + "defoverridable" + "defp" + "defprotocol" + "defstruct" + )) + (arguments [ + (call (identifier) @function) + (identifier) @function + (binary_operator left: (call target: (identifier) @function) operator: "when")])?) + +; Kernel Keywords & Special Forms +(call target: ((identifier) @keyword (#any-of? @keyword + "alias" + "case" + "catch" + "cond" + "else" + "for" + "if" + "import" + "quote" + "raise" + "receive" + "require" + "reraise" + "super" + "throw" + "try" + "unless" + "unquote" + "unquote_splicing" + "use" + "with" +))) + +; Special Constants +((identifier) @constant.builtin (#any-of? @constant.builtin + "__CALLER__" + "__DIR__" + "__ENV__" + "__MODULE__" + "__STACKTRACE__" +)) + +; Reserved Keywords +[ + "after" + "catch" + "do" + "end" + "fn" + "rescue" + "when" + "else" +] @keyword + +; Operator Keywords +[ + "and" + "in" + "not in" + "not" + "or" +] @keyword.operator + +; Capture Operator +(unary_operator + operator: "&" + operand: [ + (integer) @operator + (binary_operator + left: [ + (call target: (dot left: (_) right: (identifier) @function)) + (identifier) @function + ] operator: "/" right: (integer) @operator) + ]) + +; Non-String Sigils +(sigil + "~" @string.special + ((sigil_name) @string.special) @_sigil_name + quoted_start: _ @string.special + quoted_end: _ @string.special + ((sigil_modifiers) @string.special)? + (#not-any-of? @_sigil_name "s" "S")) + +; String Sigils +(sigil + "~" @string + ((sigil_name) @string) @_sigil_name + quoted_start: _ @string + (quoted_content) @string + quoted_end: _ @string + ((sigil_modifiers) @string)? + (#any-of? @_sigil_name "s" "S")) + +; Module attributes +(unary_operator + operator: "@" + operand: [ + (identifier) + (call target: (identifier)) + ] @constant) @constant + +; Documentation +(unary_operator + operator: "@" + operand: (call + target: ((identifier) @_identifier (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) @comment.documentation + (arguments [ + (string) + (boolean) + (charlist) + (sigil + "~" @comment.documentation + ((sigil_name) @comment.documentation) + quoted_start: _ @comment.documentation + (quoted_content) @comment.documentation + quoted_end: _ @comment.documentation) + ] @comment.documentation))) @comment.documentation diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elixir/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elixir/indents.scm new file mode 100644 index 00000000..0ba8fd44 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elixir/indents.scm @@ -0,0 +1,23 @@ +[ + (block) + (do_block) + (list) + (map) + (stab_clause) + (tuple) + (arguments) +] @indent.begin + +[ + ")" + "]" + "after" + "catch" + "else" + "rescue" + "}" + "end" +] @indent.end @indent.branch + +; Elixir pipelines are not indented, but other binary operator chains are +((binary_operator operator: _ @_operator) @indent.begin (#not-eq? @_operator "|>")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elixir/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elixir/injections.scm new file mode 100644 index 00000000..1f0b31f0 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elixir/injections.scm @@ -0,0 +1,56 @@ +; Comments +((comment) @injection.content + (#set! injection.language "comment")) + +; Documentation +(unary_operator + operator: "@" + operand: (call + target: ((identifier) @_identifier (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) + (arguments [ + (string (quoted_content) @injection.content) + (sigil (quoted_content) @injection.content) + ]) + (#set! injection.language "markdown"))) + +; HEEx +(sigil + (sigil_name) @_sigil_name + (quoted_content) @injection.content + (#eq? @_sigil_name "H") + (#set! injection.language "heex")) + +; Surface +(sigil + (sigil_name) @_sigil_name + (quoted_content) @injection.content + (#eq? @_sigil_name "F") + (#set! injection.language "surface")) + +; Zigler +(sigil + (sigil_name) @_sigil_name + (quoted_content) @injection.content + (#any-of? @_sigil_name "E" "L") + (#set! injection.language "eex")) + +(sigil + (sigil_name) @_sigil_name + (quoted_content) @injection.content + (#any-of? @_sigil_name "z" "Z") + (#set! injection.language "zig")) + +; Regex +(sigil + (sigil_name) @_sigil_name + (quoted_content) @injection.content + (#any-of? @_sigil_name "r" "R") + (#set! injection.language "regex")) + +; Json +(sigil + (sigil_name) @_sigil_name + (quoted_content) @injection.content + (#any-of? @_sigil_name "j" "J") + (#set! injection.language "json")) + diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elixir/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elixir/locals.scm new file mode 100644 index 00000000..79a9676d --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elixir/locals.scm @@ -0,0 +1,164 @@ +; References +(identifier) @reference +(alias) @reference + +; Module Definitions +(call + target: ((identifier) @_identifier (#eq? @_identifier "defmodule")) + (arguments (alias) @definition.type)) + +; Pattern Match Definitions +(binary_operator left: [ + (identifier) @definition.var + (_ (identifier) @definition.var) + (_ (_ (identifier) @definition.var)) + (_ (_ (_ (identifier) @definition.var))) + (_ (_ (_ (_ (identifier) @definition.var)))) + (_ (_ (_ (_ (_ (identifier) @definition.var))))) + (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))) + (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))))) +] operator: "=") + +; Stab Clause Definitions +(stab_clause + left: [ + (arguments [ + (identifier) @definition.var + (_ (identifier) @definition.var) + (_ (_ (identifier) @definition.var)) + (_ (_ (_ (identifier) @definition.var))) + (_ (_ (_ (_ (identifier) @definition.var)))) + (_ (_ (_ (_ (_ (identifier) @definition.var))))) + (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))) + (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))))) + ]) + (binary_operator + left: (arguments [ + (identifier) @definition.var + (_ (identifier) @definition.var) + (_ (_ (identifier) @definition.var)) + (_ (_ (_ (identifier) @definition.var))) + (_ (_ (_ (_ (identifier) @definition.var)))) + (_ (_ (_ (_ (_ (identifier) @definition.var))))) + (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))) + (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))))) + ]) operator: "when") +]) + +; Aliases +(call + target: ((identifier) @_identifier (#any-of? @_identifier "require" "alias" "use" "import")) + (arguments [ + (alias) @definition.import + (_ (alias) @definition.import) + (_ (_ (alias) @definition.import)) + (_ (_ (_ (alias) @definition.import))) + (_ (_ (_ (_ (alias) @definition.import)))) + ] +)) + +; Local Function Definitions & Scopes +(call + target: ((identifier) @_identifier (#any-of? @_identifier "def" "defp" "defmacro" "defmacrop" "defguard" "defguardp" "defn" "defnp" "for")) + (arguments [ + (identifier) @definition.function + (binary_operator left: (identifier) @definition.function operator: "when") + (binary_operator (identifier) @definition.parameter) + (call target: (identifier) @definition.function (arguments [ + (identifier) @definition.parameter + (_ (identifier) @definition.parameter) + (_ (_ (identifier) @definition.parameter)) + (_ (_ (_ (identifier) @definition.parameter))) + (_ (_ (_ (_ (identifier) @definition.parameter)))) + (_ (_ (_ (_ (_ (identifier) @definition.parameter))))) + (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))) + (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))))))) + ])) + ]?) (#set! definition.function.scope parent) + (do_block)? +) @scope + +; ExUnit Test Definitions & Scopes +(call + target: ((identifier) @_identifier (#eq? @_identifier "test")) + (arguments [ + (string) + ((string) . "," . [ + (identifier) @definition.parameter + (_ (identifier) @definition.parameter) + (_ (_ (identifier) @definition.parameter)) + (_ (_ (_ (identifier) @definition.parameter))) + (_ (_ (_ (_ (identifier) @definition.parameter)))) + (_ (_ (_ (_ (_ (identifier) @definition.parameter))))) + (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))) + (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))))))) + ]) +]) (do_block)?) @scope + +; Stab Clause Scopes +(stab_clause) @scope diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elm/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elm/highlights.scm new file mode 100644 index 00000000..fbd3a4c3 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elm/highlights.scm @@ -0,0 +1,205 @@ +[ + (line_comment) + (block_comment) +] @comment @spell + +((block_comment) @comment.documentation + (#lua-match? @comment.documentation "^{[-]|[^|]")) + + +; Keywords +;--------- + +[ + "if" + "then" + "else" + (case) + (of) +] @conditional + +[ + "let" + "in" + (as) + (port) + (alias) + (infix) + (module) + (type) +] @keyword + +[ + (import) + (exposing) +] @include + + +; Punctuation +;------------ + +[ + (double_dot) +] @punctuation.special + +[ + "," + "|" + (dot) +] @punctuation.delimiter + +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket + + +; Variables +;---------- + +(value_qid + (lower_case_identifier) @variable) +(value_declaration + (function_declaration_left (lower_case_identifier) @variable)) +(type_annotation + (lower_case_identifier) @variable) +(port_annotation + (lower_case_identifier) @variable) +(anything_pattern + (underscore) @variable) +(record_base_identifier + (lower_case_identifier) @variable) +(lower_pattern + (lower_case_identifier) @variable) +(exposed_value + (lower_case_identifier) @variable) + +(value_qid + ((dot) (lower_case_identifier) @field)) +(field_access_expr + ((dot) (lower_case_identifier) @field)) + +(function_declaration_left + (anything_pattern (underscore) @parameter)) +(function_declaration_left + (lower_pattern (lower_case_identifier) @parameter)) + + +; Functions +;---------- + +(value_declaration + functionDeclarationLeft: + (function_declaration_left + (lower_case_identifier) @function + (pattern))) +(value_declaration + functionDeclarationLeft: + (function_declaration_left + (lower_case_identifier) @function + pattern: (_))) +(value_declaration + functionDeclarationLeft: + (function_declaration_left + (lower_case_identifier) @function) + body: (anonymous_function_expr)) +(type_annotation + name: (lower_case_identifier) @function + typeExpression: (type_expression (arrow))) +(port_annotation + name: (lower_case_identifier) @function + typeExpression: (type_expression (arrow))) + +(function_call_expr + target: (value_expr + (value_qid (lower_case_identifier) @function.call))) + + +; Operators +;---------- + +[ + (operator_identifier) + (eq) + (colon) + (arrow) + (backslash) + "::" +] @operator + + +; Modules +;-------- + +(module_declaration + (upper_case_qid (upper_case_identifier) @namespace)) +(import_clause + (upper_case_qid (upper_case_identifier) @namespace)) +(as_clause + (upper_case_identifier) @namespace) +(value_expr + (value_qid (upper_case_identifier) @namespace)) + + +; Types +;------ + +(type_declaration + (upper_case_identifier) @type) +(type_ref + (upper_case_qid (upper_case_identifier) @type)) +(type_variable + (lower_case_identifier) @type) +(lower_type_name + (lower_case_identifier) @type) +(exposed_type + (upper_case_identifier) @type) + +(type_alias_declaration + (upper_case_identifier) @type.definition) + +(field_type + name: (lower_case_identifier) @property) +(field + name: (lower_case_identifier) @property) + +(type_declaration + (union_variant (upper_case_identifier) @constructor)) +(nullary_constructor_argument_pattern + (upper_case_qid (upper_case_identifier) @constructor)) +(union_pattern + (upper_case_qid (upper_case_identifier) @constructor)) +(value_expr + (upper_case_qid (upper_case_identifier)) @constructor) + + +; Literals +;--------- + +(number_constant_expr + (number_literal) @number) + +(upper_case_qid + ((upper_case_identifier) @boolean (#any-of? @boolean "True" "False"))) + +[ + (open_quote) + (close_quote) +] @string +(string_constant_expr + (string_escape) @string) +(string_constant_expr + (regular_string_part) @string) + +[ + (open_char) + (close_char) +] @character +(char_constant_expr + (string_escape) @character) +(char_constant_expr + (regular_string_part) @character) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elm/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elm/injections.scm new file mode 100644 index 00000000..b8b3e994 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elm/injections.scm @@ -0,0 +1,8 @@ +([ + (line_comment) + (block_comment) + ] @injection.content + (#set! injection.language "comment")) + +((glsl_content) @injection.content + (#set! injection.language "glsl")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elsa/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elsa/folds.scm new file mode 100644 index 00000000..afdfec30 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elsa/folds.scm @@ -0,0 +1 @@ +(reduction) @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elsa/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elsa/highlights.scm new file mode 100644 index 00000000..c787dadd --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elsa/highlights.scm @@ -0,0 +1,41 @@ +; Keywords + +[ + "eval" + "let" +] @keyword + +; Function + +(function) @function + +; Method + +(method) @method + +; Parameter + +(parameter) @parameter + +; Variables + +(identifier) @variable + +; Operators + +[ + "\\" + "->" + "=" + (step) +] @operator + +; Punctuation + +["(" ")"] @punctuation.bracket + +":" @punctuation.delimiter + +; Comments + +(comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elsa/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elsa/indents.scm new file mode 100644 index 00000000..6ddd1aa6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elsa/indents.scm @@ -0,0 +1,6 @@ +(reduction) @indent.begin + +[ + (ERROR) + (comment) +] @indent.auto diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elsa/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elsa/injections.scm new file mode 100644 index 00000000..6adae45a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elsa/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elsa/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elsa/locals.scm new file mode 100644 index 00000000..de703079 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elsa/locals.scm @@ -0,0 +1,12 @@ +[ + (source_file) + (reduction) +] @scope + +(identifier) @reference + +(function) @definition.function + +(method) @definition.method + +(parameter) @definition.parameter diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elvish/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elvish/highlights.scm new file mode 100644 index 00000000..886f5bcd --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elvish/highlights.scm @@ -0,0 +1,70 @@ +(comment) @comment @spell + +["if" "elif"] @conditional +(if (else "else" @conditional)) + +["while" "for"] @repeat +(while (else "else" @repeat)) +(for (else "else" @repeat)) + +["try" "catch" "finally"] @exception +(try (else "else" @exception)) + +"use" @include +(import (bareword) @string.special) + +(wildcard ["*" "**" "?"] @character.special) + +(command argument: (bareword) @parameter) +(command head: (identifier) @function.call) +((command head: (identifier) @keyword.return) + (#eq? @keyword.return "return")) +((command (identifier) @keyword.operator) + (#any-of? @keyword.operator "and" "or" "coalesce")) +[ + "+" "-" "*" "/" "%" "<" "<=""==" "!=" ">" + ">=" "s" ">=s" +] @function.builtin + +[">" "<" ">>" "<>" "|"] @operator + +(io_port) @number + +(function_definition + "fn" @keyword.function + (identifier) @function) + +(parameter_list) @parameter +(parameter_list "|" @punctuation.bracket) + +["var" "set" "tmp" "del"] @keyword +(variable_declaration + (lhs (identifier) @variable)) + +(variable_assignment + (lhs (identifier) @variable)) + +(temporary_assignment + (lhs (identifier) @variable)) + +(variable_deletion + (identifier) @variable) + + +(number) @number +(string) @string + +(variable (identifier) @variable) +((variable (identifier) @function) + (#match? @function ".+\\~$")) +((variable (identifier) @boolean) + (#any-of? @boolean "true" "false")) +((variable (identifier) @constant.builtin) + (#any-of? @constant.builtin + "_" "after-chdir" "args" "before-chdir" "buildinfo" "nil" + "notify-bg-job-success" "num-bg-jobs" "ok" "paths" "pid" + "pwd" "value-out-indicator" "version")) + +["$" "@"] @punctuation.special +["(" ")" "[" "]" "{" "}"] @punctuation.bracket +";" @punctuation.delimiter diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elvish/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elvish/injections.scm new file mode 100644 index 00000000..6adae45a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/elvish/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/embedded_template/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/embedded_template/highlights.scm new file mode 100644 index 00000000..410983d6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/embedded_template/highlights.scm @@ -0,0 +1,12 @@ +(comment_directive) @comment @spell + +[ + "<%#" + "<%" + "<%=" + "<%_" + "<%-" + "%>" + "-%>" + "_%>" +] @keyword diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/embedded_template/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/embedded_template/injections.scm new file mode 100644 index 00000000..2824f7a0 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/embedded_template/injections.scm @@ -0,0 +1,7 @@ +((content) @injection.content + (#set! injection.language "html") + (#set! injection.combined)) + +((code) @injection.content + (#set! injection.language "ruby") + (#set! injection.combined)) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/erlang/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/erlang/folds.scm new file mode 100644 index 00000000..65c2d8ed --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/erlang/folds.scm @@ -0,0 +1,9 @@ +[ + (fun_decl) + (anonymous_fun) + (case_expr) + (maybe_expr) + (map_expr) + (export_attribute) + (export_type_attribute) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/erlang/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/erlang/highlights.scm new file mode 100644 index 00000000..0c129e23 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/erlang/highlights.scm @@ -0,0 +1,130 @@ +((atom) @constant (#set! "priority" "90")) +(var) @variable + +(char) @character +(integer) @number +(float) @float + +(comment) @comment @spell + +((comment) @comment.documentation + (#lua-match? @comment.documentation "^[%%][%%]")) + +;; keyword +[ + "fun" + "div" +] @keyword + +;; bracket +[ + "(" + ")" + "{" + "}" + "[" + "]" + "#" +] @punctuation.bracket + +;;; Comparisons +[ + "==" + "=:=" + "=/=" + "=<" + ">=" + "<" + ">" +] @operator ;; .comparison + +;;; operator +[ + ":" + ":=" + "!" + ;; "-" + "+" + "=" + "->" + "=>" + "|" + "?=" +] @operator + +[ + "," + "." + ";" +] @punctuation.delimiter + +;; conditional +[ + "receive" + "if" + "case" + "of" + "when" + "after" + "begin" + "end" + "maybe" + "else" +] @conditional + +[ + "catch" + "try" +] @exception + +((atom) @boolean (#any-of? @boolean "true" "false")) + +;; Macros +((macro_call_expr) @constant.macro (#set! "priority" 101)) + +;; Preprocessor +(pp_define + lhs: _ @constant.macro (#set! "priority" 101) +) +(_preprocessor_directive) @preproc (#set! "priority" 99) + +;; Attributes +(pp_include) @include +(pp_include_lib) @include +(export_attribute) @include +(export_type_attribute) @type.definition +(export_type_attribute types: (fa fun: _ @type (#set! "priority" 101))) +(behaviour_attribute) @include +(module_attribute (atom) @namespace) @include +(wild_attribute name: (attr_name name: _ @attribute)) @attribute + +;; Records +(record_expr) @type +(record_field_expr _ @field) @type +(record_field_name _ @field) @type +(record_name "#" @type name: _ @type) @type +(record_decl name: _ @type) @type.definition +(record_field name: _ @field) +(record_field name: _ @field ty: _ @type) + +;; Type alias +(type_alias name: _ @type) @type.definition +(spec) @type.definition + +[(string) (binary)] @string + +;;; expr_function_call +(call expr: [(atom) (remote) (var)] @function) +(call (atom) @exception (#any-of? @exception "error" "throw" "exit")) + +;;; Parenthesized expression: (SomeFunc)(), only highlight the parens +(call + expr: (paren_expr "(" @function.call ")" @function.call) +) + +;;; function +(external_fun) @function.call +(internal_fun fun: (atom) @function.call) +(function_clause name: (atom) @function) +(fa fun: (atom) @function) + diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/facility/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/facility/folds.scm new file mode 100644 index 00000000..7d8bafc8 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/facility/folds.scm @@ -0,0 +1,6 @@ +[ + (service) + (method) + (dto) + (enum) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/facility/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/facility/highlights.scm new file mode 100644 index 00000000..c10ff49b --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/facility/highlights.scm @@ -0,0 +1,81 @@ +[ + ";" + "." + "," +] @punctuation.delimiter + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +(comment) @comment @spell +(doc_comment) @comment.documentation @spell + +"method" @keyword.function + +[ + "service" + "errors" + "data" + "enum" + "extern" +] @type.builtin + +(type) @type.builtin + +(service + service_name: (identifier) @type) + +(error_set + (identifier) @property) + +(error_set + name: (identifier) @type) + +(dto + name: (identifier) @type) + +(external_dto + name: (identifier) @type) + +(enum + (values_block + (identifier) @constant)) + +(enum + name: (identifier) @type) + +(external_enum + name: (identifier) @type) + +(type + name: (identifier) @type) + +[ + "map" + "nullable" + "result" + "required" + "http" + "csharp" + "js" + "info" + "obsolete" +] @attribute.builtin + +(parameter + name: (identifier) @property) + +(field + name: (identifier) @variable) + +(method + name: (identifier) @method) + +(number_literal) @number +(string_literal) @string diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/facility/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/facility/indents.scm new file mode 100644 index 00000000..96a24f20 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/facility/indents.scm @@ -0,0 +1,8 @@ +[ + (service_block) + (values_block) + (field_list) +] @indent.begin + +"}" @indent.branch + diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/facility/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/facility/injections.scm new file mode 100644 index 00000000..572849ab --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/facility/injections.scm @@ -0,0 +1,5 @@ +((remarks) @injection.content + (#set! injection.language "markdown")) + +([(comment) (doc_comment)] @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fennel/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fennel/folds.scm new file mode 100644 index 00000000..c8427b18 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fennel/folds.scm @@ -0,0 +1 @@ +[(list) (table) (sequential_table) (let) (fn) (let_clause) (quoted_list) (local) (global)] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fennel/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fennel/highlights.scm new file mode 100644 index 00000000..14c91d97 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fennel/highlights.scm @@ -0,0 +1,121 @@ +(comment) @comment @spell + +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket + +[ + ":" + ":until" + "&" + "&as" + "?" +] @punctuation.special + +(nil) @constant.builtin +(vararg) @punctuation.special + +(boolean) @boolean +(number) @number + +(string) @string +(escape_sequence) @string.escape + +(symbol) @variable + +(multi_symbol + "." @punctuation.delimiter + (symbol) @field) + +(multi_symbol_method + ":" @punctuation.delimiter + (symbol) @method.call .) + +(list . (symbol) @function.call) +(list . (multi_symbol (symbol) @function.call .)) + +((symbol) @variable.builtin + (#lua-match? @variable.builtin "^[$]")) + +(binding) @symbol + +[ + "fn" + "lambda" + "hashfn" + "#" +] @keyword.function + +(fn name: [ + (symbol) @function + (multi_symbol (symbol) @function .) +]) + +(lambda name: [ + (symbol) @function + (multi_symbol (symbol) @function .) +]) + +[ + "for" + "each" +] @repeat +((symbol) @repeat + (#any-of? @repeat + "while")) + +[ + "match" +] @conditional +((symbol) @conditional + (#any-of? @conditional + "if" "when")) + +[ + "global" + "local" + "let" + "set" + "var" + "where" + "or" +] @keyword +((symbol) @keyword + (#any-of? @keyword + "comment" "do" "doc" "eval-compiler" "lua" "macros" "quote" "tset" "values")) + +((symbol) @include + (#any-of? @include + "require" "require-macros" "import-macros" "include")) + +[ + "collect" + "icollect" + "accumulate" +] @function.macro + +((symbol) @function.macro + (#any-of? @function.macro + "->" "->>" "-?>" "-?>>" "?." "doto" "macro" "macrodebug" "partial" "pick-args" + "pick-values" "with-open")) + +; Lua builtins +((symbol) @constant.builtin + (#any-of? @constant.builtin + "arg" "_ENV" "_G" "_VERSION")) + +((symbol) @function.builtin + (#any-of? @function.builtin + "assert" "collectgarbage" "dofile" "error" "getmetatable" "ipairs" + "load" "loadfile" "next" "pairs" "pcall" "print" "rawequal" "rawget" + "rawlen" "rawset" "require" "select" "setmetatable" "tonumber" "tostring" + "type" "warn" "xpcall")) + +((symbol) @function.builtin + (#any-of? @function.builtin + "loadstring" "module" "setfenv" "unpack")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fennel/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fennel/injections.scm new file mode 100644 index 00000000..6adae45a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fennel/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fennel/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fennel/locals.scm new file mode 100644 index 00000000..3018732f --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fennel/locals.scm @@ -0,0 +1,26 @@ +[ + (program) + (fn) + (lambda) + (let) + (each) + (for) + (match) +] @scope + +( + (list . (symbol) @_special) @scope + (#any-of? @_special + "while" "if" "when" "do" "collect" "icollect" "accumulate") +) + +(fn name: (symbol) @definition.function + (#set! definition.function.scope "parent")) +(lambda name: (symbol) @definition.function + (#set! definition.function.scope "parent")) + +; TODO: use @definition.parameter for parameters +(binding (symbol) @definition.var) +(for_clause . (symbol) @definition.var) + +(symbol) @reference diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/firrtl/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/firrtl/folds.scm new file mode 100644 index 00000000..437b2c81 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/firrtl/folds.scm @@ -0,0 +1,6 @@ +[ + (circuit) + (module) + (when) + (else) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/firrtl/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/firrtl/highlights.scm new file mode 100644 index 00000000..ace8f712 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/firrtl/highlights.scm @@ -0,0 +1,186 @@ +; Namespaces + +(circuit (identifier) @namespace) + +(module (identifier) @namespace) + +; Types + +((identifier) @type + (#lua-match? @type "^[A-Z][A-Za-z0-9_$]*$")) + +; Keywords + +[ + "circuit" + "module" + "extmodule" + + "flip" + "parameter" + "reset" + "wire" + + "cmem" + "smem" + "mem" + + "reg" + "with" + "mport" + "inst" + "of" + "node" + "is" + "invalid" + "skip" + + "infer" + "read" + "write" + "rdwr" + + "defname" +] @keyword + +; Qualifiers + +(qualifier) @type.qualifier + +; Storageclasses + +[ + "input" + "output" +] @storageclass + +; Conditionals + +[ + "when" + "else" +] @conditional + +; Annotations + +(info) @attribute + +; Builtins + +[ + "stop" + "printf" + "assert" + "assume" + "cover" + "attach" + "mux" + "validif" +] @function.builtin + +[ + "UInt" + "SInt" + "Analog" + "Fixed" + "Clock" + "AsyncReset" + "Reset" +] @type.builtin + +; Fields + +[ + "data-type" + "depth" + "read-latency" + "write-latency" + "read-under-write" + "reader" + "writer" + "readwriter" +] @field.builtin + +((field_id) @field + (#set! "priority" 105)) + +(port (identifier) @field) + +(wire (identifier) @field) + +(cmem (identifier) @field) + +(smem (identifier) @field) + +(memory (identifier) @field) + +(register (identifier) @field) + +; Parameters + +(primitive_operation (identifier) @parameter) + +(mux (identifier) @parameter) +(printf (identifier) @parameter) +(reset (identifier) @parameter) +(stop (identifier) @parameter) + +; Variables + +(identifier) @variable + +; Operators + +(primop) @keyword.operator + +[ + "+" + "-" + "=" + "=>" + "<=" + "<-" +] @operator + +; Literals + +[ + (uint) + (number) +] @number + +(number_str) @string.special + +(double) @float + +(string) @string + +(escape_sequence) @string.escape + +[ + "old" + "new" + "undefined" +] @constant.builtin + +; Punctuation + +[ "{" "}" ] @punctuation.bracket + +[ "[" "]" ] @punctuation.bracket + +[ "<" ">" ] @punctuation.bracket + +[ "(" ")" ] @punctuation.bracket + +[ + "," + "." + ":" +] @punctuation.delimiter + +; Comments + +(comment) @comment @spell + +["=>" "<=" "="] @operator diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/firrtl/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/firrtl/indents.scm new file mode 100644 index 00000000..8bc1e201 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/firrtl/indents.scm @@ -0,0 +1,12 @@ +[ + (circuit) + (module) + (memory) + (when) + (else) +] @indent.begin + +[ + (ERROR) + (comment) +] @indent.auto diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/firrtl/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/firrtl/injections.scm new file mode 100644 index 00000000..6adae45a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/firrtl/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/firrtl/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/firrtl/locals.scm new file mode 100644 index 00000000..bb7fc56b --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/firrtl/locals.scm @@ -0,0 +1,38 @@ +; Scopes + +[ + (source_file) + (circuit) + (module) + + (else) + (when) +] @scope + +; References + +(identifier) @reference + +; Definitions + +(port (identifier) @definition.field) + +(wire (identifier) @definition.field) + +(cmem (identifier) @definition.field) + +(smem (identifier) @definition.field) + +(memory (identifier) @definition.field) + +(register (identifier) @definition.field) + +(circuit (identifier) @definition.namespace) + +(module (identifier) @definition.namespace) + +(parameter (identifier) @definition.parameter) + +(rdwr (identifier) @definition.var) + +(node (identifier) @definition.var) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fish/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fish/folds.scm new file mode 100644 index 00000000..6075e2e0 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fish/folds.scm @@ -0,0 +1,8 @@ +[ + (function_definition) + (if_statement) + (switch_statement) + (for_statement) + (while_statement) + (begin_statement) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fish/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fish/highlights.scm new file mode 100644 index 00000000..8d0fba29 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fish/highlights.scm @@ -0,0 +1,163 @@ +;; Fish highlighting + +;; Operators + +[ + "&&" + "||" + "|" + "&" + ".." + "!" + (direction) + (stream_redirect) +] @operator + +;; match operators of test command +(command + name: (word) @function.builtin (#eq? @function.builtin "test") + argument: (word) @operator (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) + +;; match operators of [ command +(command + name: (word) @punctuation.bracket (#eq? @punctuation.bracket "[") + argument: (word) @operator (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) + +[ + "not" + "and" + "or" +] @keyword.operator + +;; Conditionals + +(if_statement +[ + "if" + "end" +] @conditional) + +(switch_statement +[ + "switch" + "end" +] @conditional) + +(case_clause +[ + "case" +] @conditional) + +(else_clause +[ + "else" +] @conditional) + +(else_if_clause +[ + "else" + "if" +] @conditional) + +;; Loops/Blocks + +(while_statement +[ + "while" + "end" +] @repeat) + +(for_statement +[ + "for" + "end" +] @repeat) + +(begin_statement +[ + "begin" + "end" +] @repeat) + +;; Keywords + +[ + "in" + (break) + (continue) +] @keyword + +"return" @keyword.return + +;; Punctuation + +[ + "[" + "]" + "{" + "}" + "(" + ")" +] @punctuation.bracket + +"," @punctuation.delimiter + +;; Commands + +(command + argument: [ + (word) @parameter (#lua-match? @parameter "^[-]") + ] +) + +(command_substitution "$" @punctuation.bracket) + +; non-builtin command names +(command name: (word) @function.call) + +; derived from builtin -n (fish 3.2.2) +(command + name: [ + (word) @function.builtin + (#any-of? @function.builtin "." ":" "_" "alias" "argparse" "bg" "bind" "block" "breakpoint" "builtin" "cd" "command" "commandline" "complete" "contains" "count" "disown" "echo" "emit" "eval" "exec" "exit" "fg" "functions" "history" "isatty" "jobs" "math" "printf" "pwd" "random" "read" "realpath" "set" "set_color" "source" "status" "string" "test" "time" "type" "ulimit" "wait") + ] +) + +;; Functions + +(function_definition ["function" "end"] @keyword.function) + +(function_definition + name: [ + (word) (concatenation) + ] +@function) + +(function_definition + option: [ + (word) + (concatenation (word)) + ] @parameter (#lua-match? @parameter "^[-]") +) + +;; Strings + +[(double_quote_string) (single_quote_string)] @string +(escape_sequence) @string.escape + +;; Variables + +(variable_name) @variable +(variable_expansion) @constant + +;; Nodes + +[(integer) (float)] @number +(comment) @comment +(comment) @spell + +((word) @boolean +(#any-of? @boolean "true" "false")) + +((program . (comment) @preproc) + (#lua-match? @preproc "^#!/")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fish/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fish/indents.scm new file mode 100644 index 00000000..526c56e6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fish/indents.scm @@ -0,0 +1,18 @@ +[ + (function_definition) + (while_statement) + (for_statement) + (if_statement) + (begin_statement) + (switch_statement) +] @indent.begin + +[ + "else" ; else and else if must both start the line with "else", so tag the string directly + "case" + "end" +] @indent.branch + +"end" @indent.end + +(comment) @indent.ignore diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fish/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fish/injections.scm new file mode 100644 index 00000000..6adae45a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fish/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fish/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fish/locals.scm new file mode 100644 index 00000000..a522c78d --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fish/locals.scm @@ -0,0 +1,18 @@ +;; Scopes +[ + (command) + (function_definition) + (if_statement) + (for_statement) + (begin_statement) + (while_statement) + (switch_statement) +] @scope + +;; Definitions +(function_definition + name: (word) @definition.function) + +;; References +(variable_name) @reference +(word) @reference diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/foam/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/foam/folds.scm new file mode 100644 index 00000000..2e499c2e --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/foam/folds.scm @@ -0,0 +1,7 @@ +[ + (comment) + (list) + (dict_core) +] @fold + +(code (code_body)* @fold) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/foam/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/foam/highlights.scm new file mode 100644 index 00000000..aba33b4e --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/foam/highlights.scm @@ -0,0 +1,61 @@ +;; Comments +(comment) @comment @spell + +;; Generic Key-value pairs and dictionary keywords +(key_value + keyword: (identifier) @function +) +(dict + key: (identifier) @type +) + +;; Macros +(macro + "$" @conditional + (prev_scope)* @conditional + (identifier)* @namespace +) + + +;; Directives +"#" @conditional +(preproc_call + directive: (identifier)* @conditional + argument: (identifier)* @namespace +) +((preproc_call + argument: (identifier)* @namespace) @conditional + (#eq? @conditional "ifeq")) +((preproc_call) @conditional + (#any-of? @conditional "else" "endif")) + +;; Literals +(number_literal) @float +(string_literal) @string +(escape_sequence) @string.escape +(boolean) @boolean + +;; Treat [m^2 s^-2] the same as if it was put in numbers format +(dimensions dimension: (identifier) @float) + +;; Punctuation +[ + "(" + ")" + "[" + "]" + "{" + "}" + "#{" + "#}" + "|-" + "-|" + "" + "$$" +] @punctuation.bracket + +";" @punctuation.delimiter + +((identifier) @constant.builtin + (#any-of? @constant.builtin "uniform" "non-uniform" "and" "or")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/foam/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/foam/indents.scm new file mode 100644 index 00000000..a52cafea --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/foam/indents.scm @@ -0,0 +1,11 @@ +[ + "{" + "}" +] @indent.branch + +[(dict) (key_value)] @indent.begin + + +[ + (comment) +] @indent.ignore diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/foam/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/foam/injections.scm new file mode 100644 index 00000000..2d744f6a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/foam/injections.scm @@ -0,0 +1,20 @@ +;; Pass code blocks to Cpp highlighter +(code + (code_body) @injection.content + (#set! injection.language "cpp")) + +;; Pass identifiers to Go highlighter (Cheating I know) +;; ((identifier) @injection.content +;; (#set! injection.language "lua") + +;; Highlight regex syntax inside literal strings +((string_literal) @injection.content + (#set! injection.language "regex")) + +;; Highlight PyFoam syntax as Python statements +(pyfoam_variable + code_body: (_) @injection.content + (#set! injection.language "python")) +(pyfoam_expression + code_body: (_) @injection.content + (#set! injection.language "python")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/foam/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/foam/locals.scm new file mode 100644 index 00000000..2abe743d --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/foam/locals.scm @@ -0,0 +1,6 @@ +(dict) @scope + +(dict key: (_) @definition.type) + +(key_value keyword: (_) @definition.parameter) +(key_value value: (macro (identifier)*)* @reference) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/forth/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/forth/folds.scm new file mode 100644 index 00000000..443abb30 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/forth/folds.scm @@ -0,0 +1 @@ +(word_definition) @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/forth/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/forth/highlights.scm new file mode 100644 index 00000000..1e720759 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/forth/highlights.scm @@ -0,0 +1,19 @@ +(core) @function + +(operator) @operator + +(word) @variable + +((word) @constant + (#lua-match? @constant "^[A-Z_]+$")) + +(number) @number + +(string) @string + +[ + (start_definition) + (end_definition) +] @punctuation.delimiter + +(comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/forth/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/forth/indents.scm new file mode 100644 index 00000000..06775543 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/forth/indents.scm @@ -0,0 +1,3 @@ +(word_definition) @indent.begin + +(end_definition) @indent.end @indent.branch diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/forth/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/forth/injections.scm new file mode 100644 index 00000000..2f0e58eb --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/forth/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/forth/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/forth/locals.scm new file mode 100644 index 00000000..3a5e191d --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/forth/locals.scm @@ -0,0 +1,3 @@ +(word) @reference + +(word_definition) @scope diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fortran/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fortran/folds.scm new file mode 100644 index 00000000..a2edc64d --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fortran/folds.scm @@ -0,0 +1,11 @@ +;; by @oponkork +[ + (if_statement) + (where_statement) + (enum_statement) + (do_loop_statement) + (derived_type_definition) + (function) + (subroutine) + (interface) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fortran/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fortran/highlights.scm new file mode 100644 index 00000000..3e85212b --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fortran/highlights.scm @@ -0,0 +1,328 @@ +; Preprocs + +(preproc_file_line) @preproc + +; Namespaces + +(program_statement + (name) @namespace) + +(end_program_statement + (name) @namespace) + +(module_statement + (name) @namespace) + +(end_module_statement + (name) @namespace) + +(submodule_statement + (name) @namespace) + +(end_submodule_statement + (name) @namespace) + +; Includes + +[ + "import" + "include" + "use" +] @include + +(import_statement + "," + ["all" "none"] @keyword) + +; Attributes + +[ + (none) + "implicit" + "intent" +] @attribute + +(implicit_statement + "type" @attribute) + +; Keywords + +[ + "attributes" + "associate" + "block" + "class" + "classis" + "contains" + "default" + "dimension" + "endassociate" + "endenum" + "endinterface" + "endmodule" + "endselect" + "endsubmodule" + "endtype" + "enum" + "enumerator" + "equivalence" + "extends" + "goto" + "interface" + "intrinsic" + "non_intrinsic" + "module" + "submodule" + "namelist" + "parameter" + "quiet" + "rank" + "save" + "selectcase" + "selectrank" + "selecttype" + "sequence" + "stop" + "target" + "type" + "typeis" +] @keyword + +[ + (default) +] @keyword + +; Types + +[ + (type_name) +] @type + +[ + (intrinsic_type) +] @type.builtin + +; Qualifiers + +[ + "abstract" + "allocatable" + "automatic" + "constant" + "contiguous" + "data" + "deferred" + "device" + "external" + "family" + "final" + "generic" + "global" + "grid_global" + "host" + "initial" + "local" + "local_init" + "managed" + "nopass" + "non_overridable" + "optional" + "pass" + "pinned" + "pointer" + "private" + "property" + "protected" + "public" + "shared" + "static" + "texture" + "value" + "volatile" + (procedure_qualifier) +] @type.qualifier + +[ + "common" + "in" + "inout" + "out" +] @storageclass + +; Labels + +[ + (statement_label) + (statement_label_reference) +] @label + +[ + "call" + "endfunction" + "endprogram" + "endprocedure" + "endsubroutine" + "function" + "procedure" + "program" + "subroutine" +] @keyword.function + +[ + "result" + "return" +] @keyword.return + +; Functions + +(function_statement + (name) @function) + +(end_function_statement + (name) @function) + +(subroutine_statement + (name) @function) + +(end_subroutine_statement + (name) @function) + +(module_procedure_statement + (name) @function) + +(end_module_procedure_statement + (name) @function) + +(subroutine_call + (identifier) @function.call) + +[ + "character" + "close" + "bind" + "format" + "open" + "print" + "read" + "write" +] @function.builtin + +; Exceptions + +[ + "error" +] @exception + +; Conditionals + +[ + "else" + "elseif" + "elsewhere" + "endif" + "endwhere" + "if" + "then" + "where" +] @conditional + +; Repeats + +[ + "do" + "concurrent" + "enddo" + "endforall" + "forall" + "while" + "continue" + "cycle" + "exit" +] @repeat + +; Variables + +(identifier) @variable + +; Parameters + +(keyword_argument + name: (identifier) @parameter) + +(parameters + (identifier) @parameter) + +; Properties + +(derived_type_member_expression + (type_member) @property) + +; Operators + +[ + "+" + "-" + "*" + "**" + "/" + "=" + "<" + ">" + "<=" + ">=" + "==" + "/=" + "//" + (assumed_rank) +] @operator + +[ + "\\.and\\." + "\\.or\\." + "\\.eqv\\." + "\\.neqv\\." + "\\.lt\\." + "\\.gt\\." + "\\.le\\." + "\\.ge\\." + "\\.eq\\." + "\\.ne\\." + "\\.not\\." +] @keyword.operator + +; Punctuation + +[ "[" "]" ] @punctuation.bracket + +[ "(" ")" ] @punctuation.bracket + +[ "<<<" ">>>" ] @punctuation.bracket + +(array_literal + ["(/" "/)"] @punctuation.bracket) + +[ + ":" + "," + "/" + "%" + "::" + "=>" +] @punctuation.delimiter + +; Literals + +(string_literal) @string + +(number_literal) @number + +(boolean_literal) @boolean + +(null_literal) @constant.builtin + +; Comments + +(comment) @comment @spell + +((comment) @comment.documentation + (#lua-match? @comment.documentation "^!>")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fortran/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fortran/indents.scm new file mode 100644 index 00000000..86704c4f --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fortran/indents.scm @@ -0,0 +1,27 @@ +[ + (module) + (program) + (subroutine) + (function) + ; (interface) + (if_statement) + (do_loop_statement) + (where_statement) + (derived_type_definition) + (enum) +] @indent.begin + +[ + (end_module_statement) + (end_program_statement) + (end_subroutine_statement) + (end_function_statement) + ; (end_interface_statement) + (end_if_statement) + (end_do_loop_statement) + (else_clause) + (elseif_clause) + (end_type_statement) + (end_enum_statement) + (end_where_statement) +] @indent.branch diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fsh/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fsh/highlights.scm new file mode 100644 index 00000000..e4c0edd8 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fsh/highlights.scm @@ -0,0 +1,91 @@ +[ + "(" + ")" +] @punctuation.bracket + +[ + "^" + "=" + ":" +] @operator + +[ + "#" + ".." + "*" + "->" +] @punctuation.special + +; Entities +[ + "Profile" + "Alias" + "Extension" + "Invariant" + "Instance" + "ValueSet" + "CodeSystem" + "Mapping" + "Logical" + "Resource" + "RuleSet" +] @keyword + +; Metadata Keywords +[ + "Parent" + "Title" + "Description" + "Id" + "Severity" + "InstanceOf" + "Usage" + "Source" + "XPath" + "Target" +] @keyword + +; Rule Keywords +[ + "contentReference" + "insert" + "and" + "or" + "contains" + "named" + "only" + "obeys" + "valueset" + "codes" + "from" + "include" + "exclude" + "where" + "system" + "exactly" +] @keyword.operator + +; Types +[ + "Reference" + "Canonical" +] @type.builtin + + +(sd_metadata (parent (name))) @type +(target_type (name)) @type + +; Strings +(string) @string +(multiline_string) @string + +; Constants +(strength_value) @constant +(bool) @constant.boolean +(flag) @constant + +; Special Params +(code_value) @parameter + +; Extras +(fsh_comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/func/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/func/highlights.scm new file mode 100644 index 00000000..c1662a18 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/func/highlights.scm @@ -0,0 +1,175 @@ +; Include + +"#include" @include +(include_path) @string + +; Preproc + +[ + "#pragma" +] @preproc + +(pragma_directive + [ + "version" + "not-version" + "test-version-set" + ] @preproc) + +; Keywords + +[ + "asm" + "impure" + "inline" + "inline_ref" + "method_id" + "type" +] @keyword + +[ + "return" +] @keyword.return + +; Conditionals + +[ + "if" + "ifnot" + "else" + "elseif" + "elseifnot" + "until" +] @conditional + +; Exceptions + +[ + "try" + "catch" +] @exception + +; Repeats + +[ + "do" + "forall" + "repeat" + "while" +] @repeat + +; Qualifiers +[ + "const" + "global" + (var) +] @type.qualifier + +; Variables + +(identifier) @variable + +; Constants + +(const_var_declarations + name: (identifier) @constant) + +; Functions/Methods + +(function_definition + name: (function_name) @function) + +(function_application + function: (identifier) @function) + +(method_call + method_name: (identifier) @method.call) + +; Parameters + +(parameter) @parameter + +; Types + +(type_identifier) @type + +(primitive_type) @type.builtin + +; Operators + +[ + "=" + "+=" + "-=" + "*=" + "/=" + "~/=" + "^/=" + "%=" + "~%=" + "^%=" + "<<=" + ">>=" + "~>>=" + "^>>=" + "&=" + "|=" + "^=" + "==" + "<" + ">" + "<=" + ">=" + "!=" + "<=>" + "<<" + ">>" + "~>>" + "^>>" + "-" + "+" + "|" + "^" + "*" + "/" + "%" + "~/" + "^/" + "~%" + "^%" + "/%" + "&" + "~" +] @operator + +; Literals + +[ + (string) + (asm_instruction) +] @string + +[ + (string_type) + (underscore) +] @character.special + +(number) @number + +; Punctuation + +["{" "}"] @punctuation.bracket + +["(" ")" "()"] @punctuation.bracket + +["[" "]"] @punctuation.bracket + +[ + ";" + "," + "->" +] @punctuation.delimiter + +; Comments + +(comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fusion/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fusion/folds.scm new file mode 100644 index 00000000..179fc160 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fusion/folds.scm @@ -0,0 +1,6 @@ +[ + (comment) + (block) + (afx_comment) + (afx_element) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fusion/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fusion/highlights.scm new file mode 100644 index 00000000..81f471f6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fusion/highlights.scm @@ -0,0 +1,120 @@ +(comment) @comment @spell +(afx_comment) @comment @spell + +; identifiers afx +(afx_opening_element + (afx_identifier) @tag) +(afx_closing_element + (afx_identifier) @tag) +(afx_element_self_closing + (afx_identifier) @tag) + +(afx_attribute + (afx_property_identifier) @tag.attribute) + +(afx_text) @text + +; identifiers eel + +(eel_object_path + (eel_path_identifier) @variable.builtin + (#any-of? @variable.builtin "this" "props") +) + +(eel_object_path + (eel_path_identifier) @variable) + +(eel_object_pair + key: (eel_property_name) @property) + +(eel_method_name) @function + +(eel_parameter) @variable + +; identifiers fusion +; ----------- + +(path_part) @property +(meta_property) @attribute +(prototype_signature + "prototype" @keyword + +) +(include_statement + [ + "include" + ] @include + (source_file) @text.uri +) + +(namespace_declaration + "namespace" @keyword + (alias_namespace) @namespace) + +(type + name: (type_name) @type) + +; tokens +; ------ +(afx_opening_element + [ + "<" + ">" + ] @punctuation.bracket) + + (afx_closing_element + [ + "<" + ">" + "/" + ] @punctuation.bracket) + +(afx_element_self_closing + [ + "<" + "/>" + ] @punctuation.bracket) + +[ + (package_name) + (alias_namespace) +] @namespace + +(namespace_declaration "=" @operator) +(assignment "=" @operator) +(copy "<" @operator) +(deletion) @operator +(eel_binary_expression + operator: _ @operator) +(eel_not_expression + [ + "!" + "not" + ] @operator) + +(string) @string +(number) @number +(boolean) @boolean +(null) @constant.builtin + +(value_expression + start: _ @punctuation.special + end: _ @punctuation.special +) +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket + +[ + ":" + "." + "?" +] @punctuation.delimiter + +(eel_ternary_expression + ["?" ":"] @conditional.ternary) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fusion/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fusion/indents.scm new file mode 100644 index 00000000..73133191 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fusion/indents.scm @@ -0,0 +1,19 @@ +[ + (block) + (value_dsl) + (afx_element) + (afx_element_self_closing) + (eel_array) + (eel_object) +] @indent.begin + + +(block end: _ @indent.branch) +(value_dsl end: _ @indent.branch) +(eel_array end: _ @indent.branch) +(eel_object end: _ @indent.branch) +[ + (afx_closing_element) +] @indent.branch + +(comment) @indent.ignore diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fusion/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fusion/locals.scm new file mode 100644 index 00000000..24dc57bb --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/fusion/locals.scm @@ -0,0 +1,21 @@ +;; Fusion base +(block) @scope + +(namespace_declaration + (alias_namespace) @definition.namespace) + +(property + (path (path_part) @definition.field)) + +(type + namespace: (package_name)? @definition.namespace + name: (type_name) @definition.type +) + +;; Eel Expressions +(eel_arrow_function) @scope +(eel_object) @scope + +(eel_parameter) @definition.parameter +(eel_object_pair + key: (eel_property_name) @definition.field) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gdscript/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gdscript/folds.scm new file mode 100644 index 00000000..946b0fea --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gdscript/folds.scm @@ -0,0 +1,25 @@ +[ + ; Body fold will "join" the next adjacent fold into a SUPER fold. + ; This is an issue with the grammar. + ; (body) + + (if_statement) + (elif_clause) + (else_clause) + (for_statement) + (while_statement) + (class_definition) + (enum_definition) + (match_statement) + (pattern_section) + (function_definition) + (lambda) + (constructor_definition) +] @fold + +; It's nice to be able to fold the if/elif/else clauses and the entire +; if_statement. +(if_statement (body) @fold) + +; Fold strings that are probably doc strings. +(expression_statement (string) @fold) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gdscript/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gdscript/highlights.scm new file mode 100644 index 00000000..535dcd00 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gdscript/highlights.scm @@ -0,0 +1,343 @@ +;; Basic + +(identifier) @variable +(name) @variable +(type) @type +(comment) @comment @spell +(string_name) @string +(string) @string +(float) @float +(integer) @number +(null) @constant +(setter) @function +(getter) @function +(set_body "set" @keyword.function) +(get_body "get" @keyword.function) +(static_keyword) @type.qualifier +(tool_statement) @keyword +(breakpoint_statement) @debug +(inferred_type) @operator +[(true) (false)] @boolean + +[ + (get_node) + (node_path) +] @text.uri + +(class_name_statement + (name) @type) @keyword + +(const_statement + "const" @type.qualifier + (name) @constant) + +(expression_statement (string) @comment @spell) + +;; Identifier naming conventions +((identifier) @type + (#lua-match? @type "^[A-Z]")) +((identifier) @constant + (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) + +;; Functions +(constructor_definition) @constructor + +(function_definition + (name) @function (parameters + (identifier) @parameter)*) + +(typed_parameter (identifier) @parameter) +(default_parameter (identifier) @parameter) + +(call (identifier) @function.call) +(call (identifier) @include + (#any-of? @include "preload" "load")) + +;; Properties and Methods + +; We'll use @property since that's the term Godot uses. +; But, should (source (variable_statement (name))) be @property, too? Since a +; script file is a class in gdscript. +(class_definition + (body (variable_statement (name) @property))) + +; Same question but for methods? +(class_definition + (body (function_definition (name) @method))) + +(attribute_call (identifier) @method.call) +(attribute (_) (identifier) @property) + +;; Enums + +(enumerator left: (identifier) @constant) + +;; Special Builtins + +((identifier) @variable.builtin + (#any-of? @variable.builtin "self" "super")) + +(attribute_call (identifier) @keyword.operator + (#eq? @keyword.operator "new")) + +;; Match Pattern + +(underscore) @constant ; The "_" pattern. +(pattern_open_ending) @operator ; The ".." pattern. + +;; Alternations +["(" ")" "[" "]" "{" "}"] @punctuation.bracket + +["," "." ":"] @punctuation.delimiter + +["if" "elif" "else" "match"] @conditional + +["for" "while" "break" "continue"] @repeat + +[ + "~" + "-" + "*" + "/" + "%" + "+" + "-" + "<<" + ">>" + "&" + "^" + "|" + "<" + ">" + "==" + "!=" + ">=" + "<=" + "!" + "&&" + "||" + "=" + "+=" + "-=" + "*=" + "/=" + "%=" + "&=" + "|=" + "->" +] @operator + +[ + "and" + "as" + "in" + "is" + "not" + "or" +] @keyword.operator + +[ + "pass" + "class" + "class_name" + "extends" + "signal" + "enum" + "var" + "onready" + "export" + "setget" + "remote" + "master" + "puppet" + "remotesync" + "mastersync" + "puppetsync" +] @keyword + +"func" @keyword.function + +[ + "return" +] @keyword.return + +[ + "await" +] @keyword.coroutine + +(call (identifier) @keyword.coroutine + (#eq? @keyword.coroutine "yield")) + + +;; Builtins +; generated from +; - https://github.com/godotengine/godot/blob/491ded18983a4ae963ce9c29e8df5d5680873ccb/doc/classes/@GlobalScope.xml +; - https://github.com/godotengine/godot/blob/491ded18983a4ae963ce9c29e8df5d5680873ccb/modules/gdscript/doc_classes/@GDScript.xml +; some from: +; - https://github.com/godotengine/godot-vscode-plugin/blob/0636797c22bf1e23a41fd24d55cdb9be62e0c992/syntaxes/GDScript.tmLanguage.json + +;; Built-in Annotations + +((annotation "@" @attribute (identifier) @attribute) + (#any-of? @attribute + ; @GDScript + "export" "export_category" "export_color_no_alpha" "export_dir" + "export_enum" "export_exp_easing" "export_file" "export_flags" + "export_flags_2d_navigation" "export_flags_2d_physics" + "export_flags_2d_render" "export_flags_3d_navigation" + "export_flags_3d_physics" "export_flags_3d_render" "export_global_dir" + "export_global_file" "export_group" "export_multiline" "export_node_path" + "export_placeholder" "export_range" "export_subgroup" "icon" "onready" + "rpc" "tool" "warning_ignore" + )) + +;; Builtin Types + +([(identifier) (type)] @type.builtin + (#any-of? @type.builtin + ; from godot-vscode-plugin + "Vector2" "Vector2i" "Vector3" "Vector3i" + "Color" "Rect2" "Rect2i" "Array" "Basis" "Dictionary" + "Plane" "Quat" "RID" "Rect3" "Transform" "Transform2D" + "Transform3D" "AABB" "String" "NodePath" "Object" + "PoolByteArray" "PoolIntArray" "PoolRealArray" + "PoolStringArray" "PoolVector2Array" "PoolVector3Array" + "PoolColorArray" "bool" "int" "float" "StringName" "Quaternion" + "PackedByteArray" "PackedInt32Array" "PackedInt64Array" + "PackedFloat32Array" "PackedFloat64Array" "PackedStringArray" + "PackedVector2Array" "PackedVector2iArray" "PackedVector3Array" + "PackedVector3iArray" "PackedColorArray" + + ; @GlobalScope + "AudioServer" "CameraServer" "ClassDB" "DisplayServer" "Engine" + "EngineDebugger" "GDExtensionManager" "Geometry2D" "Geometry3D" "GodotSharp" + "IP" "Input" "InputMap" "JavaClassWrapper" "JavaScriptBridge" "Marshalls" + "NavigationMeshGenerator" "NavigationServer2D" "NavigationServer3D" "OS" + "Performance" "PhysicsServer2D" "PhysicsServer2DManager" "PhysicsServer3D" + "PhysicsServer3DManager" "ProjectSettings" "RenderingServer" "ResourceLoader" + "ResourceSaver" "ResourceUID" "TextServerManager" "ThemeDB" "Time" + "TranslationServer" "WorkerThreadPool" "XRServer" + )) + +;; Builtin Funcs + +(call (identifier) @function.builtin + (#any-of? @function.builtin + ; @GlobalScope + "abs" "absf" "absi" "acos" "asin" "atan" "atan2" "bezier_derivative" + "bezier_interpolate" "bytes_to_var" "bytes_to_var_with_objects" "ceil" "ceilf" + "ceili" "clamp" "clampf" "clampi" "cos" "cosh" "cubic_interpolate" + "cubic_interpolate_angle" "cubic_interpolate_angle_in_time" + "cubic_interpolate_in_time" "db_to_linear" "deg_to_rad" "ease" "error_string" + "exp" "floor" "floorf" "floori" "fmod" "fposmod" "hash" "instance_from_id" + "inverse_lerp" "is_equal_approx" "is_finite" "is_inf" "is_instance_id_valid" + "is_instance_valid" "is_nan" "is_same" "is_zero_approx" "lerp" "lerp_angle" + "lerpf" "linear_to_db" "log" "max" "maxf" "maxi" "min" "minf" "mini" + "move_toward" "nearest_po2" "pingpong" "posmod" "pow" "print" "print_rich" + "print_verbose" "printerr" "printraw" "prints" "printt" "push_error" + "push_warning" "rad_to_deg" "rand_from_seed" "randf" "randf_range" "randfn" + "randi" "randi_range" "randomize" "remap" "rid_allocate_id" "rid_from_int64" + "round" "roundf" "roundi" "seed" "sign" "signf" "signi" "sin" "sinh" + "smoothstep" "snapped" "snappedf" "snappedi" "sqrt" "step_decimals" "str" + "str_to_var" "tan" "tanh" "typeof" "var_to_bytes" "var_to_bytes_with_objects" + "var_to_str" "weakref" "wrap" "wrapf" "wrapi" + + ; @GDScript + "Color8" "assert" "char" "convert" "dict_to_inst" "get_stack" "inst_to_dict" + "is_instance_of" "len" "print_debug" "print_stack" "range" + "type_exists" + )) + +;; Builtin Constants + +((identifier) @constant.builtin + (#any-of? @constant.builtin + ; @GDScript + "PI" "TAU" "INF" "NAN" + + ; @GlobalScope + "SIDE_LEFT" "SIDE_TOP" "SIDE_RIGHT" "SIDE_BOTTOM" "CORNER_TOP_LEFT" "CORNER_TOP_RIGHT" "CORNER_BOTTOM_RIGHT" + "CORNER_BOTTOM_LEFT" "VERTICAL" "HORIZONTAL" "CLOCKWISE" "COUNTERCLOCKWISE" "HORIZONTAL_ALIGNMENT_LEFT" + "HORIZONTAL_ALIGNMENT_CENTER" "HORIZONTAL_ALIGNMENT_RIGHT" "HORIZONTAL_ALIGNMENT_FILL" "VERTICAL_ALIGNMENT_TOP" + "VERTICAL_ALIGNMENT_CENTER" "VERTICAL_ALIGNMENT_BOTTOM" "VERTICAL_ALIGNMENT_FILL" "INLINE_ALIGNMENT_TOP_TO" + "INLINE_ALIGNMENT_CENTER_TO" "INLINE_ALIGNMENT_BASELINE_TO" "INLINE_ALIGNMENT_BOTTOM_TO" "INLINE_ALIGNMENT_TO_TOP" + "INLINE_ALIGNMENT_TO_CENTER" "INLINE_ALIGNMENT_TO_BASELINE" "INLINE_ALIGNMENT_TO_BOTTOM" "INLINE_ALIGNMENT_TOP" + "INLINE_ALIGNMENT_CENTER" "INLINE_ALIGNMENT_BOTTOM" "INLINE_ALIGNMENT_IMAGE_MASK" "INLINE_ALIGNMENT_TEXT_MASK" + "EULER_ORDER_XYZ" "EULER_ORDER_XZY" "EULER_ORDER_YXZ" "EULER_ORDER_YZX" "EULER_ORDER_ZXY" "EULER_ORDER_ZYX" "KEY_NONE" + "KEY_SPECIAL" "KEY_ESCAPE" "KEY_TAB" "KEY_BACKTAB" "KEY_BACKSPACE" "KEY_ENTER" "KEY_KP_ENTER" "KEY_INSERT" "KEY_DELETE" + "KEY_PAUSE" "KEY_PRINT" "KEY_SYSREQ" "KEY_CLEAR" "KEY_HOME" "KEY_END" "KEY_LEFT" "KEY_UP" "KEY_RIGHT" "KEY_DOWN" + "KEY_PAGEUP" "KEY_PAGEDOWN" "KEY_SHIFT" "KEY_CTRL" "KEY_META" "KEY_ALT" "KEY_CAPSLOCK" "KEY_NUMLOCK" "KEY_SCROLLLOCK" + "KEY_F1" "KEY_F2" "KEY_F3" "KEY_F4" "KEY_F5" "KEY_F6" "KEY_F7" "KEY_F8" "KEY_F9" "KEY_F10" "KEY_F11" "KEY_F12" + "KEY_F13" "KEY_F14" "KEY_F15" "KEY_F16" "KEY_F17" "KEY_F18" "KEY_F19" "KEY_F20" "KEY_F21" "KEY_F22" "KEY_F23" "KEY_F24" + "KEY_F25" "KEY_F26" "KEY_F27" "KEY_F28" "KEY_F29" "KEY_F30" "KEY_F31" "KEY_F32" "KEY_F33" "KEY_F34" "KEY_F35" + "KEY_KP_MULTIPLY" "KEY_KP_DIVIDE" "KEY_KP_SUBTRACT" "KEY_KP_PERIOD" "KEY_KP_ADD" "KEY_KP_0" "KEY_KP_1" "KEY_KP_2" + "KEY_KP_3" "KEY_KP_4" "KEY_KP_5" "KEY_KP_6" "KEY_KP_7" "KEY_KP_8" "KEY_KP_9" "KEY_MENU" "KEY_HYPER" "KEY_HELP" + "KEY_BACK" "KEY_FORWARD" "KEY_STOP" "KEY_REFRESH" "KEY_VOLUMEDOWN" "KEY_VOLUMEMUTE" "KEY_VOLUMEUP" "KEY_MEDIAPLAY" + "KEY_MEDIASTOP" "KEY_MEDIAPREVIOUS" "KEY_MEDIANEXT" "KEY_MEDIARECORD" "KEY_HOMEPAGE" "KEY_FAVORITES" "KEY_SEARCH" + "KEY_STANDBY" "KEY_OPENURL" "KEY_LAUNCHMAIL" "KEY_LAUNCHMEDIA" "KEY_LAUNCH0" "KEY_LAUNCH1" "KEY_LAUNCH2" "KEY_LAUNCH3" + "KEY_LAUNCH4" "KEY_LAUNCH5" "KEY_LAUNCH6" "KEY_LAUNCH7" "KEY_LAUNCH8" "KEY_LAUNCH9" "KEY_LAUNCHA" "KEY_LAUNCHB" + "KEY_LAUNCHC" "KEY_LAUNCHD" "KEY_LAUNCHE" "KEY_LAUNCHF" "KEY_UNKNOWN" "KEY_SPACE" "KEY_EXCLAM" "KEY_QUOTEDBL" + "KEY_NUMBERSIGN" "KEY_DOLLAR" "KEY_PERCENT" "KEY_AMPERSAND" "KEY_APOSTROPHE" "KEY_PARENLEFT" "KEY_PARENRIGHT" + "KEY_ASTERISK" "KEY_PLUS" "KEY_COMMA" "KEY_MINUS" "KEY_PERIOD" "KEY_SLASH" "KEY_0" "KEY_1" "KEY_2" "KEY_3" "KEY_4" + "KEY_5" "KEY_6" "KEY_7" "KEY_8" "KEY_9" "KEY_COLON" "KEY_SEMICOLON" "KEY_LESS" "KEY_EQUAL" "KEY_GREATER" "KEY_QUESTION" + "KEY_AT" "KEY_A" "KEY_B" "KEY_C" "KEY_D" "KEY_E" "KEY_F" "KEY_G" "KEY_H" "KEY_I" "KEY_J" "KEY_K" "KEY_L" "KEY_M" + "KEY_N" "KEY_O" "KEY_P" "KEY_Q" "KEY_R" "KEY_S" "KEY_T" "KEY_U" "KEY_V" "KEY_W" "KEY_X" "KEY_Y" "KEY_Z" + "KEY_BRACKETLEFT" "KEY_BACKSLASH" "KEY_BRACKETRIGHT" "KEY_ASCIICIRCUM" "KEY_UNDERSCORE" "KEY_QUOTELEFT" "KEY_BRACELEFT" + "KEY_BAR" "KEY_BRACERIGHT" "KEY_ASCIITILDE" "KEY_YEN" "KEY_SECTION" "KEY_GLOBE" "KEY_KEYBOARD" "KEY_JIS_EISU" + "KEY_JIS_KANA" "KEY_CODE_MASK" "KEY_MODIFIER_MASK" "KEY_MASK_CMD_OR_CTRL" "KEY_MASK_SHIFT" "KEY_MASK_ALT" + "KEY_MASK_META" "KEY_MASK_CTRL" "KEY_MASK_KPAD" "KEY_MASK_GROUP_SWITCH" "MOUSE_BUTTON_NONE" "MOUSE_BUTTON_LEFT" + "MOUSE_BUTTON_RIGHT" "MOUSE_BUTTON_MIDDLE" "MOUSE_BUTTON_WHEEL_UP" "MOUSE_BUTTON_WHEEL_DOWN" "MOUSE_BUTTON_WHEEL_LEFT" + "MOUSE_BUTTON_WHEEL_RIGHT" "MOUSE_BUTTON_XBUTTON1" "MOUSE_BUTTON_XBUTTON2" "MOUSE_BUTTON_MASK_LEFT" + "MOUSE_BUTTON_MASK_RIGHT" "MOUSE_BUTTON_MASK_MIDDLE" "MOUSE_BUTTON_MASK_MB_XBUTTON1" "MOUSE_BUTTON_MASK_MB_XBUTTON2" + "JOY_BUTTON_INVALID" "JOY_BUTTON_A" "JOY_BUTTON_B" "JOY_BUTTON_X" "JOY_BUTTON_Y" "JOY_BUTTON_BACK" "JOY_BUTTON_GUIDE" + "JOY_BUTTON_START" "JOY_BUTTON_LEFT_STICK" "JOY_BUTTON_RIGHT_STICK" "JOY_BUTTON_LEFT_SHOULDER" + "JOY_BUTTON_RIGHT_SHOULDER" "JOY_BUTTON_DPAD_UP" "JOY_BUTTON_DPAD_DOWN" "JOY_BUTTON_DPAD_LEFT" "JOY_BUTTON_DPAD_RIGHT" + "JOY_BUTTON_MISC1" "JOY_BUTTON_PADDLE1" "JOY_BUTTON_PADDLE2" "JOY_BUTTON_PADDLE3" "JOY_BUTTON_PADDLE4" + "JOY_BUTTON_TOUCHPAD" "JOY_BUTTON_SDL_MAX" "JOY_BUTTON_MAX" "JOY_AXIS_INVALID" "JOY_AXIS_LEFT_X" "JOY_AXIS_LEFT_Y" + "JOY_AXIS_RIGHT_X" "JOY_AXIS_RIGHT_Y" "JOY_AXIS_TRIGGER_LEFT" "JOY_AXIS_TRIGGER_RIGHT" "JOY_AXIS_SDL_MAX" + "JOY_AXIS_MAX" "MIDI_MESSAGE_NONE" "MIDI_MESSAGE_NOTE_OFF" "MIDI_MESSAGE_NOTE_ON" "MIDI_MESSAGE_AFTERTOUCH" + "MIDI_MESSAGE_CONTROL_CHANGE" "MIDI_MESSAGE_PROGRAM_CHANGE" "MIDI_MESSAGE_CHANNEL_PRESSURE" "MIDI_MESSAGE_PITCH_BEND" + "MIDI_MESSAGE_SYSTEM_EXCLUSIVE" "MIDI_MESSAGE_QUARTER_FRAME" "MIDI_MESSAGE_SONG_POSITION_POINTER" + "MIDI_MESSAGE_SONG_SELECT" "MIDI_MESSAGE_TUNE_REQUEST" "MIDI_MESSAGE_TIMING_CLOCK" "MIDI_MESSAGE_START" + "MIDI_MESSAGE_CONTINUE" "MIDI_MESSAGE_STOP" "MIDI_MESSAGE_ACTIVE_SENSING" "MIDI_MESSAGE_SYSTEM_RESET" "OK" "FAILED" + "ERR_UNAVAILABLE" "ERR_UNCONFIGURED" "ERR_UNAUTHORIZED" "ERR_PARAMETER_RANGE_ERROR" "ERR_OUT_OF_MEMORY" + "ERR_FILE_NOT_FOUND" "ERR_FILE_BAD_DRIVE" "ERR_FILE_BAD_PATH" "ERR_FILE_NO_PERMISSION" "ERR_FILE_ALREADY_IN_USE" + "ERR_FILE_CANT_OPEN" "ERR_FILE_CANT_WRITE" "ERR_FILE_CANT_READ" "ERR_FILE_UNRECOGNIZED" "ERR_FILE_CORRUPT" + "ERR_FILE_MISSING_DEPENDENCIES" "ERR_FILE_EOF" "ERR_CANT_OPEN" "ERR_CANT_CREATE" "ERR_QUERY_FAILED" + "ERR_ALREADY_IN_USE" "ERR_LOCKED" "ERR_TIMEOUT" "ERR_CANT_CONNECT" "ERR_CANT_RESOLVE" "ERR_CONNECTION_ERROR" + "ERR_CANT_ACQUIRE_RESOURCE" "ERR_CANT_FORK" "ERR_INVALID_DATA" "ERR_INVALID_PARAMETER" "ERR_ALREADY_EXISTS" + "ERR_DOES_NOT_EXIST" "ERR_DATABASE_CANT_READ" "ERR_DATABASE_CANT_WRITE" "ERR_COMPILATION_FAILED" "ERR_METHOD_NOT_FOUND" + "ERR_LINK_FAILED" "ERR_SCRIPT_FAILED" "ERR_CYCLIC_LINK" "ERR_INVALID_DECLARATION" "ERR_DUPLICATE_SYMBOL" + "ERR_PARSE_ERROR" "ERR_BUSY" "ERR_SKIP" "ERR_HELP" "ERR_BUG" "ERR_PRINTER_ON_FIRE" "PROPERTY_HINT_NONE" + "PROPERTY_HINT_RANGE" "PROPERTY_HINT_ENUM" "PROPERTY_HINT_ENUM_SUGGESTION" "PROPERTY_HINT_EXP_EASING" + "PROPERTY_HINT_LINK" "PROPERTY_HINT_FLAGS" "PROPERTY_HINT_LAYERS_2D_RENDER" "PROPERTY_HINT_LAYERS_2D_PHYSICS" + "PROPERTY_HINT_LAYERS_2D_NAVIGATION" "PROPERTY_HINT_LAYERS_3D_RENDER" "PROPERTY_HINT_LAYERS_3D_PHYSICS" + "PROPERTY_HINT_LAYERS_3D_NAVIGATION" "PROPERTY_HINT_FILE" "PROPERTY_HINT_DIR" "PROPERTY_HINT_GLOBAL_FILE" + "PROPERTY_HINT_GLOBAL_DIR" "PROPERTY_HINT_RESOURCE_TYPE" "PROPERTY_HINT_MULTILINE_TEXT" "PROPERTY_HINT_EXPRESSION" + "PROPERTY_HINT_PLACEHOLDER_TEXT" "PROPERTY_HINT_COLOR_NO_ALPHA" "PROPERTY_HINT_OBJECT_ID" "PROPERTY_HINT_TYPE_STRING" + "PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE" "PROPERTY_HINT_OBJECT_TOO_BIG" "PROPERTY_HINT_NODE_PATH_VALID_TYPES" + "PROPERTY_HINT_SAVE_FILE" "PROPERTY_HINT_GLOBAL_SAVE_FILE" "PROPERTY_HINT_INT_IS_OBJECTID" + "PROPERTY_HINT_INT_IS_POINTER" "PROPERTY_HINT_ARRAY_TYPE" "PROPERTY_HINT_LOCALE_ID" "PROPERTY_HINT_LOCALIZABLE_STRING" + "PROPERTY_HINT_NODE_TYPE" "PROPERTY_HINT_HIDE_QUATERNION_EDIT" "PROPERTY_HINT_PASSWORD" "PROPERTY_HINT_MAX" + "PROPERTY_USAGE_NONE" "PROPERTY_USAGE_STORAGE" "PROPERTY_USAGE_EDITOR" "PROPERTY_USAGE_INTERNAL" + "PROPERTY_USAGE_CHECKABLE" "PROPERTY_USAGE_CHECKED" "PROPERTY_USAGE_GROUP" "PROPERTY_USAGE_CATEGORY" + "PROPERTY_USAGE_SUBGROUP" "PROPERTY_USAGE_CLASS_IS_BITFIELD" "PROPERTY_USAGE_NO_INSTANCE_STATE" + "PROPERTY_USAGE_RESTART_IF_CHANGED" "PROPERTY_USAGE_SCRIPT_VARIABLE" "PROPERTY_USAGE_STORE_IF_NULL" + "PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED" "PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE" "PROPERTY_USAGE_CLASS_IS_ENUM" + "PROPERTY_USAGE_NIL_IS_VARIANT" "PROPERTY_USAGE_ARRAY" "PROPERTY_USAGE_ALWAYS_DUPLICATE" + "PROPERTY_USAGE_NEVER_DUPLICATE" "PROPERTY_USAGE_HIGH_END_GFX" "PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT" + "PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT" "PROPERTY_USAGE_KEYING_INCREMENTS" "PROPERTY_USAGE_DEFERRED_SET_RESOURCE" + "PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT" "PROPERTY_USAGE_EDITOR_BASIC_SETTING" "PROPERTY_USAGE_READ_ONLY" + "PROPERTY_USAGE_DEFAULT" "PROPERTY_USAGE_NO_EDITOR" "METHOD_FLAG_NORMAL" "METHOD_FLAG_EDITOR" "METHOD_FLAG_CONST" + "METHOD_FLAG_VIRTUAL" "METHOD_FLAG_VARARG" "METHOD_FLAG_STATIC" "METHOD_FLAG_OBJECT_CORE" "METHOD_FLAGS_DEFAULT" + "TYPE_NIL" "TYPE_BOOL" "TYPE_INT" "TYPE_FLOAT" "TYPE_STRING" "TYPE_VECTOR2" "TYPE_VECTOR2I" "TYPE_RECT2" "TYPE_RECT2I" + "TYPE_VECTOR3" "TYPE_VECTOR3I" "TYPE_TRANSFORM2D" "TYPE_VECTOR4" "TYPE_VECTOR4I" "TYPE_PLANE" "TYPE_QUATERNION" + "TYPE_AABB" "TYPE_BASIS" "TYPE_TRANSFORM3D" "TYPE_PROJECTION" "TYPE_COLOR" "TYPE_STRING_NAME" "TYPE_NODE_PATH" + "TYPE_RID" "TYPE_OBJECT" "TYPE_CALLABLE" "TYPE_SIGNAL" "TYPE_DICTIONARY" "TYPE_ARRAY" "TYPE_PACKED_BYTE_ARRAY" + "TYPE_PACKED_INT32_ARRAY" "TYPE_PACKED_INT64_ARRAY" "TYPE_PACKED_FLOAT32_ARRAY" "TYPE_PACKED_FLOAT64_ARRAY" + "TYPE_PACKED_STRING_ARRAY" "TYPE_PACKED_VECTOR2_ARRAY" "TYPE_PACKED_VECTOR3_ARRAY" "TYPE_PACKED_COLOR_ARRAY" "TYPE_MAX" + "OP_EQUAL" "OP_NOT_EQUAL" "OP_LESS" "OP_LESS_EQUAL" "OP_GREATER" "OP_GREATER_EQUAL" "OP_ADD" "OP_SUBTRACT" + "OP_MULTIPLY" "OP_DIVIDE" "OP_NEGATE" "OP_POSITIVE" "OP_MODULE" "OP_POWER" "OP_SHIFT_LEFT" "OP_SHIFT_RIGHT" + "OP_BIT_AND" "OP_BIT_OR" "OP_BIT_XOR" "OP_BIT_NEGATE" "OP_AND" "OP_OR" "OP_XOR" "OP_NOT" "OP_IN" "OP_MAX" + )) + diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gdscript/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gdscript/indents.scm new file mode 100644 index 00000000..4eb579b2 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gdscript/indents.scm @@ -0,0 +1,78 @@ +[ + (lambda) + (function_definition) + + (for_statement) + (while_statement) + (if_statement) + (class_definition) + (match_statement) + (pattern_section) + (setget) + (match_body) + (set_body) + (get_body) +] @indent.begin + +[ + (elif_clause) + (else_clause) +] @indent.branch + +[ + (string) + (comment) + (array) + (dictionary) + (parenthesized_expression) + (ERROR) +] @indent.auto + +[ + (pass_statement) + (continue_statement) + (break_statement) + (return_statement) +] @indent.dedent + +[ + (ERROR "[") + (ERROR "(") + (ERROR "{") +] @indent.begin + +;; This only works with expanded tabs. +; ((parameters) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")")) +; ((arguments) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")")) + +;; The following queries either do not agree with the current body parsing or are +;; attempted workarounds. Specifically as the last statement of a body. Opening +;; a new line in between statements works well. +;; +;; The overall experience is poor, so I've opted for @indent.auto. +;; +;; The gdscript parser will need to be patched to accommodate more interactive +;; edits. As far as I can tell the parser greedily consumes whitespace +;; as a zero-width token which causes trouble when inserting indents. + +;; This indents correctly with tabs. +; (arguments) @indent.begin +; (parameters) @indent.begin +; (array) @indent.begin +; (dictionary) @indent.begin +; (parenthesized_expression) @indent.begin + +;; Partial workaround for when the cursor is on the bracket character and a newline +;; is created with . Without this the newline is opened with extra +;; indentation. +; (body (_ (array "]" @indent.end) ) _) +;; Problematic behaviors occur at the last statement of a body. +;; with @dedent: +;; - [ | ] i will dedent ] to 0. +;; - [ +;; ]| o will open new line at correct indentation. +;; with @auto: +;; - [ | ] i same +;; - [ +;; ]| o will open new line with extra indent. +;(body (_ (array "]" @indent.auto) ) .) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gdscript/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gdscript/injections.scm new file mode 100644 index 00000000..6adae45a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gdscript/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gdscript/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gdscript/locals.scm new file mode 100644 index 00000000..2c352b4a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gdscript/locals.scm @@ -0,0 +1,92 @@ +;; Scopes + +[ + (if_statement) + (elif_clause) + (else_clause) + (for_statement) + (while_statement) + (function_definition) + (constructor_definition) + (class_definition) + (match_statement) + (pattern_section) + (lambda) + (get_body) + (set_body) +] @scope + +;; Parameters + +(parameters (identifier) @definition.parameter) +(default_parameter (identifier) @definition.parameter) +(typed_parameter (identifier) @definition.parameter) +(typed_default_parameter (identifier) @definition.parameter) + +;; Signals + +; Can gdscript 2 signals be considered fields? +(signal_statement (name) @definition.field) + +;; Variable Definitions + +(const_statement (name) @definition.constant) +; onready and export variations are only properties. +(variable_statement (name) @definition.var) + +(setter) @reference +(getter) @reference + +;; Function Definition + +((function_definition (name) @definition.function) + (#set! "definition.function.scope" "parent")) + +;; Lambda + +; lambda names are not accessible and are only for debugging. +(lambda (name) @definition.function) + +;; Source + +(class_name_statement (name) @definition.type) + +(source (variable_statement (name) @definition.field)) +(source (onready_variable_statement (name) @definition.field)) +(source (export_variable_statement (name) @definition.field)) + +;; Class + +((class_definition (name) @definition.type) + (#set! "definition.type.scope" "parent")) + +(class_definition + (body (variable_statement (name) @definition.field))) +(class_definition + (body (onready_variable_statement (name) @definition.field))) +(class_definition + (body (export_variable_statement (name) @definition.field))) +(class_definition + (body (signal_statement (name) @definition.field))) + +; Although a script is also a class, let's only define functions in an inner class as +; methods. +((class_definition + (body (function_definition (name) @definition.method))) + (#set! "definition.method.scope" "parent")) + +;; Enum + +((enum_definition (name) @definition.enum)) + +;; Repeat + +(for_statement . (identifier) @definition.var) + +;; Match Statement + +(pattern_binding (identifier) @definition.var) + +;; References + +(identifier) @reference diff --git a/config/neovim/store/lazy-plugins/chadtree/chadtree/__init__.py b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/git_config/folds.scm similarity index 100% rename from config/neovim/store/lazy-plugins/chadtree/chadtree/__init__.py rename to config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/git_config/folds.scm diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/git_config/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/git_config/highlights.scm new file mode 100644 index 00000000..18b75bc6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/git_config/highlights.scm @@ -0,0 +1,49 @@ +; Sections + +(section_name) @type + +((section_name) @include + (#eq? @include "include")) + +((section_header + (section_name) @include + (subsection_name)) + (#eq? @include "includeIf")) + +(variable (name) @property) + +; Operators + +[ + "=" +] @operator + +; Literals + +(integer) @number +[ + (true) + (false) +] @boolean + +(string) @string + +((string) @text.uri + (#lua-match? @text.uri "^[.]?[/]")) + +((string) @text.uri + (#lua-match? @text.uri "^[~]")) + +(section_header + [ + "\"" + (subsection_name) + ] @string.special) + +; Punctuation + +[ "[" "]" ] @punctuation.bracket + +; Comments + +(comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/git_rebase/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/git_rebase/highlights.scm new file mode 100644 index 00000000..466bd2f1 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/git_rebase/highlights.scm @@ -0,0 +1,8 @@ +((command) @keyword + (label)? @constant + (message)? @text @spell) + +(option) @operator + +(comment) @comment + diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/git_rebase/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/git_rebase/injections.scm new file mode 100644 index 00000000..8e6815a6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/git_rebase/injections.scm @@ -0,0 +1,6 @@ +((operation + (command) @_command + (message) @injection.content) +(#set! injection.language "bash") +(#any-of? @_command "exec" "x")) + diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitattributes/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitattributes/highlights.scm new file mode 100644 index 00000000..5d044b35 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitattributes/highlights.scm @@ -0,0 +1,51 @@ +(dir_sep) @punctuation.delimiter + +(quoted_pattern + ("\"" @punctuation.special)) + +(range_notation) @string.special + +(range_notation + [ "[" "]" ] @punctuation.bracket) + +(wildcard) @character.special + +(range_negation) @operator + +(character_class) @constant + +(class_range ("-" @operator)) + +[ + (ansi_c_escape) + (escaped_char) +] @string.escape + +(attribute + (attr_name) @parameter) + +(attribute + (builtin_attr) @variable.builtin) + +[ + (attr_reset) + (attr_unset) + (attr_set) +] @operator + +(boolean_value) @boolean + +(string_value) @string + +(macro_tag) @preproc + +(macro_def + macro_name: (_) @property) + +[ + (pattern_negation) + (redundant_escape) + (trailing_slash) +] @error + +(comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitattributes/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitattributes/injections.scm new file mode 100644 index 00000000..6adae45a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitattributes/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitattributes/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitattributes/locals.scm new file mode 100644 index 00000000..6a9aee1d --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitattributes/locals.scm @@ -0,0 +1,4 @@ +(macro_def (attr_name) @definition.macro) + +(attribute (attr_name) @reference) +(attribute (builtin_attr) @reference) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitcommit/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitcommit/highlights.scm new file mode 100644 index 00000000..9c70e19b --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitcommit/highlights.scm @@ -0,0 +1,32 @@ +(comment) @comment +(generated_comment) @comment +(title) @text.title +(text) @text +(branch) @text.reference +(change) @keyword +(filepath) @text.uri +(arrow) @punctuation.delimiter + +(subject) @text.title @spell +(subject (overflow) @text @spell) +(subject (subject_prefix) @function @nospell) +(prefix (type) @keyword @nospell) +(prefix (scope) @parameter @nospell) +(prefix [ + "(" + ")" + ":" +] @punctuation.delimiter) +(prefix [ + "!" +] @punctuation.special) + +(message) @text @spell + +(trailer (token) @label) +(trailer (value) @text) + +(breaking_change (token) @text.warning) +(breaking_change (value) @text @spell) + +(scissor) @comment diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitcommit/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitcommit/injections.scm new file mode 100644 index 00000000..5e56dfa5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitcommit/injections.scm @@ -0,0 +1,5 @@ +((diff) @injection.content + (#set! injection.language "diff")) + +((rebase_command) @injection.content + (#set! injection.language "git_rebase")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitignore/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitignore/highlights.scm new file mode 100644 index 00000000..6e83ea6f --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gitignore/highlights.scm @@ -0,0 +1,31 @@ +(comment) @comment @spell + +[ + (directory_separator) + (directory_separator_escaped) +] @punctuation.delimiter + +[ + (wildcard_char_single) + (wildcard_chars) + (wildcard_chars_allow_slash) + (bracket_negation) +] @operator + +(negation) @punctuation.special + +[ + (pattern_char_escaped) + (bracket_char_escaped) +] @string.escape + +;; bracket expressions +[ + "[" + "]" +] @punctuation.bracket + +(bracket_char) @constant +(bracket_range + "-" @operator) +(bracket_char_class) @constant.builtin diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gleam/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gleam/folds.scm new file mode 100644 index 00000000..7c3b1674 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gleam/folds.scm @@ -0,0 +1,7 @@ +; Folds +[ + (case) + (function) + (anonymous_function) + (type_definition) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gleam/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gleam/highlights.scm new file mode 100644 index 00000000..bc392dec --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gleam/highlights.scm @@ -0,0 +1,169 @@ +; Keywords +[ + "as" + "let" + "panic" + "todo" + "type" + "use" +] @keyword + +; Function Keywords +[ + "fn" +] @keyword.function + +; Imports +[ + "import" +] @include + +; Conditionals +[ + "case" + "if" +] @conditional + +; Exceptions +[ + "assert" +] @exception + +; Punctuation +[ + "(" + ")" + "<<" + ">>" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +[ + "," + "." + ":" + "->" +] @punctuation.delimiter + +[ + "#" +] @punctuation.special + +; Operators +[ + "%" + "&&" + "*" + "*." + "+" + "+." + "-" + "-." + ".." + "/" + "/." + "<" + "<." + "<=" + "<=." + "=" + "==" + ">" + ">." + ">=" + ">=." + "|>" + "||" +] @operator + +; Identifiers +(identifier) @variable + +; Comments +[ + (comment) +] @comment @spell + +[ + (module_comment) + (statement_comment) +] @comment.documentation @spell + +; Unused Identifiers +[ + (discard) + (hole) +] @comment + +; Modules & Imports +(module) @namespace +(import alias: ((identifier) @namespace)?) +(remote_type_identifier module: (identifier) @namespace) +(unqualified_import name: (identifier) @function) + +; Strings +(string) @string + +; Bit Strings +(bit_string_segment) @string.special + +; Numbers +(integer) @number + +(float) @float + +; Function Parameter Labels +(function_call arguments: (arguments (argument label: (label) @label))) +(function_parameter label: (label)? @label name: (identifier) @parameter) + +; Records +(record arguments: (arguments (argument label: (label) @property)?)) +(record_pattern_argument label: (label) @property) +(record_update_argument label: (label) @property) +(field_access record: (identifier) @variable field: (label) @property) +(data_constructor_argument (label) @property) + +; Types +[ + (type_identifier) + (type_parameter) + (type_var) +] @type + +((type_identifier) @type.builtin + (#any-of? @type.builtin "Int" "Float" "String" "List")) + +; Type Qualifiers +[ + "const" + "external" + (opacity_modifier) + (visibility_modifier) +] @type.qualifier + +; Tuples +(tuple_access index: (integer) @operator) + +; Functions +(function name: (identifier) @function) +(function_call function: (identifier) @function.call) +(function_call function: (field_access field: (label) @function.call)) + +; External Functions +(external_function name: (identifier) @function) +(external_function_body (string) @namespace . (string) @function) + +; Constructors +(constructor_name) @type @constructor + +([(type_identifier) (constructor_name)] @constant.builtin + (#any-of? @constant.builtin "Ok" "Error")) + +; Booleans +((constructor_name) @boolean (#any-of? @boolean "True" "False")) + +; Pipe Operator +(binary_expression operator: "|>" right: (identifier) @function) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gleam/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gleam/indents.scm new file mode 100644 index 00000000..37f88df6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gleam/indents.scm @@ -0,0 +1,28 @@ +; Gleam indents similar to Rust and JavaScript +[ + (anonymous_function) + (assert) + (case) + (case_clause) + (constant) + (external_function) + (function) + (import) + (let) + (list) + (constant) + (function) + (type_definition) + (type_alias) + (todo) + (tuple) +] @indent.begin + +[ + ")" + "]" + "}" +] @indent.end @indent.branch + +; Gleam pipelines are not indented, but other binary expression chains are +((binary_expression operator: _ @_operator) @indent.begin (#not-eq? @_operator "|>")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gleam/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gleam/injections.scm new file mode 100644 index 00000000..378240e3 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gleam/injections.scm @@ -0,0 +1,7 @@ +; Comments +([ + (module_comment) + (statement_comment) + (comment) + ] @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gleam/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gleam/locals.scm new file mode 100644 index 00000000..8872e51f --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gleam/locals.scm @@ -0,0 +1,24 @@ +; Let Binding Definition +(let pattern: (identifier) @definition) + +; List Pattern Definitions +(list_pattern (identifier) @definition) +(list_pattern assign: (identifier) @definition) + +; Tuple Pattern Definition +(tuple_pattern (identifier) @definition) + +; Record Pattern Definition +(record_pattern_argument pattern: (identifier) @definition) + +; Function Parameter Definition +(function_parameter name: (identifier) @definition) + +; References +(identifier) @reference + +; Function Body Scope +(function_body) @scope + +; Case Scope +(case_clause) @scope diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/glimmer/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/glimmer/folds.scm new file mode 100644 index 00000000..cfe9d35b --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/glimmer/folds.scm @@ -0,0 +1,4 @@ +[ + (element_node (element_node_start)) + (block_statement) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/glimmer/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/glimmer/highlights.scm new file mode 100644 index 00000000..a577ba42 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/glimmer/highlights.scm @@ -0,0 +1,88 @@ +; === Tag Names === + +; Tags that start with a lower case letter are HTML tags +; We'll also use this highlighting for named blocks (which start with `:`) +((tag_name) @tag + (#lua-match? @tag "^:?[%l]")) +; Tags that start with a capital letter are Glimmer components +((tag_name) @constructor + (#lua-match? @constructor "^%u")) + +(attribute_name) @property + +(string_literal) @string +(number_literal) @number +(boolean_literal) @boolean + +(concat_statement) @string + +; === Block Statements === + +; Highlight the brackets +(block_statement_start) @tag.delimiter +(block_statement_end) @tag.delimiter + +; Highlight `if`/`each`/`let` +(block_statement_start path: (identifier) @conditional) +(block_statement_end path: (identifier) @conditional) +((mustache_statement (identifier) @conditional) + (#lua-match? @conditional "else")) + +; == Mustache Statements === + +; Highlight the whole statement, to color brackets and separators +(mustache_statement) @tag.delimiter + +; An identifier in a mustache expression is a variable +((mustache_statement [ + (path_expression (identifier) @variable) + (identifier) @variable + ]) + (#not-any-of? @variable "yield" "outlet" "this" "else")) +; As are arguments in a block statement +(block_statement_start argument: [ + (path_expression (identifier) @variable) + (identifier) @variable + ]) +; As is an identifier in a block param +(block_params (identifier) @variable) +; As are helper arguments +((helper_invocation argument: [ + (path_expression (identifier) @variable) + (identifier) @variable + ]) + (#not-eq? @variable "this")) +; `this` should be highlighted as a built-in variable +((identifier) @variable.builtin + (#eq? @variable.builtin "this")) + +; If the identifier is just "yield" or "outlet", it's a keyword +((mustache_statement (identifier) @keyword) + (#any-of? @keyword "yield" "outlet")) + +; Helpers are functions +((helper_invocation helper: [ + (path_expression (identifier) @function) + (identifier) @function + ]) + (#not-any-of? @function "if" "yield")) +((helper_invocation helper: (identifier) @conditional) + (#eq? @conditional "if")) +((helper_invocation helper: (identifier) @keyword) + (#eq? @keyword "yield")) + +(hash_pair key: (identifier) @property) + +(comment_statement) @comment @spell + +(attribute_node "=" @operator) + +(block_params "as" @keyword) +(block_params "|" @operator) + +[ + "<" + ">" + "" +] @tag.delimiter diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/glimmer/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/glimmer/indents.scm new file mode 100644 index 00000000..8bccf33f --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/glimmer/indents.scm @@ -0,0 +1,22 @@ +[ + (element_node (element_node_start)) + (element_node_void) + (block_statement (block_statement_start)) + (mustache_statement) +] @indent.begin + +(element_node (element_node_end [">"] @indent.end)) +(element_node_void "/>" @indent.end) +[ + ">" + "/>" + "" + ">=" + "==" + "!=" + "&&" + "||" +] @operator + +; Variables + +(identifier) @variable + +; Functions + +(call_expression function: (identifier) @function.call) + +; Fields + +(scope_access field: (identifier) @field) + +; Literals + +(string) @string + +(escape_sequence) @string.escape + +(expansion) @none + +(integer) @number + +(hex) @string.special + +(boolean) @boolean + +; Punctuation + +[ "{" "}" "[" "]" "(" ")" ] @punctuation.bracket + +[ + "." + "," +] @punctuation.delimiter + +(expansion ["$" "${" "}"] @punctuation.special) + +; Comments + +(comment) @comment diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gn/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gn/indents.scm new file mode 100644 index 00000000..82f44711 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gn/indents.scm @@ -0,0 +1,12 @@ +[ + (block) + (parenthesized_expression) +] @indent.begin + +[ + "}" + ")" + "]" +] @indent.end @indent.branch + +(comment) @indent.auto diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gn/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gn/injections.scm new file mode 100644 index 00000000..2f0e58eb --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gn/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gn/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gn/locals.scm new file mode 100644 index 00000000..1350a231 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gn/locals.scm @@ -0,0 +1,6 @@ +[ + (source_file) + (block) +] @scope + +(identifier) @reference diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/go/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/go/folds.scm new file mode 100644 index 00000000..2c0beb4f --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/go/folds.scm @@ -0,0 +1,20 @@ +[ + (const_declaration) + (expression_switch_statement) + (expression_case) + (default_case) + (type_switch_statement) + (type_case) + (for_statement) + (func_literal) + (function_declaration) + (if_statement) + (import_declaration) + (method_declaration) + (type_declaration) + (var_declaration) + (composite_literal) + (literal_element) + (block) +] @fold + diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/go/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/go/highlights.scm new file mode 100644 index 00000000..65c00ea2 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/go/highlights.scm @@ -0,0 +1,251 @@ +;; Forked from tree-sitter-go +;; Copyright (c) 2014 Max Brunsfeld (The MIT License) + +;; +; Identifiers + +(type_identifier) @type +(type_spec name: (type_identifier) @type.definition) +(field_identifier) @property +(identifier) @variable +(package_identifier) @namespace + +(parameter_declaration (identifier) @parameter) +(variadic_parameter_declaration (identifier) @parameter) + +(label_name) @label + +(const_spec + name: (identifier) @constant) + +; Function calls + +(call_expression + function: (identifier) @function.call) + +(call_expression + function: (selector_expression + field: (field_identifier) @method.call)) + +; Function definitions + +(function_declaration + name: (identifier) @function) + +(method_declaration + name: (field_identifier) @method) + +(method_spec + name: (field_identifier) @method) + +; Constructors + +((call_expression (identifier) @constructor) + (#lua-match? @constructor "^[nN]ew.+$")) + +((call_expression (identifier) @constructor) + (#lua-match? @constructor "^[mM]ake.+$")) + +; Operators + +[ + "--" + "-" + "-=" + ":=" + "!" + "!=" + "..." + "*" + "*" + "*=" + "/" + "/=" + "&" + "&&" + "&=" + "&^" + "&^=" + "%" + "%=" + "^" + "^=" + "+" + "++" + "+=" + "<-" + "<" + "<<" + "<<=" + "<=" + "=" + "==" + ">" + ">=" + ">>" + ">>=" + "|" + "|=" + "||" + "~" +] @operator + +; Keywords + +[ + "break" + "const" + "continue" + "default" + "defer" + "goto" + "interface" + "range" + "select" + "struct" + "type" + "var" + "fallthrough" +] @keyword + +"func" @keyword.function +"return" @keyword.return +"go" @keyword.coroutine + +"for" @repeat + +[ + "import" + "package" +] @include + +[ + "else" + "case" + "switch" + "if" + ] @conditional + + +;; Builtin types + +[ "chan" "map" ] @type.builtin + +((type_identifier) @type.builtin + (#any-of? @type.builtin + "any" + "bool" + "byte" + "comparable" + "complex128" + "complex64" + "error" + "float32" + "float64" + "int" + "int16" + "int32" + "int64" + "int8" + "rune" + "string" + "uint" + "uint16" + "uint32" + "uint64" + "uint8" + "uintptr")) + + +;; Builtin functions + +((identifier) @function.builtin + (#any-of? @function.builtin + "append" + "cap" + "clear" + "close" + "complex" + "copy" + "delete" + "imag" + "len" + "make" + "max" + "min" + "new" + "panic" + "print" + "println" + "real" + "recover")) + + +; Delimiters + +"." @punctuation.delimiter +"," @punctuation.delimiter +":" @punctuation.delimiter +";" @punctuation.delimiter + +"(" @punctuation.bracket +")" @punctuation.bracket +"{" @punctuation.bracket +"}" @punctuation.bracket +"[" @punctuation.bracket +"]" @punctuation.bracket + + +; Literals + +(interpreted_string_literal) @string +(raw_string_literal) @string +(rune_literal) @string +(escape_sequence) @string.escape + +(int_literal) @number +(float_literal) @float +(imaginary_literal) @number + +[ + (true) + (false) +] @boolean + +[ + (nil) + (iota) +] @constant.builtin + +(keyed_element + . (literal_element (identifier) @field)) +(field_declaration name: (field_identifier) @field) + +; Comments + +(comment) @comment @spell + +;; Doc Comments + +(source_file . (comment)+ @comment.documentation) + +(source_file + (comment)+ @comment.documentation + . (const_declaration)) + +(source_file + (comment)+ @comment.documentation + . (function_declaration)) + +(source_file + (comment)+ @comment.documentation + . (type_declaration)) + +(source_file + (comment)+ @comment.documentation + . (var_declaration)) + +; Spell + +((interpreted_string_literal) @spell + (#not-has-parent? @spell import_spec)) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/go/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/go/indents.scm new file mode 100644 index 00000000..5f0039ac --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/go/indents.scm @@ -0,0 +1,33 @@ +[ + (import_declaration) + (const_declaration) + (var_declaration) + (type_declaration) + (func_literal) + (literal_value) + (expression_case) + (communication_case) + (type_case) + (default_case) + (block) + (call_expression) + (parameter_list) + (struct_type) +] @indent.begin + +[ + "}" +] @indent.branch + +(const_declaration ")" @indent.branch) +(import_spec_list ")" @indent.branch) +(var_declaration ")" @indent.branch) + +[ + "}" + ")" +] @indent.end + +(parameter_list ")" @indent.branch) + +(comment) @indent.ignore diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/go/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/go/injections.scm new file mode 100644 index 00000000..affc7a11 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/go/injections.scm @@ -0,0 +1,24 @@ +((comment) @injection.content + (#set! injection.language "comment")) + +(call_expression + (selector_expression) @_function (#any-of? @_function + "regexp.Match" + "regexp.MatchReader" + "regexp.MatchString" + "regexp.Compile" + "regexp.CompilePOSIX" + "regexp.MustCompile" + "regexp.MustCompilePOSIX") + (argument_list + . + [ + (raw_string_literal) + (interpreted_string_literal) + ] @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "regex"))) + +((comment) @injection.content + (#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c") + (#set! injection.language "re2c")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/go/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/go/locals.scm new file mode 100644 index 00000000..b027c217 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/go/locals.scm @@ -0,0 +1,79 @@ +( + (function_declaration + name: (identifier) @definition.function) ;@function +) + +( + (method_declaration + name: (field_identifier) @definition.method); @method +) + +(short_var_declaration + left: (expression_list + (identifier) @definition.var)) + +(var_spec + name: (identifier) @definition.var) + +(parameter_declaration (identifier) @definition.var) +(variadic_parameter_declaration (identifier) @definition.var) + +(for_statement + (range_clause + left: (expression_list + (identifier) @definition.var))) + +(const_declaration + (const_spec + name: (identifier) @definition.var)) + +(type_declaration + (type_spec + name: (type_identifier) @definition.type)) + +;; reference +(identifier) @reference +(type_identifier) @reference +(field_identifier) @reference +((package_identifier) @reference + (#set! reference.kind "namespace")) + +(package_clause + (package_identifier) @definition.namespace) + +(import_spec_list + (import_spec + name: (package_identifier) @definition.namespace)) + +;; Call references +((call_expression + function: (identifier) @reference) + (#set! reference.kind "call" )) + +((call_expression + function: (selector_expression + field: (field_identifier) @reference)) + (#set! reference.kind "call" )) + + +((call_expression + function: (parenthesized_expression + (identifier) @reference)) + (#set! reference.kind "call" )) + +((call_expression + function: (parenthesized_expression + (selector_expression + field: (field_identifier) @reference))) + (#set! reference.kind "call" )) + +;; Scopes + +(func_literal) @scope +(source_file) @scope +(function_declaration) @scope +(if_statement) @scope +(block) @scope +(expression_switch_statement) @scope +(for_statement) @scope +(method_declaration) @scope diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/godot_resource/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/godot_resource/folds.scm new file mode 100644 index 00000000..943e0628 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/godot_resource/folds.scm @@ -0,0 +1,3 @@ +[ + (section) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/godot_resource/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/godot_resource/highlights.scm new file mode 100644 index 00000000..848fbbe1 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/godot_resource/highlights.scm @@ -0,0 +1,26 @@ +(identifier) @type.builtin + +(attribute (identifier) @property) +(property (path) @property) +(constructor (identifier) @constructor) + +(string) @string +(integer) @number +(float) @float + +(true) @constant.builtin +(false) @constant.builtin + +[ + "[" + "]" +] @tag.delimiter + +[ + "(" + ")" + "{" + "}" +] @punctuation.bracket + +"=" @operator diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/godot_resource/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/godot_resource/locals.scm new file mode 100644 index 00000000..1dce04f0 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/godot_resource/locals.scm @@ -0,0 +1,3 @@ +[ + (section) +] @scope diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gomod/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gomod/highlights.scm new file mode 100644 index 00000000..76a2a452 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gomod/highlights.scm @@ -0,0 +1,19 @@ +[ + "require" + "replace" + "go" + "toolchain" + "exclude" + "retract" + "module" +] @keyword + +"=>" @operator + +(comment) @comment @spell +(module_path) @text.uri + +[ +(version) +(go_version) +] @string diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gomod/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gomod/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gomod/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gosum/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gosum/highlights.scm new file mode 100644 index 00000000..bb65bd71 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gosum/highlights.scm @@ -0,0 +1,31 @@ +[ + "alpha" + "beta" + "dev" + "pre" + "rc" + "+incompatible" +] @keyword + + +(module_path) @string @text.uri +(module_version) @string.special + +(hash_version) @attribute +(hash) @symbol + +[ + (number) + (number_with_decimal) + (hex_number) +] @number + +(checksum + "go.mod" @string) + +[ + ":" + "." + "-" + "/" +] @punctuation.delimiter diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gowork/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gowork/highlights.scm new file mode 100644 index 00000000..0584f1a6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gowork/highlights.scm @@ -0,0 +1,14 @@ +[ + "replace" + "go" + "use" +] @keyword + +"=>" @operator + +(comment) @comment @spell + +[ +(version) +(go_version) +] @string diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gowork/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gowork/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gowork/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gpg/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gpg/highlights.scm new file mode 100644 index 00000000..fb70ba13 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gpg/highlights.scm @@ -0,0 +1,47 @@ +(option . _ @keyword) + +(option + ("no-" @parameter)? + (name) @parameter) + +(string (content) @string) + +[ + (value) + "clear" +] @string.special + +(url) @text.uri + +(key) @constant + +[ + (number) + (expire_time) + (iso_time) +] @number + +(format) @character.special + +"sensitive:" @type.qualifier + +(filter_name) @parameter + +(filter_scope) @namespace + +(filter_property) @property + +(filter_value) @string + +[ + (filter_op0) + (filter_op1) + (filter_lc) + "=" +] @operator + +"!" @punctuation.special + +[ "\"" "'" "," ] @punctuation.delimiter + +(comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gpg/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gpg/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gpg/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/graphql/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/graphql/highlights.scm new file mode 100644 index 00000000..48f27f98 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/graphql/highlights.scm @@ -0,0 +1,165 @@ +; Types +;------ + +(scalar_type_definition + (name) @type) + +(object_type_definition + (name) @type) + +(interface_type_definition + (name) @type) + +(union_type_definition + (name) @type) + +(enum_type_definition + (name) @type) + +(input_object_type_definition + (name) @type) + +(scalar_type_extension + (name) @type) + +(object_type_extension + (name) @type) + +(interface_type_extension + (name) @type) + +(union_type_extension + (name) @type) + +(enum_type_extension + (name) @type) + +(input_object_type_extension + (name) @type) + +(named_type + (name) @type) + +; Directives +;----------- + +(directive_definition + "@" @attribute + (name) @attribute) + +(directive) @attribute + +; Properties +;----------- + +(field + (name) @property) + +(field + (alias + (name) @property)) + +(field_definition + (name) @property) + +(object_value + (object_field + (name) @property)) + +(enum_value + (name) @property) + +; Variable Definitions and Arguments +;----------------------------------- + +(operation_definition + (name) @variable) + +(fragment_name + (name) @variable) + +(input_fields_definition + (input_value_definition + (name) @parameter)) + +(argument + (name) @parameter) + +(arguments_definition + (input_value_definition + (name) @parameter)) + +(variable_definition + (variable) @parameter) + +(argument + (value + (variable) @variable)) + +; Constants +;---------- + +(string_value) @string + +(int_value) @number + +(float_value) @float + +(boolean_value) @boolean + +; Literals +;--------- + +(description + (string_value) @string.documentation @spell) + +(comment) @comment @spell + +(directive_location + (executable_directive_location) @type.builtin) + +(directive_location + (type_system_directive_location) @type.builtin) + +; Keywords +;---------- + +[ + "query" + "mutation" + "subscription" + "fragment" + "scalar" + "type" + "interface" + "union" + "enum" + "input" + "extend" + "directive" + "schema" + "on" + "repeatable" + "implements" +] @keyword + +; Punctuation +;------------ + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +"=" @operator + +"|" @punctuation.delimiter +"&" @punctuation.delimiter +":" @punctuation.delimiter + +"..." @punctuation.special +"!" @punctuation.special diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/graphql/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/graphql/indents.scm new file mode 100644 index 00000000..df47aff8 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/graphql/indents.scm @@ -0,0 +1,9 @@ +[ + (definition) + (selection) +] @indent.begin + +[ + "{" + "}" +] @indent.branch diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/graphql/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/graphql/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/graphql/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/groovy/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/groovy/highlights.scm new file mode 100644 index 00000000..a9b38ef5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/groovy/highlights.scm @@ -0,0 +1,95 @@ +(unit + (identifier) @variable) +(string + (identifier) @variable) + +(escape_sequence) @string.escape + +(block + (unit + (identifier) @namespace)) + +(func + (identifier) @function) + +(number) @number + +((identifier) @boolean + (#any-of? @boolean "true" "false" "True" "False")) + +((identifier) @constant + (#lua-match? @constant "^[A-Z][A-Z%d_]*$")) + +((identifier) @constant.builtin + (#eq? @constant.builtin "null")) + +((identifier) @type + (#any-of? @type + "String" + "Map" + "Object" + "Boolean" + "Integer" + "List")) + +((identifier) @function.builtin + (#any-of? @function.builtin + "void" + "id" + "version" + "apply" + "implementation" + "testImplementation" + "androidTestImplementation" + "debugImplementation")) + +((identifier) @keyword + (#any-of? @keyword + "static" + "class" + "def" + "import" + "package" + "assert" + "extends" + "implements" + "instanceof" + "interface" + "new")) + +((identifier) @type.qualifier + (#any-of? @type.qualifier + "abstract" + "protected" + "private" + "public")) + +((identifier) @exception + (#any-of? @exception + "throw" + "finally" + "try" + "catch")) + +(string) @string + +[ + (line_comment) + (block_comment) +] @comment @spell + +((block_comment) @comment.documentation + (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$")) + +((line_comment) @comment.documentation + (#lua-match? @comment.documentation "^///[^/]")) + +((line_comment) @comment.documentation + (#lua-match? @comment.documentation "^///$")) + +[ + (operators) + (leading_key) +] @operator + +["(" ")" "[" "]" "{" "}"] @punctuation.bracket diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/groovy/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/groovy/injections.scm new file mode 100644 index 00000000..0f3127b6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/groovy/injections.scm @@ -0,0 +1,5 @@ +((line_comment) @injection.content + (#set! injection.language "comment")) + +((block_comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gstlaunch/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gstlaunch/highlights.scm new file mode 100644 index 00000000..8fc8d219 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/gstlaunch/highlights.scm @@ -0,0 +1,30 @@ +[ + "!" + "=" +] @operator + +[ + "," + "." + ";" + "/" +] @punctuation.delimiter + +[ + "(" + ")" +] @punctuation.bracket + +(property + key: (identifier) @field) +(value) @string +(string_literal) @string +(cap + . + (identifier) @string + . + (identifier) @string) +(simple_element + type: (_) @type) +(bin + type: (_) @type) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hack/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hack/highlights.scm new file mode 100644 index 00000000..efe5631a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hack/highlights.scm @@ -0,0 +1,315 @@ +(variable) @variable +(identifier) @variable +((variable) @variable.builtin + (#eq? @variable.builtin "$this")) + +(braced_expression) @none + +(scoped_identifier + (qualified_identifier + (identifier) @type)) + +[ + (comment) + (heredoc) +] @comment @spell + +((comment) @comment.documentation + (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$")) + +"function" @keyword.function + +[ + "type" + "interface" + "implements" + "class" + "using" + "namespace" + "attribute" + "const" + "extends" + "insteadof" +] @keyword + +[ + "async" + "await" +] @keyword.coroutine + +[ + "use" + "include" + "include_once" + "require" + "require_once" +] @include + +[ + "new" + "print" + "echo" + "newtype" + "clone" + "as" +] @keyword.operator + +"return" @keyword.return + +[ + (abstract_modifier) + (final_modifier) + (static_modifier) + (visibility_modifier) + (xhp_modifier) +] @type.qualifier + +[ + "shape" + "tuple" + (array_type) + "bool" + "float" + "int" + "string" + "arraykey" + "void" + "nonnull" + "mixed" + "dynamic" + "noreturn" +] @type.builtin + +[ + (null) +] @constant.builtin + +[ + (true) + (false) +] @boolean + +(type_specifier) @type +(new_expression + (_) @type) + +(alias_declaration "newtype" . (_) @type) +(alias_declaration "type" . (_) @type) + +(class_declaration + name: (identifier) @type) +(type_parameter + name: (identifier) @type) + +(collection + (qualified_identifier + (identifier) @type .)) + +[ + "@required" + "@lateinit" + (attribute_modifier) +] @attribute + +[ + "=" + "??=" + ".=" + "|=" + "^=" + "&=" + "<<=" + ">>=" + "+=" + "-=" + "*=" + "/=" + "%=" + "**=" + + "==>" + "|>" + "??" + "||" + "&&" + "|" + "^" + "&" + "==" + "!=" + "===" + "!==" + "<" + ">" + "<=" + ">=" + "<=>" + "<<" + ">>" + "->" + "+" + "-" + "." + "*" + "/" + "%" + "**" + + "++" + "--" + "!" + + "?:" + + "=" + "??=" + ".=" + "|=" + "^=" + "&=" + "<<=" + ">>=" + "+=" + "-=" + "*=" + "/=" + "%=" + "**=" + "=>" + + ;; type modifiers + "@" + "?" + "~" +] @operator + +(integer) @number +(float) @float + +(parameter + (variable) @parameter) + +(call_expression + function: (qualified_identifier (identifier) @function.call .)) + +(call_expression + function: (scoped_identifier (identifier) @function.call .)) + +(call_expression + function: (selection_expression + (qualified_identifier (identifier) @method.call .))) + +(qualified_identifier + (_) @namespace . + (_)) + +(use_statement + (qualified_identifier + (_) @namespace .) + (use_clause)) + +(use_statement + (use_type "namespace") + (use_clause + (qualified_identifier + (identifier) @namespace .) + alias: (identifier)? @namespace)) + +(use_statement + (use_type "const") + (use_clause + (qualified_identifier + (identifier) @constant .) + alias: (identifier)? @constant)) + +(use_statement + (use_type "function") + (use_clause + (qualified_identifier + (identifier) @function .) + alias: (identifier)? @function)) + +(use_statement + (use_type "type") + (use_clause + (qualified_identifier + (identifier) @type .) + alias: (identifier)? @type)) + +(use_clause + (use_type "namespace") + (qualified_identifier + (_) @namespace .) + alias: (identifier)? @namespace) + +(use_clause + (use_type "function") + (qualified_identifier + (_) @function .) + alias: (identifier)? @function) + +(use_clause + (use_type "const") + (qualified_identifier + (_) @constant .) + alias: (identifier)? @constant) + +(use_clause + (use_type "type") + (qualified_identifier + (_) @type .) + alias: (identifier)? @type) + +(function_declaration + name: (identifier) @function) +(method_declaration + name: (identifier) @method) + +(type_arguments + [ "<" ">" ] @punctuation.bracket) +[ "(" ")" "[" "]" "{" "}" "<<" ">>"] @punctuation.bracket + +(xhp_open + [ "<" ">" ] @tag.delimiter) +(xhp_close + [ "" ] @tag.delimiter) + +[ "." ";" "::" ":" "," ] @punctuation.delimiter +(qualified_identifier + "\\" @punctuation.delimiter) + +(ternary_expression + ["?" ":"] @conditional.ternary) + +[ + "if" + "else" + "elseif" + "switch" + "case" +] @conditional + +[ + "try" + "catch" + "finally" +] @exception + +[ + "for" + "while" + "foreach" + "do" + "continue" + "break" +] @repeat + +[ + (string) + (xhp_string) +] @string + +[ + (xhp_open) + (xhp_close) +] @tag diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hare/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hare/folds.scm new file mode 100644 index 00000000..28f18b17 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hare/folds.scm @@ -0,0 +1,21 @@ +[ + (imports) + + (function_declaration) + (enum_type) + (struct_type) + (tuple_type) + (union_type) + + (block) + (if_statement) + (for_statement) + (call_expression) + (switch_expression) + (match_expression) + (case) + + (array_literal) + (struct_literal) + (tuple_literal) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hare/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hare/highlights.scm new file mode 100644 index 00000000..f331da91 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hare/highlights.scm @@ -0,0 +1,251 @@ +; Variables + +(identifier) @variable + +; Types + +(type) @type + +(scoped_type_identifier + (identifier) . (identifier) @type) + +(struct_literal + . (identifier) @type) + +(builtin_type) @type.builtin + +; Constants + +((identifier) @constant + (#lua-match? @constant "^[A-Z_]+$")) + +; Includes + +[ + "use" +] @include + +(use_statement + (scoped_type_identifier + (identifier) @namespace)) +(use_statement + (identifier) @namespace "{") +(use_statement + . (identifier) @namespace .) + +((scoped_type_identifier + path: (_) @namespace) + (#set! "priority" 105)) + +; Keywords + +[ + "def" + "enum" + "export" + "let" + "struct" + "type" + "union" +] @keyword + +[ + "fn" +] @keyword.function + +[ + "defer" + "yield" + "return" +] @keyword.return + +[ + "as" + "is" +] @keyword.operator + +; Typedefs + +(type_declaration + "type" (identifier) @type.definition . "=") + +; Qualifiers + +[ + "const" + "static" + "nullable" +] @type.qualifier + +; Attributes + +[ + "@fini" + "@init" + "@test" + "@noreturn" + "@packed" + (declaration_attribute) +] @attribute + +; Labels + +((label) @label + (#set! "priority" 105)) + +; Functions + +(function_declaration + "fn" . (identifier) @function) + +(call_expression + . (identifier) @function.call) + +(call_expression + . (scoped_type_identifier + . (identifier) . "::" . (identifier) @method.call)) + +((call_expression + . (identifier) @function.builtin) + (#any-of? @function.builtin "align" "assert" "free" "len" "offset" "size")) + +(size_expression + "size" @function.builtin) + +((function_declaration + "fn" . (identifier) @constructor) + (#eq? @constructor "init")) + +((call_expression + . (identifier) @constructor) + (#eq? @constructor "init")) + +; Parameters + +(parameter + (_) @parameter . ":") + +; Fields + +((member_expression + "." (_) @field) + (#set! "priority" 105)) + +(field + . (identifier) @field) + +(field_assignment + . (identifier) @field) + +; Repeats + +[ + "for" +] @repeat + +; Conditionals + +[ + "if" + "else" + "break" + "switch" + "match" + "case" +] @conditional + +; Operators + +[ + "+" + "-" + "*" + "/" + "%" + "||" + "&&" + "^^" + "|" + "&" + "^" + "==" + "!=" + ">" + ">=" + "<=" + "<" + "<<" + ">>" + "~" + "!" + "+=" + "-=" + "*=" + "/=" + "%=" + "<<=" + ">>=" + "|=" + "&=" + "^=" + "||=" + "&&=" + "^^=" + "=" + "?" +] @operator + +; Punctuation + +[ "{" "}" ] @punctuation.bracket + +[ "[" "]" ] @punctuation.bracket + +[ "(" ")" ] @punctuation.bracket + +[ + ".." + "..." + "_" +] @punctuation.special + +(pointer_type "*" @punctuation.special) + +(slice_type "*" @punctuation.special) + +(error_type "!" @punctuation.special) + +[ + "," + "." + ":" + ";" + "::" + "=>" +] @punctuation.delimiter + +; Literals + +[ + (string) + (raw_string) +] @string + +(rune) @character + +(escape_sequence) @string.escape + +(number) @number + +(float) @float + +(boolean) @boolean + +[ + (void) + (null) +] @constant.builtin + +; Comments + +(comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hare/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hare/indents.scm new file mode 100644 index 00000000..b3aadcd6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hare/indents.scm @@ -0,0 +1,36 @@ +[ + (enum_type) + (struct_type) + (tuple_type) + (union_type) + + (block) + (for_statement) + (call_expression) + (case) + + (array_literal) + (struct_literal) + (tuple_literal) +] @indent.begin + +(if_statement + ("(" condition: (_) ")") @indent.begin) + +[ + "}" + "]" + ")" +] @indent.end + +[ "{" "}" ] @indent.branch + +[ "[" "]" ] @indent.branch + +[ "(" ")" ] @indent.branch + +[ + (ERROR) + (comment) + (concatenated_string) +] @indent.auto diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hare/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hare/injections.scm new file mode 100644 index 00000000..d3befb39 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hare/injections.scm @@ -0,0 +1,10 @@ +((comment) @injection.content + (#set! injection.language "comment")) + +((call_expression + . (_) @_fnname + . "(" + . (_ [(string_content) (raw_string_content)] @injection.content) + . ")") + (#any-of? @_fnname "compile" "regex::compile") + (#set! injection.language "regex")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hare/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hare/locals.scm new file mode 100644 index 00000000..62eb6665 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hare/locals.scm @@ -0,0 +1,47 @@ +; Scopes + +[ + (module) + (function_declaration) + (if_statement) + (for_statement) + (match_expression) + (switch_expression) +] @scope + +; References + +[ + (identifier) + (scoped_type_identifier) +] @reference + +; Definitions + +(global_binding + (identifier) @definition.constant . ":" (_)) + +(const_declaration + "const" (identifier) @definition.constant . "=") + +(field + . (identifier) @definition.field) + +(field_assignment + . (identifier) @definition.field) + +(function_declaration + "fn" . (identifier) @definition.function) + +(parameter + (_) @definition.parameter . ":") + +(type_declaration + "type" (identifier) @definition.type . "=") + +(type_declaration + "type" (identifier) @definition.enum . "=" (enum_type)) + +(let_declaration + "let" . (identifier) @definition.variable ","?) + diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/haskell/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/haskell/folds.scm new file mode 100644 index 00000000..28eadf8f --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/haskell/folds.scm @@ -0,0 +1,5 @@ +[ + (exp_apply) + (exp_do) + (function) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/haskell/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/haskell/highlights.scm new file mode 100644 index 00000000..2c2189c3 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/haskell/highlights.scm @@ -0,0 +1,466 @@ +;; ---------------------------------------------------------------------------- +;; Parameters and variables + +;; NOTE: These are at the top, so that they have low priority, +;; and don't override destructured parameters + +(variable) @variable +(pat_wildcard) @variable + +(function + patterns: (patterns (_) @parameter)) + +(exp_lambda (_)+ @parameter "->") + +(function + infix: (infix + lhs: (_) @parameter)) +(function + infix: (infix + rhs: (_) @parameter)) + +;; ---------------------------------------------------------------------------- +;; Literals and comments + +(integer) @number +(exp_negation) @number +(exp_literal (float)) @float +(char) @character +(string) @string + +(con_unit) @symbol ; unit, as in () + +(comment) @comment + +; FIXME: The below documentation comment queries are inefficient +; and need to be anchored, using something like +; ((comment) @_first . (comment)+ @comment.documentation) +; once https://github.com/neovim/neovim/pull/24738 has been merged. +; +; ((comment) @comment.documentation +; (#lua-match? @comment.documentation "^-- |")) +; +; ((comment) @_first @comment.documentation +; (comment) @comment.documentation +; (#lua-match? @_first "^-- |")) +; +; ((comment) @comment.documentation +; (#lua-match? @comment.documentation "^-- %^")) +; +; ((comment) @_first @comment.documentation +; (comment) @comment.documentation +; (#lua-match? @_first "^-- %^")) +; +; ((comment) @comment.documentation +; (#lua-match? @comment.documentation "^{-")) +; +; ((comment) @_first @comment.documentation +; (comment) @comment.documentation +; (#lua-match? @_first "^{-")) + +;; ---------------------------------------------------------------------------- +;; Punctuation + +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket + +[ + (comma) + ";" +] @punctuation.delimiter + + +;; ---------------------------------------------------------------------------- +;; Keywords, operators, includes + +[ + "forall" + "∀" +] @repeat + +(pragma) @preproc + +[ + "if" + "then" + "else" + "case" + "of" +] @conditional + +[ + "import" + "qualified" + "module" +] @include + +[ + (operator) + (constructor_operator) + (type_operator) + (tycon_arrow) + (qualified_module) ; grabs the `.` (dot), ex: import System.IO + (qualified_type) + (qualified_variable) + (all_names) + (wildcard) + "." + ".." + "=" + "|" + "::" + "=>" + "->" + "<-" + "\\" + "`" + "@" +] @operator + + +(module) @namespace +((qualified_module (module) @constructor) + . (module)) +(qualified_type (module) @namespace) +(qualified_variable (module) @namespace) +(import (module) @namespace) +(import (module) @constructor . (module)) + +[ + (where) + "let" + "in" + "class" + "instance" + "pattern" + "data" + "newtype" + "family" + "type" + "as" + "hiding" + "deriving" + "via" + "stock" + "anyclass" + "do" + "mdo" + "rec" + "infix" + "infixl" + "infixr" +] @keyword + + +;; ---------------------------------------------------------------------------- +;; Functions and variables + +(signature name: (variable) @function) + +(function name: (variable) @function) + +(function + name: (variable) @variable + rhs: [ + (exp_literal) + (exp_apply + (exp_name + [(constructor) + (variable) + (qualified_variable) + ])) + (quasiquote) + ((exp_name) . (operator)) + ]) + +(function + name: (variable) @variable + rhs: (exp_infix [ + (exp_literal) + (exp_apply + (exp_name + [(constructor) + (variable) + (qualified_variable) + ])) + (quasiquote) + ((exp_name) . (operator)) + ])) + +;; Consider signatures (and accompanying functions) +;; with only one value on the rhs as variables +(signature . (variable) @variable . (_) . ) +((signature . (variable) @_name . (_) . ) + . (function name: (variable) @variable) + (#eq? @_name @variable)) +;; but consider a type that involves 'IO' a function +(signature name: (variable) @function + . (type_apply (type_name) @_type) + (#eq? @_type "IO")) +((signature name: (variable) @_name + . (type_apply (type_name) @_type) + (#eq? @_type "IO")) + . (function name: (variable) @function) + (#eq? @_name @function)) + +;; functions with parameters +;; + accompanying signatures +(function + name: (variable) @function + patterns: (patterns)) +((signature) @function + . (function + name: (variable) @function + patterns: (patterns))) +(function + name: (variable) @function + rhs: (exp_lambda)) + +; view patterns +(pat_view (exp_name [ + ((variable) @function.call) + (qualified_variable (variable) @function.call) +])) + +; consider infix functions as operators +(exp_infix [ + (variable) @operator + (qualified_variable (variable) @operator) +]) +; partially applied infix functions (sections) also get highlighted as operators +(exp_section_right [ + ((variable) @operator) + (qualified_variable (variable) @operator) +]) +(exp_section_left [ + ((variable) @operator) + (qualified_variable (variable) @operator) +]) + +; function calls with an infix operator +; e.g. func <$> a <*> b +(exp_infix + (exp_name + [ + ((variable) @function.call) + (qualified_variable ( + (module) @namespace + (variable) @function.call)) + ]) + . (operator)) +; infix operators applied to variables +((exp_name (variable) @variable) . (operator)) +((operator) . (exp_name [ + ((variable) @variable) + (qualified_variable (variable) @variable) +])) +; function calls with infix operators +((exp_name [ + ((variable) @function.call) + (qualified_variable (variable) @function.call) + ]) . (operator) @_op + (#any-of? @_op "$" "<$>" ">>=" "=<<")) +; right hand side of infix operator +((exp_infix + [(operator)(variable)] ; infix or `func` + . (exp_name [ + ((variable) @function.call) + (qualified_variable (variable) @function.call) + ])) . (operator) @_op + (#any-of? @_op "$" "<$>" "=<<")) +; function composition, arrows, monadic composition (lhs) +((exp_name [ + ((variable) @function) + (qualified_variable (variable) @function) + ]) . (operator) @_op + (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) +; right hand side of infix operator +((exp_infix + [(operator)(variable)] ; infix or `func` + . (exp_name [ + ((variable) @function) + (qualified_variable (variable) @function) + ])) . (operator) @_op + (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) +; function composition, arrows, monadic composition (rhs) +((operator) @_op . (exp_name [ + ((variable) @function) + (qualified_variable (variable) @function) + ]) + (#any-of? @_op "." ">>>" "***" ">=>" "<=<" )) + +; function defined in terms of a function composition +(function + name: (variable) @function + rhs: (exp_infix (_) . (operator) @_op . (_) + (#any-of? @_op "." ">>>" "***" ">=>" "<=<"))) + +(exp_apply (exp_name + [ + ((variable) @function.call) + (qualified_variable (variable) @function.call) + ])) + +; function compositions, in parentheses, applied +; lhs +(exp_apply + . (exp_parens (exp_infix + (exp_name [((variable) @function.call) (qualified_variable (variable) @function.call)]) + . (operator)))) +; rhs +(exp_apply + . (exp_parens (exp_infix + (operator) + . (exp_name [((variable) @function.call) (qualified_variable (variable) @function.call)]))) + ) + +;; variables being passed to a function call +(exp_apply (_)+ + . (exp_name [ + ((variable) @variable) + (qualified_variable (variable) @variable) + ])) + +;; Consider functions with only one value on the rhs +;; as variables, e.g. x = Rec {} or x = foo +(function + . (variable) @variable + . [ + (exp_record) + (exp_name [(variable) (qualified_variable)]) + (exp_list) + (exp_tuple) + (exp_cond) + ] . ) + +;; main is always a function +;; (this prevents `main = undefined` from being highlighted as a variable) +(function name: (variable) @function (#eq? @function "main")) + +;; scoped function types (func :: a -> b) +(pat_typed + pattern: (pat_name (variable) @function) + type: (fun)) + +;; signatures that have a function type +;; + functions that follow them +((signature (variable) @function (fun))) +((signature (variable) @_type (fun)) . (function (variable) @function) (#eq? @function @_type)) +((signature (variable) @function (context (fun)))) +((signature (variable) @_type (context (fun))) . (function (variable) @function) (#eq? @function @_type)) +((signature (variable) @function (forall (context (fun)))) . (function (variable))) +((signature (variable) @_type (forall (context (fun)))) . (function (variable) @function) (#eq? @function @_type)) + +;; ---------------------------------------------------------------------------- +;; Types + +(type) @type +(type_star) @type +(type_variable) @type + +(constructor) @constructor + +; True or False +((constructor) @boolean (#any-of? @boolean "True" "False")) +; otherwise (= True) +((variable) @boolean + (#eq? @boolean "otherwise")) + +;; ---------------------------------------------------------------------------- +;; Quasi-quotes + +(quoter) @function.call + +(quasiquote + [ + (quoter) @_name + (_ (variable) @_name) + ](#eq? @_name "qq") + (quasiquote_body) @string) + +(quasiquote + ((_ (variable) @_name)) (#eq? @_name "qq") + (quasiquote_body) @string) + +;; namespaced quasi-quoter +(quasiquote + (_ + (module) @namespace + . (variable) @function.call + )) + +; Highlighting of quasiquote_body for other languages is handled by injections.scm + +;; ---------------------------------------------------------------------------- +;; Exceptions/error handling + +((variable) @exception + (#any-of? @exception + "error" + "undefined" + "try" + "tryJust" + "tryAny" + "catch" + "catches" + "catchJust" + "handle" + "handleJust" + "throw" + "throwIO" + "throwTo" + "throwError" + "ioError" + "mask" + "mask_" + "uninterruptibleMask" + "uninterruptibleMask_" + "bracket" + "bracket_" + "bracketOnErrorSource" + "finally" + "fail" + "onException" + "expectationFailure")) + +;; ---------------------------------------------------------------------------- +;; Debugging +((variable) @debug + (#any-of? @debug + "trace" + "traceId" + "traceShow" + "traceShowId" + "traceWith" + "traceShowWith" + "traceStack" + "traceIO" + "traceM" + "traceShowM" + "traceEvent" + "traceEventWith" + "traceEventIO" + "flushEventLog" + "traceMarker" + "traceMarkerIO")) + + +;; ---------------------------------------------------------------------------- +;; Fields +(field (variable) @field) +(pat_field (variable) @field) +(exp_projection field: (variable) @field) +(import_item (type) . (import_con_names (variable) @field)) +(exp_field field: [((variable) @field) (qualified_variable (variable) @field)]) + + +;; ---------------------------------------------------------------------------- +;; Spell checking + +(comment) @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/haskell/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/haskell/injections.scm new file mode 100644 index 00000000..bc70e012 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/haskell/injections.scm @@ -0,0 +1,85 @@ +;; ----------------------------------------------------------------------------- +;; General language injection + +(quasiquote + ((quoter) @injection.language) + ((quasiquote_body) @injection.content) +) + +((comment) @injection.content + (#set! injection.language "comment")) + +;; ----------------------------------------------------------------------------- +;; shakespeare library +;; NOTE: doesn't support templating + +; TODO: add once CoffeeScript parser is added +; ; CoffeeScript: Text.Coffee +; (quasiquote +; (quoter) @_name +; (#eq? @_name "coffee") +; ((quasiquote_body) @injection.content +; (#set! injection.language "coffeescript"))) + +; CSS: Text.Cassius, Text.Lucius +(quasiquote + (quoter) @_name + (#any-of? @_name "cassius" "lucius") + ((quasiquote_body) @injection.content) + (#set! injection.language "css")) + +; HTML: Text.Hamlet +(quasiquote + (quoter) @_name + (#any-of? @_name "shamlet" "xshamlet" "hamlet" "xhamlet" "ihamlet") + ((quasiquote_body) @injection.content) + (#set! injection.language "html")) + +; JS: Text.Julius +(quasiquote + (quoter) @_name + (#any-of? @_name "js" "julius") + ((quasiquote_body) @injection.content) + (#set! injection.language "javascript")) + +; TS: Text.TypeScript +(quasiquote + (quoter) @_name + (#any-of? @_name "tsc" "tscJSX") + ((quasiquote_body) @injection.content) + (#set! injection.language "typescript")) + + +;; ----------------------------------------------------------------------------- +;; HSX + +(quasiquote + (quoter) @_name + (#eq? @_name "hsx") + ((quasiquote_body) @injection.content) + (#set! injection.language "html")) + +;; ----------------------------------------------------------------------------- +;; Inline JSON from aeson + +(quasiquote + (quoter) @_name + (#eq? @_name "aesonQQ") + ((quasiquote_body) @injection.content) + (#set! injection.language "json")) + + +;; ----------------------------------------------------------------------------- +;; SQL + +; postgresql-simple +(quasiquote + (quoter) @injection.language + (#eq? @injection.language "sql") + ((quasiquote_body) @injection.content)) + +(quasiquote + (quoter) @_name + (#any-of? @_name "persistUpperCase" "persistLowerCase" "persistWith") + ((quasiquote_body) @injection.content) + (#set! injection.language "haskell_persistent")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/haskell_persistent/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/haskell_persistent/folds.scm new file mode 100644 index 00000000..2bdffd17 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/haskell_persistent/folds.scm @@ -0,0 +1,3 @@ +[ + (entity_definition) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/haskell_persistent/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/haskell_persistent/highlights.scm new file mode 100644 index 00000000..afb32f11 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/haskell_persistent/highlights.scm @@ -0,0 +1,38 @@ +;; ---------------------------------------------------------------------------- +;; Literals and comments + +(integer) @number +(float) @float +(char) @character +(string) @string +(attribute_name) @attribute +(attribute_exclamation_mark) @attribute + +(con_unit) @symbol ; unit, as in () + +(comment) @comment @spell + +;; ---------------------------------------------------------------------------- +;; Keywords, operators, includes + +[ + "Id" + "Primary" + "Foreign" + "deriving" +] @keyword + +"=" @operator + + +;; ---------------------------------------------------------------------------- +;; Functions and variables + +(variable) @variable + +;; ---------------------------------------------------------------------------- +;; Types + +(type) @type + +(constructor) @constructor diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hcl/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hcl/folds.scm new file mode 100644 index 00000000..cb20b2aa --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hcl/folds.scm @@ -0,0 +1,6 @@ +[ + (comment) + (block) + (heredoc_template) + (object) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hcl/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hcl/highlights.scm new file mode 100644 index 00000000..4cc822ab --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hcl/highlights.scm @@ -0,0 +1,97 @@ +; highlights.scm + +[ + "!" + "\*" + "/" + "%" + "\+" + "-" + ">" + ">=" + "<" + "<=" + "==" + "!=" + "&&" + "||" +] @operator + +[ + "{" + "}" + "[" + "]" + "(" + ")" +] @punctuation.bracket + +[ + "." + ".*" + "," + "[*]" +] @punctuation.delimiter + +[ + (ellipsis) + "\?" + "=>" +] @punctuation.special + +[ + ":" + "=" +] @none + +[ + "for" + "endfor" + "in" +] @repeat + +[ + "if" + "else" + "endif" +] @conditional + +[ + (quoted_template_start) ; " + (quoted_template_end); " + (template_literal) ; non-interpolation/directive content +] @string + +[ + (heredoc_identifier) ; END + (heredoc_start) ; << or <<- +] @punctuation.delimiter + +[ + (template_interpolation_start) ; ${ + (template_interpolation_end) ; } + (template_directive_start) ; %{ + (template_directive_end) ; } + (strip_marker) ; ~ +] @punctuation.special + +(numeric_lit) @number +(bool_lit) @boolean +(null_lit) @constant +(comment) @comment @spell +(identifier) @variable + +(body (block (identifier) @keyword)) +(body (block (body (block (identifier) @type)))) +(function_call (identifier) @function) +(attribute (identifier) @field) + +; { key: val } +; +; highlight identifier keys as though they were block attributes +(object_elem key: (expression (variable_expr (identifier) @field))) + +; var.foo, data.bar +; +; first element in get_attr is a variable.builtin or a reference to a variable.builtin +(expression (variable_expr (identifier) @variable.builtin) (get_attr (identifier) @field)) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hcl/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hcl/indents.scm new file mode 100644 index 00000000..93264de9 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hcl/indents.scm @@ -0,0 +1,15 @@ +[ + (block) + (object) + (tuple) + (function_call) +] @indent.begin + +[ + "]" + ")" + "}" +] @indent.branch @indent.end + +(comment) @indent.auto +(ERROR) @indent.auto diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hcl/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hcl/injections.scm new file mode 100644 index 00000000..fd881d50 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hcl/injections.scm @@ -0,0 +1,7 @@ +((comment) @injection.content + (#set! injection.language "comment")) + +(heredoc_template + (template_literal) @injection.content + (heredoc_identifier) @injection.language + (#downcase! @injection.language)) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/heex/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/heex/folds.scm new file mode 100644 index 00000000..88d4f17f --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/heex/folds.scm @@ -0,0 +1,6 @@ +; HEEx tags, components, and slots fold similar to HTML +[ + (component) + (tag) + (slot) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/heex/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/heex/highlights.scm new file mode 100644 index 00000000..ed8efb90 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/heex/highlights.scm @@ -0,0 +1,53 @@ +; HEEx delimiters +[ + "%>" + "--%>" + "-->" + "/>" + "" + "{" + "}" +] @tag.delimiter + +; HEEx operators are highlighted as such +"=" @operator + +; HEEx inherits the DOCTYPE tag from HTML +(doctype) @constant + +; HEEx comments are highlighted as such +(comment) @comment @spell + +; HEEx text content is treated as markup +(text) @text + +; HEEx tags and slots are highlighted as HTML +[ + (tag_name) + (slot_name) +] @tag + +; HEEx attributes are highlighted as HTML attributes +(attribute_name) @tag.attribute +[ + (attribute_value) + (quoted_attribute_value) +] @string + +; HEEx components are highlighted as modules and function calls +(component_name [ + (module) @type + (function) @function + "." @punctuation.delimiter +]) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/heex/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/heex/indents.scm new file mode 100644 index 00000000..82a2f891 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/heex/indents.scm @@ -0,0 +1,20 @@ +; HEEx tags, components, and slots indent like HTML +[ + (component) + (slot) + (tag) +] @indent.begin + +; Dedent at the end of each tag, component, and slot +[ + (end_component) + (end_slot) + (end_tag) +] @indent.branch @indent.dedent + +; Self-closing tags and components should not change +; indentation level of sibling nodes +[ + (self_closing_component) + (self_closing_tag) +] @indent.auto diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/heex/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/heex/injections.scm new file mode 100644 index 00000000..d8ae03ca --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/heex/injections.scm @@ -0,0 +1,30 @@ +; directives are standalone tags like '<%= @x %>' +; +; partial_expression_values are elixir code that is part of an expression that +; spans multiple directive nodes, so they must be combined. For example: +; <%= if true do %> +;

hello, tree-sitter!

+; <% end %> +(directive + [ + (partial_expression_value) + (ending_expression_value) + ] @injection.content + (#set! injection.language "elixir") + (#set! injection.include-children) + (#set! injection.combined)) + +; Regular expression_values do not need to be combined +((directive + (expression_value) @injection.content) + (#set! injection.language "elixir")) + +; expressions live within HTML tags, and do not need to be combined +; +(expression + (expression_value) @injection.content + (#set! injection.language "elixir")) + +; HEEx comments +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/heex/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/heex/locals.scm new file mode 100644 index 00000000..4371bc97 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/heex/locals.scm @@ -0,0 +1,13 @@ +; HEEx tags, components, and slots are references +[ + (component_name) + (slot_name) + (tag_name) +] @reference + +; Create a new scope within each HEEx tag, component, and slot +[ + (component) + (slot) + (tag) +] @scope diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/json5/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hjson/folds.scm similarity index 100% rename from config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/json5/rainbow-delimiters.scm rename to config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hjson/folds.scm diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hjson/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hjson/highlights.scm new file mode 100644 index 00000000..6e092fa1 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hjson/highlights.scm @@ -0,0 +1,15 @@ +(true) @boolean +(false) @boolean +(null) @constant.builtin +(number) @number +(pair key: (string) @label) +(pair value: (string) @string) +(array (string) @string) +; (string_content (escape_sequence) @string.escape) +; "," @punctuation.delimiter +"[" @punctuation.bracket +"]" @punctuation.bracket +"{" @punctuation.bracket +"}" @punctuation.bracket + +(comment) @comment @spell diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hjson/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hjson/indents.scm new file mode 100644 index 00000000..3b01ca99 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hjson/indents.scm @@ -0,0 +1,3 @@ +; inherits: json + +(comment) @indent.ignore diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hjson/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hjson/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hjson/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/jsonc/rainbow-delimiters.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hjson/locals.scm similarity index 100% rename from config/neovim/store/lazy-plugins/promise-async/examples/lualine/themes/jsonc/rainbow-delimiters.scm rename to config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hjson/locals.scm diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hlsl/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hlsl/folds.scm new file mode 100644 index 00000000..b617fdc5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hlsl/folds.scm @@ -0,0 +1 @@ +; inherits: cpp diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hlsl/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hlsl/highlights.scm new file mode 100644 index 00000000..68e9e44b --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hlsl/highlights.scm @@ -0,0 +1,35 @@ +; inherits: cpp + +[ + "in" + "out" + "inout" + "uniform" + "shared" + "groupshared" + "discard" + "cbuffer" + "row_major" + "column_major" + "globallycoherent" + "centroid" + "noperspective" + "nointerpolation" + "sample" + "linear" + "snorm" + "unorm" + "point" + "line" + "triangleadj" + "lineadj" + "triangle" +] @type.qualifier + +( + (identifier) @variable.builtin + (#lua-match? @variable.builtin "^SV_") +) + +(hlsl_attribute) @attribute +(hlsl_attribute ["[" "]"] @attribute) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hlsl/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hlsl/indents.scm new file mode 100644 index 00000000..b617fdc5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hlsl/indents.scm @@ -0,0 +1 @@ +; inherits: cpp diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hlsl/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hlsl/injections.scm new file mode 100644 index 00000000..29222ee0 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hlsl/injections.scm @@ -0,0 +1,5 @@ +((preproc_arg) @injection.content + (#set! injection.language "hlsl")) + +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hlsl/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hlsl/locals.scm new file mode 100644 index 00000000..b617fdc5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hlsl/locals.scm @@ -0,0 +1 @@ +; inherits: cpp diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hocon/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hocon/folds.scm new file mode 100644 index 00000000..cc8a231a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hocon/folds.scm @@ -0,0 +1,4 @@ +[ + (object) + (array) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hocon/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hocon/highlights.scm new file mode 100644 index 00000000..1fdd6ca4 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hocon/highlights.scm @@ -0,0 +1,37 @@ +(comment) @comment @spell + +(null) @constant.builtin +[ (true) (false) ] @boolean +(number) @number +(unit) @keyword +(string) @string +(multiline_string) @string +(string (escape_sequence) @string.escape) +(unquoted_string) @string + +[ "url" + "file" + "classpath" + "required" +] @keyword + +(include "include" @include) + +(substitution ["${" "${?" "}"] @punctuation.special) +(substitution (_) @field) + +(path (_) @field) +(value [":" "=" "+=" ] @operator) + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +[ "," ] @punctuation.delimiter +(unquoted_path "." @punctuation.delimiter) + diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hocon/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hocon/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hocon/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hoon/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hoon/folds.scm new file mode 100644 index 00000000..93d1386e --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hoon/folds.scm @@ -0,0 +1,6 @@ +[ + (bartisTall) + (luslusTall) + (lusbucTall) + (barcenTall) + ] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hoon/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hoon/highlights.scm new file mode 100644 index 00000000..f7136f63 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hoon/highlights.scm @@ -0,0 +1,33 @@ +(number) @number + +(string) @string + +[ + "(" + ")" + "[" + "]" +] @punctuation.bracket + +[ + (coreTerminator) + (seriesTerminator) +] @punctuation.delimiter + + +(rune) @operator + +(term) @constant + +(aura) @constant.builtin + +(Gap) @comment + +(boolean) @constant.builtin + +(date) @string.special + +(mold) @symbol +(specialIndex) @number.builtin +(lark) @operator +(fullContext) @symbol diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hoon/locals.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hoon/locals.scm new file mode 100644 index 00000000..159783fd --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/hoon/locals.scm @@ -0,0 +1,4 @@ +(tisfasTall + name: (name) @definition.var) + +(name) @reference diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/html/folds.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/html/folds.scm new file mode 100644 index 00000000..69b57eac --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/html/folds.scm @@ -0,0 +1,5 @@ +[ + (element) + (style_element) + (script_element) +] @fold diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/html/highlights.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/html/highlights.scm new file mode 100644 index 00000000..4e2371d6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/html/highlights.scm @@ -0,0 +1,7 @@ +; inherits: html_tags + +(doctype) @constant + +"" + "" +] @tag.delimiter + +"=" @operator diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/html_tags/indents.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/html_tags/indents.scm new file mode 100644 index 00000000..2d9fd386 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/html_tags/indents.scm @@ -0,0 +1,34 @@ +[ + ( + (element + (start_tag + (tag_name) @_not_special) + ) + (#not-any-of? @_not_special "meta" "link") + ) + (element (self_closing_tag)) +] @indent.begin + +; These tags are usually written one-lined and doesn't use self-closing tags so special-cased them +; but add indent to the tag to make sure attributes inside them are still indented if written multi-lined +( + (start_tag + (tag_name) @_special) + (#any-of? @_special "meta" "link") +) @indent.begin + + +; These are the nodes that will be captured when we do `normal o` +; But last element has already been ended, so capturing this +; to mark end of last element +(element (end_tag [">"] @indent.end)) +(element (self_closing_tag "/>" @indent.end)) + +; Script/style elements aren't indented, so only branch the end tag of other elements +(element (end_tag) @indent.branch) +[ + ">" + "/>" +] @indent.branch + +(comment) @indent.ignore diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/html_tags/injections.scm b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/html_tags/injections.scm new file mode 100644 index 00000000..cef63ad8 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/queries/html_tags/injections.scm @@ -0,0 +1,97 @@ +; +; +; Add "lang" to predicate check so that vue/svelte can inherit this +; without having this element being captured twice +((style_element + (start_tag) @_no_type_lang + (raw_text) @injection.content) + (#not-lua-match? @_no_type_lang "%slang%s*=") + (#not-lua-match? @_no_type_lang "%stype%s*=") + (#set! injection.language "css")) + +((style_element + (start_tag + (attribute + (attribute_name) @_type + (quoted_attribute_value (attribute_value) @_css))) + (raw_text) @injection.content) + (#eq? @_type "type") + (#eq? @_css "text/css") + (#set! injection.language "css")) + +; +; +((script_element + (start_tag) @_no_type_lang + (raw_text) @injection.content) + (#not-lua-match? @_no_type_lang "%slang%s*=") + (#not-lua-match? @_no_type_lang "%stype%s*=") + (#set! injection.language "javascript")) + +; + diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/indent/html/self_closing_tag.html b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/indent/html/self_closing_tag.html new file mode 100644 index 00000000..79376b83 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/indent/html/self_closing_tag.html @@ -0,0 +1,14 @@ + + + + + + + + + +
+ + + + diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/query/injections/vue/negative-assertions.vue b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/query/injections/vue/negative-assertions.vue new file mode 100644 index 00000000..fdc87191 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/query/injections/vue/negative-assertions.vue @@ -0,0 +1,4 @@ + + + + diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/query/injections/vue/test-vue-injections.vue b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/query/injections/vue/test-vue-injections.vue new file mode 100644 index 00000000..773e53a5 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/query/injections/vue/test-vue-injections.vue @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/query/injections/yaml/bash-on-github-actions.yml b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/query/injections/yaml/bash-on-github-actions.yml new file mode 100644 index 00000000..ba56de19 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/query/injections/yaml/bash-on-github-actions.yml @@ -0,0 +1,32 @@ +name: CI +on: + push: + branches: [master] + pull_request: + branches: [master] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: '16' + - name: Install dependencies + run: npm ci + # ^ bash + - name: Run tests + run: npm test + # ^ bash + - name: Parse Petalisp + run: | + git submodule init + git submodule update + if (( $(node_modules/tree-sitter-cli/tree-sitter parse test/Petalisp/**/*.lisp -q | wc -l) > 2 )); then # There are 2 known failures (strings that are not format strings but use ~X syntax) + exit 1 + else + echo "Successfully parsed Petalisp" + fi + # ^ bash + - name: Run tests + run: npm test diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/query/injections/yaml/promql-on-prometheus-rules.yaml b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/query/injections/yaml/promql-on-prometheus-rules.yaml new file mode 100644 index 00000000..8b1895c1 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/query/injections/yaml/promql-on-prometheus-rules.yaml @@ -0,0 +1,19 @@ +groups: +- name: Hardware alerts + rules: + - alert: Node down + expr: up{job="node_exporter"} == 0 + # ^ promql + for: 3m + labels: + severity: warning + annotations: + title: Node {{ $labels.instance }} is down + description: Failed to scrape {{ $labels.job }} on {{ $labels.instance }} for more than 3 minutes. Node seems down. + - alert: Node down + expr: | + up{job="node_exporter"} == 0 + # ^ promql + for: 3m + labels: + severity: warning diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/unit/ts_utils_spec.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/unit/ts_utils_spec.lua new file mode 100644 index 00000000..397fa7ea --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter/tests/unit/ts_utils_spec.lua @@ -0,0 +1,114 @@ +local tsutils = require "nvim-treesitter.ts_utils" + +describe("update_selection", function() + local function get_updated_selection(case) + vim.api.nvim_buf_set_lines(0, 0, -1, false, case.lines) + tsutils.update_selection(0, case.node, case.selection_mode) + vim.cmd "normal! y" + return vim.fn.getreg '"' + end + + it("charwise1", function() + assert.equal( + get_updated_selection { + lines = { "foo", "", "bar" }, + node = { 0, 0, 2, 1 }, + selection_mode = "v", + }, + "foo\n\nb" + ) + it("charwise2", function() end) + assert.equal( + get_updated_selection { + lines = { "foo", "", "bar" }, + node = { 0, 1, 2, 1 }, + selection_mode = "v", + }, + "oo\n\nb" + ) + it("charwise3", function() end) + assert.equal( + get_updated_selection { + lines = { "foo", "", "bar" }, + node = { 0, 2, 2, 1 }, + selection_mode = "v", + }, + "o\n\nb" + ) + it("charwise4", function() end) + assert.equal( + get_updated_selection { + lines = { "foo", "", "bar" }, + node = { 0, 3, 2, 1 }, + selection_mode = "v", + }, + "\n\nb" + ) + end) + it("linewise", function() + assert.equal( + get_updated_selection { + lines = { "foo", "", "bar" }, + node = { 0, 3, 2, 1 }, + selection_mode = "V", + }, + "foo\n\nbar\n" + ) + end) + it("blockwise", function() + assert.equal( + get_updated_selection { + lines = { "foo", "", "bar" }, + node = { 0, 3, 2, 1 }, + selection_mode = "", + }, + "foo\n\nbar" + ) + end) +end) + +describe("swap_nodes", function() + local function swap(case) + vim.api.nvim_buf_set_lines(0, 0, -1, false, case.lines) + vim.opt.filetype = case.filetype + local a = vim.treesitter.get_node { + bufnr = 0, + pos = { case.a[1], case.a[2] }, + } + local b = vim.treesitter.get_node { + bufnr = 0, + pos = { case.b[1], case.b[2] }, + } + tsutils.swap_nodes(a, b, 0, true) + end + + it("works on adjacent nodes", function() + swap { + filetype = "python", + lines = { "print(1)" }, + a = { 0, 0 }, + b = { 0, 5 }, + } + + it("swaps text", function() end) + assert.same(vim.api.nvim_buf_get_lines(0, 0, -1, false), { "(1)print" }) + + it("moves the cursor", function() end) + assert.same(vim.api.nvim_win_get_cursor(0), { 1, 3 }) + end) + + it("works with multiline nodes", function() + swap { + filetype = "lua", + lines = { "x = { [[", "]], [[", ".....]]}" }, + a = { 0, 6 }, + b = { 1, 4 }, + } + + it("swaps text", function() end) + assert.same(vim.api.nvim_buf_get_lines(0, 0, -1, false), { "x = { [[", ".....]], [[", "]]}" }) + + it("moves the cursor", function() end) + assert.same(vim.api.nvim_win_get_cursor(0), { 2, 9 }) + end) +end) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/.busted b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/.busted new file mode 100644 index 00000000..5af0753f --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/.busted @@ -0,0 +1,38 @@ +-- SPDX-License-Identifier: Unlicense + +-- This is free and unencumbered software released into the public domain. +-- +-- Anyone is free to copy, modify, publish, use, compile, sell, or distribute +-- this software, either in source code form or as a compiled binary, for any +-- purpose, commercial or non-commercial, and by any means. +-- +-- In jurisdictions that recognize copyright laws, the author or authors of +-- this software dedicate any and all copyright interest in the software to +-- the public domain. We make this dedication for the benefit of the public +-- at large and to the detriment of our heirs and successors. We intend this +-- dedication to be an overt act of relinquishment in perpetuity of all +-- present and future rights to this software under copyright law. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +-- THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +-- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +-- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-- +-- For more information, please refer to + + +return { + _all = { + coverage = false, + lua = './test/nvim-shim' + }, + integration = { + ROOT = {'./test/integration/'}, + pattern = '', -- No fancy name patterns for test files + } +} + + +-- vim:ft=lua diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/.gitignore b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/.gitignore new file mode 100644 index 00000000..043129b6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/.gitignore @@ -0,0 +1,7 @@ +# Tag file created by Vim +doc/tags + +# Fake user directory structures +test/xdg/local/state/nvim/ +test/xdg/local/share/nvim/ +!test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg.nvim diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/.luarc.json b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/.luarc.json new file mode 100644 index 00000000..3533cf01 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/.luarc.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json", + "workspace.ignoreDir": ["test/xdg"] +} diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/LICENSE.txt b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/LICENSE.txt new file mode 100644 index 00000000..59b792d6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/LICENSE.txt @@ -0,0 +1,19 @@ +Copyright © 2024 Alejandro "HiPhish" Sanchez + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/README.rst b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/README.rst new file mode 100644 index 00000000..a926741a --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/README.rst @@ -0,0 +1,68 @@ +.. default-role:: code + +######### + Yo-Dawg +######### + + Yo dawg, I heard you like Neovim, so I put a Neovim inside your Neovim so + you can edit while you edit. + +This is a thin wrapper plugin for Neovim that cuts down on the boilerplate code +for controlling an embedded Neovim process inside Neovim. Why would you want +to do that? For me it's about testing, if I write my tests in Busted_ I need +to test the plugin code in a separate Neovim process which is distinct from the +process running the test. This is not limited to testing though, it's a +general purpose-plugin. Think of it like Selenium_ for Neovim. + + +Installation and configuration +############################## + +Install it like any other Neovim plugin. There is no configuration, this is +purely a library. Personally I like to install it as an optional plugin +(`:h :packadd`), but that's up to you. + + +Usage +##### + +Here is a simple toy example: + +.. code:: lua + + local yd = require 'yo-dawg' + + -- Start a new process using the default job options + local nvim = yd.start() + + -- Evaluate a Vim script expression + local result = nvim:eval('1 + 2') + -- Call an asynchronous method (does not wait for a result) + nvim:async_set_var('my_var', result) + -- Only synchronous methods can return values + local my_var = nvim:get_var('my_var') + + -- Terminate the Neovim process when done + yd.stop(nvim) + +Any Neovim API method (`:h API`) can be called as a method. To call the method +asynchronously prefix it with `async_`. This plugin is forwards compatible, +any new method will automatically be supported. + + +Status of the plugin +#################### + +It's done as far as I am concerned. It does one thing and does it well. + + +License +####### + +Licensed under the terms of the MIT (Expat) license. See the LICENSE_ file for +details. + + +.. _Busted: https://lunarmodules.github.io/busted/ +.. _Selenium: https://www.selenium.dev/ +.. _LICENSE: LICENSE.txt diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/doc/yo-dawg.txt b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/doc/yo-dawg.txt new file mode 100644 index 00000000..458d1ca1 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/doc/yo-dawg.txt @@ -0,0 +1,111 @@ +*yo-dawg.txt* Convenience library for controlling an embedded Neovim process + + *yo-dawg* +Author: Alejandro "HiPhish" Sanchez +License: MIT +Version: 1.0.0 + +============================================================================== +TABLE OF CONTENTS *yo-dawg-contents* + +1. Introduction .......................................... |yo-dawg-intro| +2. Reference ............................................. |yo-dawg-reference| + + + +============================================================================== +INTRODUCTION *yo-dawg-intro* + +This is a convenience library to reduce the amount of boilerplate code when +controlling an embedded Neovim instance. Technically you do not need this +plugin, and if all you need is one long-running Neovim process it probably is +not worth pulling in a library. However, if you have to deal with many Neovim +process and you frequently call into the API the boilerplate can add up very +quickly. Consider this example: +>lua + -- Start the process + local cmd = {'nvim', '--embed', '--headless'} + local nvim = vim.fn.jobstart(cmd, {rpc = true}) + + -- Call an API method + local value = vim.rpcrequest(nvim, 'nvim_eval', '1 + 2') + + -- Gracefully terminate the process + vim.rpcnotify(nvim, 'nvim_cmd', {cmd = 'quitall', bang = true}, {}) + vim.fn.jobwait(nvim) +< +Now compare it to what we get when we use Yo-Dawg: +>lua + local yd = require 'yo-dawg' + + -- Start the process + local nvim = yd.start() + + -- Call an API method + local value = nvim:eval('1 + 2') + + -- Gracefully terminate the process + yd.stop(nvim) +< +Calling the |yo-dawg.start| function returns a Neovim handle. This a unique +object which has all of Neovim's |API| methods as callable methods. We have +to explictly stop the process, or else it will linger on. + + + +============================================================================== +REFERENCE *yo-dawg-reference* + +The entire library is exposed by the `yo-dawg` Lua module. + + + *yo-dawg-handle* +The handle is the main object through which we interact with Neovim. It is a +globally unique object which is passed by reference. For every |API| method +there is a corresponding handle method: + +• Synchronous methods have the same name as the API method without `nvim_` + prefix (e.g. `nvim_exec_lua` becomes `exec_lua`) +• Asynchronous methods have the same name as the API method, but with `async_` + as a prefix instead of `nvim_` (e.g. `nvim_exec_lua` becomes + `async_exec_lua`) + +All methods take the same arguments as their corresponding API method. +Synchronous methods return a value if their API method does. Asynchronous +methods never return any value. Example: +>lua + nvim:eval('1 + 2') -- Synchronous, returns 3 + nvim:async_set_var('my_var', 124) -- Asynchronous, side effects only +< + + + *yo-dawg.start* +'yo-dawg'.start([{opts}]) + +Starts a new Neovim process and returns the handle. For the optional {opts} +table see |jobstart-options|. The `rpc` option is always implicitly set to +`true` even if the {opts} say otherwise. + + Parameters: ~ + • {opts} See |jobstart-options|; the `rpc` option is always + implicitly set to `true` even if the {opts} say otherwise. + + Return: ~ + Handle to the Neovim process (|yo-dawg-handle|) + + + *yo-dawg.stop* +'yo-dawg'.stop({handle}, [{timeout}]) + +Gracefully quits the Neovim process of {handle}. This involves sending |:qa| +with a bang to the process and then waiting for it to terminate. + + Parameters: ~ + • {handle} Handle to the Neovim process (|yo-dawg-handle|) + • {timeout} Same as for |jobwait()| + + Return: ~ + The same value as the first value of |jobwait()|. + + + vim:tw=78:ts=8:sw=4:et:ft=help:norl: diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/lua/yo-dawg.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/lua/yo-dawg.lua new file mode 100644 index 00000000..db92f905 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/lua/yo-dawg.lua @@ -0,0 +1,90 @@ +-- SPDX-License-Identifier: MIT + +local M = {} + +local INV_ARGS_TEMPLATE = 'Invalid arguments: %s' +local INV_CMD_TEMPLATE = 'Command not executable: %s' +local COMMAND = {'nvim', '--embed', '--headless'} +local DEFAULT_JOBOPTS = { + rpc = true, + width = 80, + height = 40, +} + +---Weak table which maps Neovim instance wrappers to the corresponding job ID. +---The table has weak keys, which means entries will be removed once the +---corresponding key object has been garbage-collected. We need this table +---because we do not want to expose the job ID to the user. +local job_ids = setmetatable({}, { + __mode = 'k', +}) + +---Maps method names to method functions to avoid repeatedly creating the same +---function over and over again. +local methods = { +} + + +---Metatable of all Neovim instances +local mt = { + __index = function(nvim, key) + local is_async = key:find('^async_') ~= nil + local method = string.format('nvim_%s', key:gsub('^async_', '', 1)) + local result = methods[key] or function(self, ...) + local jobid = job_ids[self] + if is_async then + vim.rpcnotify(jobid, method, ...) + return + end + return vim.rpcrequest(jobid, method, ...) + end + + -- Cache for later + nvim[key] = result + + return result + end +} + + +---Starts a new Neovim process, returns the handle. +---@param jobopts table? Optional job options +---@return table handle The handle to the Neovim process +function M.start(jobopts) + jobopts = jobopts or DEFAULT_JOBOPTS + jobopts.rpc = true + local jobid = vim.fn.jobstart(COMMAND, jobopts) + + if jobid == 0 then + local msg = INV_ARGS_TEMPLATE:format(vim.inspect(jobopts)) + error(msg) + elseif jobid == -1 then + local msg = INV_CMD_TEMPLATE:format(COMMAND[1]) + error(msg) + end + + local result = setmetatable({}, mt) + job_ids[result] = jobid + + return result +end + + +---Stops the process behind the given handle. +---@param nvim table The Neovim process handle +---@param timeout integer? Timeout in milliseconds +---@return integer status Same as the first return value of jobwait() +function M.stop(nvim, timeout) + local jobid = job_ids[nvim] + vim.rpcnotify(jobid, 'nvim_cmd', {cmd = 'quitall', bang = true}, {}) + + local result + if timeout then + result = vim.fn.jobwait({jobid}, timeout) + else + result = vim.fn.jobwait({jobid}) + end + return result[1] +end + +return M diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/makefile b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/makefile new file mode 100644 index 00000000..b2ffccf6 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/makefile @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: Unlicense + +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or distribute +# this software, either in source code form or as a compiled binary, for any +# purpose, commercial or non-commercial, and by any means. +# +# In jurisdictions that recognize copyright laws, the author or authors of +# this software dedicate any and all copyright interest in the software to +# the public domain. We make this dedication for the benefit of the public +# at large and to the detriment of our heirs and successors. We intend this +# dedication to be an overt act of relinquishment in perpetuity of all +# present and future rights to this software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# For more information, please refer to + + +.PHONY: check integration-test clean + +check: integration-test + +integration-test: + @eval $$(luarocks path --lua-version 5.1 --bin) && busted --run integration + +clean: + @rm -rf test/xdg/local/state/nvim/* diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/test/integration/evaluation.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/test/integration/evaluation.lua new file mode 100644 index 00000000..aa2273da --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/test/integration/evaluation.lua @@ -0,0 +1,52 @@ +-- SPDX-License-Identifier: MIT + +local yd = require 'yo-dawg' + + +describe('Calling RPC methods', function() + local nvim + + before_each(function() + nvim = yd.start() + end) + + after_each(function() + yd.stop(nvim) + end) + + it('Evaluates simple Vim script expressions', function() + local result + + result = nvim:eval('1 + 2') + assert.is.equal(3, result) + + result = nvim:eval('"Hello, " .. "world!"') + assert.is.equal('Hello, world!', result) + + result = nvim:eval('[1, 2] + [3, 4]') + assert.are.same({1, 2, 3, 4}, result) + end) + + it('Performs side effect synchronously', function() + nvim:set_var('my_var', 123) + local my_var = nvim:get_var('my_var') + assert.is.equal(123, my_var) + end) + + it('Performs side effect asynchronously', function() + nvim:async_set_var('my_var', 123) + local my_var = nvim:get_var('my_var') + assert.is.equal(123, my_var) + end) + + it('Never returns a value asynchronously', function() + local result = nvim:async_eval('1 + 2') + assert.is_nil(result) + end) + + it('Raises an error for unknown methods', function() + assert.has_error(function() + nvim:herp_derp_lol_rofl() + end) + end) +end) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/test/integration/startup-shutdown.lua b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/test/integration/startup-shutdown.lua new file mode 100644 index 00000000..b3e393d1 --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/test/integration/startup-shutdown.lua @@ -0,0 +1,64 @@ +-- SPDX-License-Identifier: MIT + +local yd = require 'yo-dawg' + + +describe('Startup and shutdown', function() + local nvim + + describe('Faulty startup', function() + it('Raises an error on invalid arguments', function() + local jobstart = vim.fn.jobstart + local function fake_jobstart(_cmd, _jobopts) + return 0 + end + + assert.has_error(function() + vim.fn.jobstart = fake_jobstart + nvim = yd.start() + end) + vim.fn.jobstart = jobstart + assert.is_nil(nvim) + end) + + it('Raises an error on not executable command', function() + local jobstart = vim.fn.jobstart + local function fake_jobstart(_cmd, _jobopts) return -1 end + + assert.has_error(function() + vim.fn.jobstart = fake_jobstart + nvim = yd.start() + end) + vim.fn.jobstart = jobstart + assert.is_nil(nvim) + end) + end) + + describe('Happy path', function() + it('Starts up and shuts down without error', function() + nvim = yd.start() + yd.stop(nvim) + end) + + it('Is raises an error when we try to stop a stopped process', function() + nvim = yd.start() + yd.stop(nvim) + assert.has_error(function() + yd.stop(nvim) + end) + end) + + it('Shuts down with generous timeout', function() + nvim = yd.start() + yd.stop(nvim, 250) + end) + + it('Applies custom job options', function() + local key = 'XXX_FOO_XXX' + nvim = yd.start{env = {[key] = 'foo'}} + local value = nvim:exec_lua('return os.getenv(...)', {key}) + assert.is.equal('foo', value) + yd.stop(nvim) + end) + end) +end) diff --git a/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/test/nvim-shim b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/test/nvim-shim new file mode 100755 index 00000000..e1bc35bb --- /dev/null +++ b/config/neovim/store/lazy-plugins/rainbow-delimiters.nvim/test/xdg/local/share/nvim/site/pack/testing/start/yo-dawg/test/nvim-shim @@ -0,0 +1,37 @@ +#!/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/sh +# SPDX-License-Identifier: Unlicense + +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or distribute +# this software, either in source code form or as a compiled binary, for any +# purpose, commercial or non-commercial, and by any means. +# +# In jurisdictions that recognize copyright laws, the author or authors of +# this software dedicate any and all copyright interest in the software to +# the public domain. We make this dedication for the benefit of the public +# at large and to the detriment of our heirs and successors. We intend this +# dedication to be an overt act of relinquishment in perpetuity of all +# present and future rights to this software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# For more information, please refer to + + +# A shim which acts as a command-line interface adapter to use Neovim as a Lua +# interpreter. + +# Set custom XDG base directory paths to isolate the test Neovim from the +# user's own configuration and data files. +export XDG_CONFIG_HOME='test/xdg/config/' +export XDG_STATE_HOME='test/xdg/local/state/' +export XDG_DATA_HOME='test/xdg/local/share/' + +# We have to explicitly enable plugins, see ':h -l' +nvim --cmd 'set loadplugins' -l $@ diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/doc/rustaceanvim.txt b/config/neovim/store/lazy-plugins/rustaceanvim/doc/rustaceanvim.txt index 9da43f53..6e6234c3 100644 --- a/config/neovim/store/lazy-plugins/rustaceanvim/doc/rustaceanvim.txt +++ b/config/neovim/store/lazy-plugins/rustaceanvim/doc/rustaceanvim.txt @@ -234,12 +234,13 @@ RustcOpts *RustcOpts* RustaceanLspClientOpts *RustaceanLspClientOpts* Fields: ~ - {auto_attach?} (boolean|fun(bufnr:integer):boolean) Whether to automatically attach the LSP client. Defaults to `true` if the `rust-analyzer` executable is found. - {cmd?} (string[]|fun():string[]) Command and arguments for starting rust-analyzer - {settings?} (table|fun(project_root:string|nil,default_settings:table):table) Setting passed to rust-analyzer. Defaults to a function that looks for a `rust-analyzer.json` file or returns an empty table. See https://rust-analyzer.github.io/manual.html#configuration. - {standalone?} (boolean) Standalone file support (enabled by default). Disabling it may improve rust-analyzer's startup time. - {logfile?} (string) The path to the rust-analyzer log file. - {load_vscode_settings?} (boolean) Whether to search (upward from the buffer) for rust-analyzer settings in .vscode/settings json. If found, loaded settings will override configured options. Default: false + {auto_attach?} (boolean|fun(bufnr:integer):boolean) Whether to automatically attach the LSP client. Defaults to `true` if the `rust-analyzer` executable is found. + {cmd?} (string[]|fun():string[]) Command and arguments for starting rust-analyzer + {root_dir?} (string|fun(filename:string,default:fun(filename:string):string|nil):string|nil) The directory to use for the attached LSP. Can be a function, which may return nil if no server should attach. The second argument contains the default implementation, which can be used for fallback behavior. + {settings?} (table|fun(project_root:string|nil,default_settings:table):table) Setting passed to rust-analyzer. Defaults to a function that looks for a `rust-analyzer.json` file or returns an empty table. See https://rust-analyzer.github.io/manual.html#configuration. + {standalone?} (boolean) Standalone file support (enabled by default). Disabling it may improve rust-analyzer's startup time. + {logfile?} (string) The path to the rust-analyzer log file. + {load_vscode_settings?} (boolean) Whether to search (upward from the buffer) for rust-analyzer settings in .vscode/settings json. If found, loaded settings will override configured options. Default: false RustaceanDapOpts *RustaceanDapOpts* diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/ftplugin/rust.lua b/config/neovim/store/lazy-plugins/rustaceanvim/ftplugin/rust.lua index 786e1309..11661084 100644 --- a/config/neovim/store/lazy-plugins/rustaceanvim/ftplugin/rust.lua +++ b/config/neovim/store/lazy-plugins/rustaceanvim/ftplugin/rust.lua @@ -46,19 +46,12 @@ end vim.g.loaded_rustaceanvim = true -local bufnr = vim.api.nvim_get_current_buf() local auto_attach = config.server.auto_attach if type(auto_attach) == 'function' then + local bufnr = vim.api.nvim_get_current_buf() auto_attach = auto_attach(bufnr) end if auto_attach then - -- Defer for a smoother experience on low-end devices - vim.api.nvim_create_autocmd('BufEnter', { - buffer = bufnr, - group = vim.api.nvim_create_augroup('RustaceanvimAttach', { clear = true }), - callback = function() - require('rustaceanvim.lsp').start() - end, - }) + require('rustaceanvim.lsp').start() end diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/git-files/git-file-1 b/config/neovim/store/lazy-plugins/rustaceanvim/lua/git-files/git-file-1 deleted file mode 100644 index c139d4ec..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/git-files/git-file-1 +++ /dev/null @@ -1,21 +0,0 @@ -Line 1-1 -Line 1-2 -Line 1-3 -Line 1-4 -Line 1-5 -Line 1-6 -Line 1-7 -Line 1-8 -Line 1-9 -Line 1-10 -Line 1-11 -Line 1-12 -Line 1-13 -Line 1-14 -Line 1-15 -Line 1-16 -Line 1-17 -Line 1-18 -Line 1-19 -Line 1-20 -Line 1-21 diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/git-files/git-file-2 b/config/neovim/store/lazy-plugins/rustaceanvim/lua/git-files/git-file-2 deleted file mode 100644 index e45e3de1..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/git-files/git-file-2 +++ /dev/null @@ -1,21 +0,0 @@ -Line 2-1 -Line 2-2 -Line 2-3 -Line 2-4 -Line 2-5 -Line 2-6 -Line 2-7 -Line 2-8 -Line 2-9 -Line 2-10 -Line 2-11 -Line 2-12 -Line 2-13 -Line 2-14 -Line 2-15 -Line 2-16 -Line 2-17 -Line 2-18 -Line 2-19 -Line 2-20 -Line 2-21 diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/lua/nvim-web-devicons.lua b/config/neovim/store/lazy-plugins/rustaceanvim/lua/lua/nvim-web-devicons.lua deleted file mode 100644 index eeb1bb70..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/lua/nvim-web-devicons.lua +++ /dev/null @@ -1,17 +0,0 @@ -vim.cmd('hi DevIconLicense guifg=#111111') -vim.cmd('hi DevIconMakefile guifg=#222222') -vim.cmd('hi DevIconGif guifg=#333333') -vim.cmd('hi DevIconLua guifg=#444444') -vim.cmd('hi DevIconTxt guifg=#555555') -vim.cmd('hi DevIconDefault guifg=#666666') - -return { - get_icon = function(filename, _, options) - if filename == 'LICENSE' then return '', 'DevIconLicense' end - if filename == 'Makefile' then return '', 'DevIconMakefile' end - if vim.endswith(filename, 'gif') then return '', 'DevIconGif' end - if vim.endswith(filename, 'lua') then return '', 'DevIconLua' end - if vim.endswith(filename, 'txt') then return '', 'DevIconTxt' end - if (options or {}).default then return '', 'DevIconDefault' end - end, -} diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/diagnostic-file-1 b/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/diagnostic-file-1 deleted file mode 100644 index 1c25b397..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/diagnostic-file-1 +++ /dev/null @@ -1,5 +0,0 @@ -Error Warning Info Hint - Error - Warning - Info - Hint diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/diagnostic-file-2 b/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/diagnostic-file-2 deleted file mode 100644 index c21ac383..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/diagnostic-file-2 +++ /dev/null @@ -1,4 +0,0 @@ -Error -Warning -Info -Hint diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/diagnostic.lua b/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/diagnostic.lua deleted file mode 100644 index 3dd7186a..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/diagnostic.lua +++ /dev/null @@ -1,34 +0,0 @@ -local severity = vim.diagnostic.severity -_G.diag_ns = vim.api.nvim_create_namespace('mock-diagnostics') - --- Open files -vim.cmd('edit tests/dir-extra/mocks/diagnostic-file-1') -_G.buf_id_1 = vim.api.nvim_get_current_buf() -vim.cmd('edit tests/dir-extra/mocks/diagnostic-file-2') -_G.buf_id_2 = vim.api.nvim_get_current_buf() - --- Define diagnostic ---stylua: ignore -_G.diagnostic_arr = { - -- Several entries on one line - { bufnr = buf_id_1, lnum = 0, end_lnum = 0, col = 0, end_col = 5, message = 'Error 1', severity = severity.ERROR }, - { bufnr = buf_id_1, lnum = 0, end_lnum = 0, col = 6, end_col = 13, message = 'Warning 1', severity = severity.WARN }, - { bufnr = buf_id_1, lnum = 0, end_lnum = 0, col = 14, end_col = 18, message = 'Info 1', severity = severity.INFO }, - { bufnr = buf_id_1, lnum = 0, end_lnum = 0, col = 19, end_col = 23, message = 'Hint 1', severity = severity.HINT }, - - -- Entries on separate lines not at line start - { bufnr = buf_id_1, lnum = 1, end_lnum = 1, col = 2, end_col = 7, message = 'Error 2', severity = severity.ERROR }, - { bufnr = buf_id_1, lnum = 2, end_lnum = 2, col = 2, end_col = 9, message = 'Warning 2', severity = severity.WARN }, - { bufnr = buf_id_1, lnum = 3, end_lnum = 3, col = 2, end_col = 6, message = 'Info 2', severity = severity.INFO }, - { bufnr = buf_id_1, lnum = 4, end_lnum = 4, col = 2, end_col = 6, message = 'Hint 2', severity = severity.HINT }, - - -- Another buffer - { bufnr = buf_id_2, lnum = 0, end_lnum = 0, col = 0, end_col = 5, message = 'Error 3', severity = severity.ERROR }, - { bufnr = buf_id_2, lnum = 1, end_lnum = 1, col = 0, end_col = 7, message = 'Warning 3', severity = severity.WARN }, - { bufnr = buf_id_2, lnum = 2, end_lnum = 2, col = 0, end_col = 4, message = 'Info 3', severity = severity.INFO }, - { bufnr = buf_id_2, lnum = 3, end_lnum = 3, col = 0, end_col = 4, message = 'Hint 3', severity = severity.HINT }, -} - --- Set diagnostic -vim.diagnostic.set(diag_ns, buf_id_1, vim.tbl_filter(function(x) return x.bufnr == buf_id_1 end, _G.diagnostic_arr), {}) -vim.diagnostic.set(diag_ns, buf_id_2, vim.tbl_filter(function(x) return x.bufnr == buf_id_2 end, _G.diagnostic_arr), {}) diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/git-commit b/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/git-commit deleted file mode 100644 index ffaea3bc..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/git-commit +++ /dev/null @@ -1,18 +0,0 @@ -commit 1111111111111111111111111111111111111111 -Author: Mini Nvim -Date: Thu Jan 1 11:11:11 1970 +0300 - - Initial commit. - -diff --git a/git-files/git-file-1 b/git-files/git-file-1 -index 1111111..0123456 100644 ---- a/git-files/git-file-1 -+++ b/git-files/git-file-1 -@@ -1,5 +1,5 @@ - Line 1-1 --Line 1-2 - Line 1-3 - Line 1-4 - Line 1-5 -+Line 1-6 - diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/git-diff b/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/git-diff deleted file mode 100644 index 97d1d1fc..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/git-diff +++ /dev/null @@ -1,47 +0,0 @@ -diff --git a/git-files/git-file-1 b/git-files/git-file-1 -index c139d4e..234d24d 100644 ---- a/git-files/git-file-1 -+++ b/git-files/git-file-1 -@@ -1,4 +1,3 @@ --Line 1-1 - Line 1-2 - Line 1-3 - Line 1-4 -@@ -9,6 +8,7 @@ Line 1-8 - Line 1-9 - Line 1-10 - Line 1-11 -+Line new - Line 1-12 - Line 1-13 - Line 1-14 -@@ -18,4 +18,4 @@ Line 1-17 - Line 1-18 - Line 1-19 - Line 1-20 --Line 1-21 -+Line changed -diff --git a/git-files/git-file-2 b/git-files/git-file-2 -index e45e3de..bd830d0 100644 ---- a/git-files/git-file-2 -+++ b/git-files/git-file-2 -@@ -1,5 +1,4 @@ - Line 2-1 --Line 2-2 - Line 2-3 - Line 2-4 - Line 2-5 -@@ -10,10 +9,11 @@ Line 2-9 - Line 2-10 - Line 2-11 - Line 2-12 -+Line new - Line 2-13 - Line 2-14 - Line 2-15 --Line 2-16 -+Line changed - Line 2-17 - Line 2-18 - Line 2-19 - diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/git-diff-unified-0 b/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/git-diff-unified-0 deleted file mode 100644 index a3eac8dd..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/git-diff-unified-0 +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/git-files/git-file-1 b/git-files/git-file-1 -index c139d4e..234d24d 100644 ---- a/git-files/git-file-1 -+++ b/git-files/git-file-1 -@@ -1 +0,0 @@ --Line 1-1 -@@ -11,0 +11 @@ Line 1-11 -+Line new -@@ -21 +21 @@ Line 1-20 --Line 1-21 -+Line changed -diff --git a/git-files/git-file-2 b/git-files/git-file-2 -index e45e3de..bd830d0 100644 ---- a/git-files/git-file-2 -+++ b/git-files/git-file-2 -@@ -2 +1,0 @@ Line 2-1 --Line 2-2 -@@ -12,0 +12 @@ Line 2-12 -+Line new -@@ -16 +16 @@ Line 2-15 --Line 2-16 -+Line changed - diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/git-diff-unified-20 b/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/git-diff-unified-20 deleted file mode 100644 index 6a644d33..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/git-diff-unified-20 +++ /dev/null @@ -1,57 +0,0 @@ -diff --git a/git-files/git-file-1 b/git-files/git-file-1 -index c139d4e..234d24d 100644 ---- a/git-files/git-file-1 -+++ b/git-files/git-file-1 -@@ -1,21 +1,21 @@ --Line 1-1 - Line 1-2 - Line 1-3 - Line 1-4 - Line 1-5 - Line 1-6 - Line 1-7 - Line 1-8 - Line 1-9 - Line 1-10 - Line 1-11 -+Line new - Line 1-12 - Line 1-13 - Line 1-14 - Line 1-15 - Line 1-16 - Line 1-17 - Line 1-18 - Line 1-19 - Line 1-20 --Line 1-21 -+Line changed -diff --git a/git-files/git-file-2 b/git-files/git-file-2 -index e45e3de..bd830d0 100644 ---- a/git-files/git-file-2 -+++ b/git-files/git-file-2 -@@ -1,21 +1,21 @@ - Line 2-1 --Line 2-2 - Line 2-3 - Line 2-4 - Line 2-5 - Line 2-6 - Line 2-7 - Line 2-8 - Line 2-9 - Line 2-10 - Line 2-11 - Line 2-12 -+Line new - Line 2-13 - Line 2-14 - Line 2-15 --Line 2-16 -+Line changed - Line 2-17 - Line 2-18 - Line 2-19 - Line 2-20 - Line 2-21 - diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/keymaps.lua b/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/keymaps.lua deleted file mode 100644 index 94885298..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/keymaps.lua +++ /dev/null @@ -1,12 +0,0 @@ -local tmp = 1 - -local keymap_rhs = function() - -- Comment - _G.been_here = true -end - ---stylua: ignore -vim.api.nvim_set_keymap( - 'n', 'ga', '', - { callback = keymap_rhs, desc = 'Keymap with callback' } -) diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/lsp.lua b/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/lsp.lua deleted file mode 100644 index bc964277..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/lsp.lua +++ /dev/null @@ -1,96 +0,0 @@ -local filename = vim.fn.fnamemodify('tests/dir-extra/real-files/a.lua', ':p') - -_G.lsp_buf_calls = {} - -local make_context = function(lsp_method) - return { - bufnr = vim.api.nvim_get_current_buf(), - method = lsp_method, - -- There are more fields, but none are relevant - } -end - -vim.lsp.buf.declaration = function(opts) - table.insert(_G.lsp_buf_calls, 'declaration') - local data = { - context = make_context('textDocument/declaration'), - items = { { col = 16, filename = filename, lnum = 3, text = ' x = math.max(a, 2),' } }, - title = 'Declaration', - } - opts.on_list(data) -end - -vim.lsp.buf.definition = function(opts) - table.insert(_G.lsp_buf_calls, 'definition') - local data = { - context = make_context('textDocument/definition'), - items = { { col = 16, filename = filename, lnum = 3, text = ' x = math.max(a, 2),' } }, - title = 'Definition', - } - opts.on_list(data) -end - -vim.lsp.buf.document_symbol = function(opts) - table.insert(_G.lsp_buf_calls, 'document_symbol') - local data = { - context = make_context('textDocument/documentSymbol'), - items = { - { col = 7, filename = filename, kind = 'Number', lnum = 1, text = '[Number] a' }, - { col = 7, filename = filename, kind = 'Object', lnum = 2, text = '[Object] t' }, - { col = 3, filename = filename, kind = 'Variable', lnum = 3, text = '[Variable] x' }, - { col = 3, filename = filename, kind = 'Variable', lnum = 4, text = '[Variable] y' }, - }, - title = 'Symbols in a.lua', - } - opts.on_list(data) -end - -vim.lsp.buf.implementation = function(opts) - table.insert(_G.lsp_buf_calls, 'implementation') - local data = { - context = make_context('textDocument/implementation'), - items = { { col = 16, filename = filename, lnum = 3, text = ' x = math.max(a, 2),' } }, - title = 'Implementation', - } - opts.on_list(data) -end - -vim.lsp.buf.references = function(_, opts) - table.insert(_G.lsp_buf_calls, 'references') - local data = { - context = make_context('textDocument/references'), - items = { - { col = 7, filename = filename, lnum = 1, text = 'local a = 1' }, - { col = 16, filename = filename, lnum = 3, text = ' x = math.max(a, 2),' }, - { col = 16, filename = filename, lnum = 4, text = ' y = math.min(a, 2),' }, - }, - title = 'References', - } - opts.on_list(data) -end - -vim.lsp.buf.type_definition = function(opts) - table.insert(_G.lsp_buf_calls, 'type_definition') - local data = { - context = make_context('textDocument/typeDefinition'), - items = { { col = 16, filename = filename, lnum = 3, text = ' x = math.max(a, 2),' } }, - title = 'Type definition', - } - opts.on_list(data) -end - -vim.lsp.buf.workspace_symbol = function(query, opts) - table.insert(_G.lsp_buf_calls, 'workspace_symbol') - _G.workspace_symbol_query = query - local data = { - context = make_context('textDocument/workspaceSymbol'), - items = { - { col = 7, filename = filename, kind = 'Number', lnum = 1, text = '[Number] a' }, - { col = 7, filename = filename, kind = 'Object', lnum = 2, text = '[Object] t' }, - { col = 3, filename = filename, kind = 'Variable', lnum = 3, text = '[Variable] x' }, - { col = 3, filename = filename, kind = 'Variable', lnum = 4, text = '[Variable] y' }, - }, - title = "Symbols matching ''", - } - opts.on_list(data) -end diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/spawn.lua b/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/spawn.lua deleted file mode 100644 index dfd41b41..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/mocks/spawn.lua +++ /dev/null @@ -1,55 +0,0 @@ -_G.process_log = {} - -local n_pid, n_stream = 0, 0 -local new_process = function(pid) - return { - pid = pid, - close = function(_) table.insert(_G.process_log, 'Process ' .. pid .. ' was closed.') end, - } -end - --- Mock streams by using global `_G.stdout_data_feed` and `_G.stderr_data_feed` --- arrays as source. Each feed's element should be either string (for usable --- data) or a table with `err` field (for error). -local stream_counts = {} -vim.loop.new_pipe = function() - -- NOTE: Use `_G.stream_type_queue` to determine which stream type to create - -- (for log purposes). This is to account for `vim.loop.spawn` creating - -- different sets of streams. Assume 'stdout' by default. - if _G.stream_type_queue == nil or #_G.stream_type_queue == 0 then _G.stream_type_queue = { 'stdout' } end - local stream_type = _G.stream_type_queue[1] - table.remove(_G.stream_type_queue, 1) - - local new_count = (stream_counts[stream_type] or 0) + 1 - stream_counts[stream_type] = new_count - local cur_stream_id = stream_type .. '_' .. new_count - - return { - read_start = function(_, callback) - -- It is not possible in Neovim<=0.9 to execute `vim.fn` functions during - -- `pipe:read_start()` - local data_feed = stream_type == 'stdout' and _G.stdout_data_feed or _G.stderr_data_feed - for _, x in ipairs(data_feed or {}) do - if type(x) == 'table' then callback(x.err, nil) end - if type(x) == 'string' then callback(nil, x) end - end - callback(nil, nil) - end, - close = function() table.insert(_G.process_log, string.format('%s was closed.', cur_stream_id)) end, - } -end - -_G.spawn_log = {} -vim.loop.spawn = function(path, options, on_exit) - local options_without_callables = vim.deepcopy(options) - options_without_callables.stdio = nil - table.insert(_G.spawn_log, { executable = path, options = options_without_callables }) - - vim.schedule(function() on_exit() end) - - n_pid = n_pid + 1 - local pid = 'Pid_' .. n_pid - return new_process(pid), pid -end - -vim.loop.process_kill = function(process) table.insert(_G.process_log, 'Process ' .. process.pid .. ' was killed.') end diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/real-files/LICENSE b/config/neovim/store/lazy-plugins/rustaceanvim/lua/real-files/LICENSE deleted file mode 100644 index ac3dbebb..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/real-files/LICENSE +++ /dev/null @@ -1 +0,0 @@ -MIT (c) diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/real-files/Makefile b/config/neovim/store/lazy-plugins/rustaceanvim/lua/real-files/Makefile deleted file mode 100644 index eeecfe5c..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/real-files/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -VAR ?= 1 - -all: test diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/real-files/a.lua b/config/neovim/store/lazy-plugins/rustaceanvim/lua/real-files/a.lua deleted file mode 100644 index 442d2203..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/real-files/a.lua +++ /dev/null @@ -1,5 +0,0 @@ -local a = 1 -local t = { - x = math.max(a, 2), - y = math.min(a, 2), -} diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/real-files/b.txt b/config/neovim/store/lazy-plugins/rustaceanvim/lua/real-files/b.txt deleted file mode 100644 index ae951ea8..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/real-files/b.txt +++ /dev/null @@ -1,26 +0,0 @@ -Line 1 -Line 2 -Line 3 -Line 4 -Line 5 -Line 6 -Line 7 -Line 8 -Line 9 -Line 10 -Line 11 -Line 12 -Line 13 -Line 14 -Line 15 -Line 16 -Line 17 -Line 18 -Line 19 -Line 20 -Line 21 -Line 22 -Line 23 -Line 24 -Line 25 -Line 26 diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/real-files/c.gif b/config/neovim/store/lazy-plugins/rustaceanvim/lua/real-files/c.gif deleted file mode 100644 index ccdd7b74..00000000 Binary files a/config/neovim/store/lazy-plugins/rustaceanvim/lua/real-files/c.gif and /dev/null differ diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/Dir2/file2-1 b/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/Dir2/file2-1 deleted file mode 100644 index e69de29b..00000000 diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/cargo.lua b/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/cargo.lua index f8ef7130..f12d130d 100644 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/cargo.lua +++ b/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/cargo.lua @@ -27,13 +27,29 @@ local function get_mb_active_client_root(file_name) end end +---Attempts to find the root for an existing active client. If no existing +---client root is found, returns the result of evaluating `config.root_dir`. +---@param config RustaceanLspClientConfig ---@param file_name string ---@return string | nil root_dir -function cargo.get_root_dir(file_name) +function cargo.get_config_root_dir(config, file_name) local reuse_active = get_mb_active_client_root(file_name) if reuse_active then return reuse_active end + + local config_root_dir = config.root_dir + if type(config_root_dir) == 'function' then + return config_root_dir(file_name, cargo.get_root_dir) + else + return config_root_dir + end +end + +---The default implementation used for `vim.g.rustaceanvim.server.root_dir` +---@param file_name string +---@return string | nil root_dir +function cargo.get_root_dir(file_name) local path = file_name:find('%.rs$') and vim.fs.dirname(file_name) or file_name if not path then return nil diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/config/check.lua b/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/config/check.lua index 41910d83..cd5aa025 100644 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/config/check.lua +++ b/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/config/check.lua @@ -89,6 +89,7 @@ function M.validate(cfg) cmd = { server.cmd, { 'function', 'table' } }, standalone = { server.standalone, 'boolean' }, settings = { server.settings, { 'function', 'table' }, true }, + root_dir = { server.root_dir, { 'function', 'string' } }, }) if not ok then return false, err diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/config/init.lua b/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/config/init.lua index 124a404a..5b2fe2c7 100644 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/config/init.lua +++ b/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/config/init.lua @@ -110,6 +110,7 @@ vim.g.rustaceanvim = vim.g.rustaceanvim ---@class RustaceanLspClientOpts ---@field auto_attach? boolean | fun(bufnr: integer):boolean Whether to automatically attach the LSP client. Defaults to `true` if the `rust-analyzer` executable is found. ---@field cmd? string[] | fun():string[] Command and arguments for starting rust-analyzer +---@field root_dir? string | fun(filename: string, default: fun(filename: string):string|nil):string|nil The directory to use for the attached LSP. Can be a function, which may return nil if no server should attach. The second argument contains the default implementation, which can be used for fallback behavior. ---@field settings? table | fun(project_root:string|nil, default_settings: table):table Setting passed to rust-analyzer. Defaults to a function that looks for a `rust-analyzer.json` file or returns an empty table. See https://rust-analyzer.github.io/manual.html#configuration. ---@field standalone? boolean Standalone file support (enabled by default). Disabling it may improve rust-analyzer's startup time. ---@field logfile? string The path to the rust-analyzer log file. diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/config/internal.lua b/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/config/internal.lua index 6f9cf45a..8f68710d 100644 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/config/internal.lua +++ b/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/config/internal.lua @@ -1,4 +1,5 @@ local types = require('rustaceanvim.types.internal') +local cargo = require('rustaceanvim.cargo') local compat = require('rustaceanvim.compat') local config = require('rustaceanvim.config') local executors = require('rustaceanvim.executors') @@ -275,6 +276,10 @@ local RustaceanDefaultConfig = { cmd = function() return { 'rust-analyzer', '--log-file', RustaceanConfig.server.logfile } end, + + ---@type string | fun(filename: string, default: fun(filename: string):string|nil):string|nil + root_dir = cargo.get_root_dir, + --- standalone file support --- setting it to false may improve startup time ---@type boolean diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/dir1/file1-1 b/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/dir1/file1-1 deleted file mode 100644 index a6371918..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/dir1/file1-1 +++ /dev/null @@ -1 +0,0 @@ -File 1-1 diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/dir1/subdir/file1-1-1 b/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/dir1/subdir/file1-1-1 deleted file mode 100644 index 1687dac5..00000000 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/dir1/subdir/file1-1-1 +++ /dev/null @@ -1 +0,0 @@ -File 1-1-1 diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/dir3/file3-1 b/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/dir3/file3-1 deleted file mode 100644 index e69de29b..00000000 diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/lsp.lua b/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/lsp.lua index 1efa5daa..00c73b91 100644 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/lsp.lua +++ b/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/lsp.lua @@ -95,7 +95,7 @@ M.start = function(bufnr) local client_config = config.server ---@type LspStartConfig local lsp_start_config = vim.tbl_deep_extend('force', {}, client_config) - local root_dir = cargo.get_root_dir(bufname) + local root_dir = cargo.get_config_root_dir(client_config, bufname) if not root_dir then --- No project root found. Start in detached/standalone mode. root_dir = vim.fs.dirname(bufname) diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/neotest/init.lua b/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/neotest/init.lua index 9eb7cbae..7921cd3c 100644 --- a/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/neotest/init.lua +++ b/config/neovim/store/lazy-plugins/rustaceanvim/lua/rustaceanvim/neotest/init.lua @@ -27,12 +27,13 @@ ---@diagnostic disable: duplicate-set-field +local cargo = require('rustaceanvim.cargo') +local compat = require('rustaceanvim.compat') +local config = require('rustaceanvim.config.internal') local lib = require('neotest.lib') local nio = require('nio') -local trans = require('rustaceanvim.neotest.trans') -local cargo = require('rustaceanvim.cargo') local overrides = require('rustaceanvim.overrides') -local compat = require('rustaceanvim.compat') +local trans = require('rustaceanvim.neotest.trans') ---@package ---@type neotest.Adapter @@ -42,7 +43,7 @@ local NeotestAdapter = { name = 'rustaceanvim' } ---@param file_name string ---@return string | nil NeotestAdapter.root = function(file_name) - return cargo.get_root_dir(file_name) + return cargo.get_config_root_dir(config.server, file_name) end ---@package diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/rock_manifest b/config/neovim/store/lazy-plugins/rustaceanvim/rock_manifest index e04f0495..12d04fbd 100644 --- a/config/neovim/store/lazy-plugins/rustaceanvim/rock_manifest +++ b/config/neovim/store/lazy-plugins/rustaceanvim/rock_manifest @@ -1,17 +1,17 @@ rock_manifest = { doc = { ["mason.txt"] = "858adffa88b1649b91187f49f191e376", - ["rustaceanvim.txt"] = "0bb03192be9a68d7b6c73e8414b01625" + ["rustaceanvim.txt"] = "a9fa5fd997f2e2c099d2bf715cf4d5e9" }, ftplugin = { - ["rust.lua"] = "40f5f67ffb8f441a636ff231b7878ff8", + ["rust.lua"] = "b225026e3590a6741373922fbae423e5", ["rust.vim"] = "3121ffa3b7f1aa9c3efbfe32e438dbeb", ["toml.lua"] = "a8807dcfb5f6687ac543f4f8da3a9554" }, lua = { rustaceanvim = { ["cached_commands.lua"] = "6e23c8231f44a3edc76be54766fca334", - ["cargo.lua"] = "39415eb623c1376d5f2d5c717b8c0eb0", + ["cargo.lua"] = "43ba56ed4ba112dd22cac598e7b248df", commands = { ["code_action_group.lua"] = "55bf0c83a007e5d64924eafe2e2a96eb", ["crate_graph.lua"] = "30d01abc92dff63ace83a5d1697d2073", @@ -36,9 +36,9 @@ rock_manifest = { }, ["compat.lua"] = "fedaef1aeaceaf086116ed62b423d0a3", config = { - ["check.lua"] = "8a68a6e78ea97ab59ea0be83bff7ffc7", - ["init.lua"] = "f2ef97efc1f563c06932d51006e5b7cc", - ["internal.lua"] = "319f08833432f1ec7b04d4432737a1f0", + ["check.lua"] = "55ddc99999546e6951cd2641cc997af2", + ["init.lua"] = "a583a64ac0023a551c16a92f61ff063d", + ["internal.lua"] = "854115363fcfc13e65098150b873a8ff", ["json.lua"] = "a8c7caf443ad9ce1193726aec053cc8d", ["server.lua"] = "d642a65f31cb4f12b812840c1171821f" }, @@ -56,9 +56,9 @@ rock_manifest = { ["health.lua"] = "126952700269c9ab976f29f59604c5da", ["hover_actions.lua"] = "d0842822fa99c55b4cc5a65eae968ff2", ["init.lua"] = "a48de2e7e937208adc6781a5ea35ec88", - ["lsp.lua"] = "f26e69489b384870c2774703599bf1bb", + ["lsp.lua"] = "c36e5b79bb7fb41a9781d70421f7a55c", neotest = { - ["init.lua"] = "10bfd8f06b7ad2de8d706c2e26505ae7", + ["init.lua"] = "ec54c5df5002742877ec6c925b273b2d", ["trans.lua"] = "1f79320bca0c81d91673543dd7ad4984" }, ["os.lua"] = "4c8caca1afb6a8e7862300b4dcc29f09", diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/manifest b/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/manifest similarity index 100% rename from config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/manifest rename to config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/manifest diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/rustaceanvim/4.22.8-1/doc/mason.txt b/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/rustaceanvim/4.22.8-1/doc/mason.txt similarity index 100% rename from config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/rustaceanvim/4.22.8-1/doc/mason.txt rename to config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/rustaceanvim/4.22.8-1/doc/mason.txt diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/rustaceanvim/4.22.8-1/doc/rustaceanvim.txt b/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/rustaceanvim/4.22.8-1/doc/rustaceanvim.txt similarity index 93% rename from config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/rustaceanvim/4.22.8-1/doc/rustaceanvim.txt rename to config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/rustaceanvim/4.22.8-1/doc/rustaceanvim.txt index 9da43f53..6e6234c3 100644 --- a/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/rustaceanvim/4.22.8-1/doc/rustaceanvim.txt +++ b/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/rustaceanvim/4.22.8-1/doc/rustaceanvim.txt @@ -234,12 +234,13 @@ RustcOpts *RustcOpts* RustaceanLspClientOpts *RustaceanLspClientOpts* Fields: ~ - {auto_attach?} (boolean|fun(bufnr:integer):boolean) Whether to automatically attach the LSP client. Defaults to `true` if the `rust-analyzer` executable is found. - {cmd?} (string[]|fun():string[]) Command and arguments for starting rust-analyzer - {settings?} (table|fun(project_root:string|nil,default_settings:table):table) Setting passed to rust-analyzer. Defaults to a function that looks for a `rust-analyzer.json` file or returns an empty table. See https://rust-analyzer.github.io/manual.html#configuration. - {standalone?} (boolean) Standalone file support (enabled by default). Disabling it may improve rust-analyzer's startup time. - {logfile?} (string) The path to the rust-analyzer log file. - {load_vscode_settings?} (boolean) Whether to search (upward from the buffer) for rust-analyzer settings in .vscode/settings json. If found, loaded settings will override configured options. Default: false + {auto_attach?} (boolean|fun(bufnr:integer):boolean) Whether to automatically attach the LSP client. Defaults to `true` if the `rust-analyzer` executable is found. + {cmd?} (string[]|fun():string[]) Command and arguments for starting rust-analyzer + {root_dir?} (string|fun(filename:string,default:fun(filename:string):string|nil):string|nil) The directory to use for the attached LSP. Can be a function, which may return nil if no server should attach. The second argument contains the default implementation, which can be used for fallback behavior. + {settings?} (table|fun(project_root:string|nil,default_settings:table):table) Setting passed to rust-analyzer. Defaults to a function that looks for a `rust-analyzer.json` file or returns an empty table. See https://rust-analyzer.github.io/manual.html#configuration. + {standalone?} (boolean) Standalone file support (enabled by default). Disabling it may improve rust-analyzer's startup time. + {logfile?} (string) The path to the rust-analyzer log file. + {load_vscode_settings?} (boolean) Whether to search (upward from the buffer) for rust-analyzer settings in .vscode/settings json. If found, loaded settings will override configured options. Default: false RustaceanDapOpts *RustaceanDapOpts* diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/rustaceanvim/4.22.8-1/ftplugin/rust.lua b/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/rustaceanvim/4.22.8-1/ftplugin/rust.lua similarity index 85% rename from config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/rustaceanvim/4.22.8-1/ftplugin/rust.lua rename to config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/rustaceanvim/4.22.8-1/ftplugin/rust.lua index 786e1309..11661084 100644 --- a/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/rustaceanvim/4.22.8-1/ftplugin/rust.lua +++ b/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/rustaceanvim/4.22.8-1/ftplugin/rust.lua @@ -46,19 +46,12 @@ end vim.g.loaded_rustaceanvim = true -local bufnr = vim.api.nvim_get_current_buf() local auto_attach = config.server.auto_attach if type(auto_attach) == 'function' then + local bufnr = vim.api.nvim_get_current_buf() auto_attach = auto_attach(bufnr) end if auto_attach then - -- Defer for a smoother experience on low-end devices - vim.api.nvim_create_autocmd('BufEnter', { - buffer = bufnr, - group = vim.api.nvim_create_augroup('RustaceanvimAttach', { clear = true }), - callback = function() - require('rustaceanvim.lsp').start() - end, - }) + require('rustaceanvim.lsp').start() end diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/rustaceanvim/4.22.8-1/ftplugin/rust.vim b/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/rustaceanvim/4.22.8-1/ftplugin/rust.vim similarity index 100% rename from config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/rustaceanvim/4.22.8-1/ftplugin/rust.vim rename to config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/rustaceanvim/4.22.8-1/ftplugin/rust.vim diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/rustaceanvim/4.22.8-1/ftplugin/toml.lua b/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/rustaceanvim/4.22.8-1/ftplugin/toml.lua similarity index 100% rename from config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/rustaceanvim/4.22.8-1/ftplugin/toml.lua rename to config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/rustaceanvim/4.22.8-1/ftplugin/toml.lua diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/rustaceanvim/4.22.8-1/rock_manifest b/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/rustaceanvim/4.22.8-1/rock_manifest similarity index 87% rename from config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/rustaceanvim/4.22.8-1/rock_manifest rename to config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/rustaceanvim/4.22.8-1/rock_manifest index e04f0495..12d04fbd 100644 --- a/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/rustaceanvim/4.22.8-1/rock_manifest +++ b/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/rustaceanvim/4.22.8-1/rock_manifest @@ -1,17 +1,17 @@ rock_manifest = { doc = { ["mason.txt"] = "858adffa88b1649b91187f49f191e376", - ["rustaceanvim.txt"] = "0bb03192be9a68d7b6c73e8414b01625" + ["rustaceanvim.txt"] = "a9fa5fd997f2e2c099d2bf715cf4d5e9" }, ftplugin = { - ["rust.lua"] = "40f5f67ffb8f441a636ff231b7878ff8", + ["rust.lua"] = "b225026e3590a6741373922fbae423e5", ["rust.vim"] = "3121ffa3b7f1aa9c3efbfe32e438dbeb", ["toml.lua"] = "a8807dcfb5f6687ac543f4f8da3a9554" }, lua = { rustaceanvim = { ["cached_commands.lua"] = "6e23c8231f44a3edc76be54766fca334", - ["cargo.lua"] = "39415eb623c1376d5f2d5c717b8c0eb0", + ["cargo.lua"] = "43ba56ed4ba112dd22cac598e7b248df", commands = { ["code_action_group.lua"] = "55bf0c83a007e5d64924eafe2e2a96eb", ["crate_graph.lua"] = "30d01abc92dff63ace83a5d1697d2073", @@ -36,9 +36,9 @@ rock_manifest = { }, ["compat.lua"] = "fedaef1aeaceaf086116ed62b423d0a3", config = { - ["check.lua"] = "8a68a6e78ea97ab59ea0be83bff7ffc7", - ["init.lua"] = "f2ef97efc1f563c06932d51006e5b7cc", - ["internal.lua"] = "319f08833432f1ec7b04d4432737a1f0", + ["check.lua"] = "55ddc99999546e6951cd2641cc997af2", + ["init.lua"] = "a583a64ac0023a551c16a92f61ff063d", + ["internal.lua"] = "854115363fcfc13e65098150b873a8ff", ["json.lua"] = "a8c7caf443ad9ce1193726aec053cc8d", ["server.lua"] = "d642a65f31cb4f12b812840c1171821f" }, @@ -56,9 +56,9 @@ rock_manifest = { ["health.lua"] = "126952700269c9ab976f29f59604c5da", ["hover_actions.lua"] = "d0842822fa99c55b4cc5a65eae968ff2", ["init.lua"] = "a48de2e7e937208adc6781a5ea35ec88", - ["lsp.lua"] = "f26e69489b384870c2774703599bf1bb", + ["lsp.lua"] = "c36e5b79bb7fb41a9781d70421f7a55c", neotest = { - ["init.lua"] = "10bfd8f06b7ad2de8d706c2e26505ae7", + ["init.lua"] = "ec54c5df5002742877ec6c925b273b2d", ["trans.lua"] = "1f79320bca0c81d91673543dd7ad4984" }, ["os.lua"] = "4c8caca1afb6a8e7862300b4dcc29f09", diff --git a/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/rustaceanvim/4.22.8-1/rustaceanvim-4.22.8-1.rockspec b/config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/rustaceanvim/4.22.8-1/rustaceanvim-4.22.8-1.rockspec similarity index 100% rename from config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-24-rocks/rustaceanvim/4.22.8-1/rustaceanvim-4.22.8-1.rockspec rename to config/neovim/store/lazy-plugins/rustaceanvim/rustaceanvim-4.22.8-1-unstable-2024-05-27-rocks/rustaceanvim/4.22.8-1/rustaceanvim-4.22.8-1.rockspec diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/doc/tags b/config/neovim/store/lazy-plugins/telescope.nvim/doc/tags index 10539210..1d480f97 100644 --- a/config/neovim/store/lazy-plugins/telescope.nvim/doc/tags +++ b/config/neovim/store/lazy-plugins/telescope.nvim/doc/tags @@ -53,6 +53,9 @@ telescope.actions.history.History:new() telescope.txt /*telescope.actions.histor telescope.actions.history.History:reset() telescope.txt /*telescope.actions.history.History:reset()* telescope.actions.history.get_simple_history() telescope.txt /*telescope.actions.history.get_simple_history()* telescope.actions.history.new() telescope.txt /*telescope.actions.history.new()* +telescope.actions.insert_original_cWORD() telescope.txt /*telescope.actions.insert_original_cWORD()* +telescope.actions.insert_original_cfile() telescope.txt /*telescope.actions.insert_original_cfile()* +telescope.actions.insert_original_cline() telescope.txt /*telescope.actions.insert_original_cline()* telescope.actions.insert_original_cword() telescope.txt /*telescope.actions.insert_original_cword()* telescope.actions.insert_symbol() telescope.txt /*telescope.actions.insert_symbol()* telescope.actions.insert_symbol_i() telescope.txt /*telescope.actions.insert_symbol_i()* diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/doc/telescope.txt b/config/neovim/store/lazy-plugins/telescope.nvim/doc/telescope.txt index f63162d6..a38a88f8 100644 --- a/config/neovim/store/lazy-plugins/telescope.nvim/doc/telescope.txt +++ b/config/neovim/store/lazy-plugins/telescope.nvim/doc/telescope.txt @@ -3393,6 +3393,30 @@ actions.insert_original_cword({prompt_bufnr}) *telescope.actions.insert_original {prompt_bufnr} (number) The prompt bufnr +actions.insert_original_cWORD({prompt_bufnr}) *telescope.actions.insert_original_cWORD()* + Insert the WORD under the cursor of the original (pre-Telescope) window + + + Parameters: ~ + {prompt_bufnr} (number) The prompt bufnr + + +actions.insert_original_cfile({prompt_bufnr}) *telescope.actions.insert_original_cfile()* + Insert the file under the cursor of the original (pre-Telescope) window + + + Parameters: ~ + {prompt_bufnr} (number) The prompt bufnr + + +actions.insert_original_cline({prompt_bufnr}) *telescope.actions.insert_original_cline()* + Insert the line under the cursor of the original (pre-Telescope) window + + + Parameters: ~ + {prompt_bufnr} (number) The prompt bufnr + + ================================================================================ ACTIONS_STATE *telescope.actions.state* diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/actions/init.lua b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/actions/init.lua index c8bef1d0..3daaefd2 100644 --- a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/actions/init.lua +++ b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/actions/init.lua @@ -1496,6 +1496,27 @@ actions.insert_original_cword = function(prompt_bufnr) current_picker:set_prompt(current_picker.original_cword, false) end +--- Insert the WORD under the cursor of the original (pre-Telescope) window +---@param prompt_bufnr number: The prompt bufnr +actions.insert_original_cWORD = function(prompt_bufnr) + local current_picker = action_state.get_current_picker(prompt_bufnr) + current_picker:set_prompt(current_picker.original_cWORD, false) +end + +--- Insert the file under the cursor of the original (pre-Telescope) window +---@param prompt_bufnr number: The prompt bufnr +actions.insert_original_cfile = function(prompt_bufnr) + local current_picker = action_state.get_current_picker(prompt_bufnr) + current_picker:set_prompt(current_picker.original_cfile, false) +end + +--- Insert the line under the cursor of the original (pre-Telescope) window +---@param prompt_bufnr number: The prompt bufnr +actions.insert_original_cline = function(prompt_bufnr) + local current_picker = action_state.get_current_picker(prompt_bufnr) + current_picker:set_prompt(current_picker.original_cline, false) +end + actions.nop = function(_) end actions.mouse_click = function(prompt_bufnr) diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/builtin/__diagnostics.lua b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/builtin/__diagnostics.lua index e55a130c..ec129d63 100644 --- a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/builtin/__diagnostics.lua +++ b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/builtin/__diagnostics.lua @@ -132,12 +132,12 @@ diagnostics.get = function(opts) if opts.bufnr ~= 0 then opts.bufnr = nil end - if opts.bufnr == nil then - opts.path_display = vim.F.if_nil(opts.path_display, {}) - end if type(opts.bufnr) == "string" then opts.bufnr = tonumber(opts.bufnr) end + if opts.bufnr ~= nil then + opts.path_display = vim.F.if_nil(opts.path_display, "hidden") + end local locations = diagnostics_to_tbl(opts) @@ -157,7 +157,6 @@ diagnostics.get = function(opts) return end - opts.path_display = vim.F.if_nil(opts.path_display, "hidden") pickers .new(opts, { prompt_title = opts.bufnr == nil and "Workspace Diagnostics" or "Document Diagnostics", diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/builtin/__internal.lua b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/builtin/__internal.lua index 22c9c659..8fa988b9 100644 --- a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/builtin/__internal.lua +++ b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/builtin/__internal.lua @@ -531,7 +531,7 @@ internal.oldfiles = function(opts) local results = {} if opts.include_current_session then - for _, buffer in ipairs(vim.split(vim.fn.execute ":buffers! t", "\n")) do + for _, buffer in ipairs(utils.split_lines(vim.fn.execute ":buffers! t")) do local match = tonumber(string.match(buffer, "%s*(%d+)")) local open_by_lsp = string.match(buffer, "line 0$") if match and not open_by_lsp then @@ -574,7 +574,7 @@ end internal.command_history = function(opts) local history_string = vim.fn.execute "history cmd" - local history_list = vim.split(history_string, "\n") + local history_list = utils.split_lines(history_string) local results = {} local filter_fn = opts.filter_fn @@ -614,7 +614,7 @@ end internal.search_history = function(opts) local search_string = vim.fn.execute "history search" - local search_list = vim.split(search_string, "\n") + local search_list = utils.split_lines(search_string) local results = {} for i = #search_list, 3, -1 do @@ -690,7 +690,7 @@ internal.help_tags = function(opts) opts.fallback = vim.F.if_nil(opts.fallback, true) opts.file_ignore_patterns = {} - local langs = vim.split(opts.lang, ",", true) + local langs = vim.split(opts.lang, ",", { trimempty = true }) if opts.fallback and not vim.tbl_contains(langs, "en") then table.insert(langs, "en") end @@ -729,11 +729,11 @@ internal.help_tags = function(opts) local delimiter = string.char(9) for _, lang in ipairs(langs) do for _, file in ipairs(tag_files[lang] or {}) do - local lines = vim.split(Path:new(file):read(), "\n", true) + local lines = utils.split_lines(Path:new(file):read(), { trimempty = true }) for _, line in ipairs(lines) do -- TODO: also ignore tagComment starting with ';' if not line:match "^!_TAG_" then - local fields = vim.split(line, delimiter, true) + local fields = vim.split(line, delimiter, { trimempty = true }) if #fields == 3 and not tags_map[fields[1]] then if fields[1] ~= "help-tags" or fields[2] ~= "tags" then table.insert(tags, { diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/make_entry.lua b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/make_entry.lua index cf0a1a44..a1806f37 100644 --- a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/make_entry.lua +++ b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/make_entry.lua @@ -184,7 +184,7 @@ do if k == "path" then local retpath = Path:new({ t.cwd, t.value }):absolute() - if not vim.loop.fs_access(retpath, "R", nil) then + if not vim.loop.fs_access(retpath, "R") then retpath = t.value end return retpath @@ -540,8 +540,14 @@ function make_entry.gen_from_lsp_symbols(opts) msg, } else + local display_path, path_style = utils.transform_path(opts, entry.filename) return displayer { - utils.transform_path(opts, entry.filename), + { + display_path, + function() + return path_style + end, + }, entry.symbol_name, { entry.symbol_type:lower(), type_highlight[entry.symbol_type] }, msg, @@ -1043,7 +1049,7 @@ function make_entry.gen_from_ctags(opts) } local make_display = function(entry) - local filename = utils.transform_path(opts, entry.filename) + local display_path, path_style = utils.transform_path(opts, entry.filename) local scode if opts.show_line then @@ -1057,7 +1063,12 @@ function make_entry.gen_from_ctags(opts) } else return displayer { - filename, + { + display_path, + function() + return path_style + end, + }, entry.tag, scode, } @@ -1073,7 +1084,7 @@ function make_entry.gen_from_ctags(opts) if k == "path" then local retpath = Path:new({ t.filename }):absolute() - if not vim.loop.fs_access(retpath, "R", nil) then + if not vim.loop.fs_access(retpath, "R") then retpath = t.filename end return retpath @@ -1174,7 +1185,7 @@ function make_entry.gen_from_diagnostics(opts) } local make_display = function(entry) - local filename = utils.transform_path(opts, entry.filename) + local display_path, path_style = utils.transform_path(opts, entry.filename) -- add styling of entries local pos = string.format("%4d:%2d", entry.lnum, entry.col) @@ -1187,7 +1198,12 @@ function make_entry.gen_from_diagnostics(opts) return displayer { line_info, entry.text, - filename, + { + display_path, + function() + return path_style + end, + }, } end @@ -1345,11 +1361,18 @@ function make_entry.gen_from_git_status(opts) local status_x = git_abbrev[x] or {} local status_y = git_abbrev[y] or {} + local display_path, path_style = utils.transform_path(opts, entry.path) + local empty_space = " " return displayer { { status_x.icon or empty_space, status_x.hl }, { status_y.icon or empty_space, status_y.hl }, - utils.transform_path(opts, entry.path), + { + display_path, + function() + return path_style + end, + }, } end diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/mappings.lua b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/mappings.lua index 90a48126..287cac9f 100644 --- a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/mappings.lua +++ b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/mappings.lua @@ -176,6 +176,9 @@ mappings.default_mappings = config.values.default_mappings [""] = actions.which_key, -- keys from pressing [""] = { "", type = "command" }, [""] = actions.insert_original_cword, + [""] = actions.insert_original_cWORD, + [""] = actions.insert_original_cfile, + [""] = actions.insert_original_cline, -- disable c-j because we dont want to allow new lines #2123 [""] = actions.nop, diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/pickers.lua b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/pickers.lua index 88e89cc9..189e923d 100644 --- a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/pickers.lua +++ b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/pickers.lua @@ -537,6 +537,10 @@ function Picker:find() self.original_win_id = a.nvim_get_current_win() _, self.original_cword = pcall(vim.fn.expand, "") + _, self.original_cWORD = pcall(vim.fn.expand, "") + _, self.original_cfile = pcall(vim.fn.expand, "") + _, self.original_cline = pcall(vim.api.nvim_get_current_line) + _, self.original_cline = pcall(vim.trim, self.original_cline) -- User autocmd run it before create Telescope window vim.api.nvim_exec_autocmds("User", { pattern = "TelescopeFindPre" }) diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/previewers/buffer_previewer.lua b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/previewers/buffer_previewer.lua index a404c14c..72854e41 100644 --- a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/previewers/buffer_previewer.lua +++ b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/previewers/buffer_previewer.lua @@ -1090,7 +1090,7 @@ previewers.highlights = defaulter(function(_) define_preview = function(self, entry) if not self.state.bufname then - local output = vim.split(vim.fn.execute "highlight", "\n") + local output = utils.split_lines(vim.fn.execute "highlight") local hl_groups = {} for _, v in ipairs(output) do if v ~= "" then diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/previewers/utils.lua b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/previewers/utils.lua index 076bab43..b430e5a5 100644 --- a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/previewers/utils.lua +++ b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/previewers/utils.lua @@ -5,12 +5,14 @@ local conf = require("telescope.config").values local Job = require "plenary.job" local Path = require "plenary.path" +local telescope_utils = require "telescope.utils" + local utils = {} local detect_from_shebang = function(p) local s = p:readbyterange(0, 256) if s then - local lines = vim.split(s, "\n") + local lines = telescope_utils.split_lines(s) return vim.filetype.match { contents = lines } end end @@ -24,7 +26,7 @@ end local detect_from_modeline = function(p) local s = p:readbyterange(-256, 256) if s then - local lines = vim.split(s, "\n") + local lines = telescope_utils.split_lines(s) local idx = lines[#lines] ~= "" and #lines or #lines - 1 if idx >= 1 then return parse_modeline(lines[idx]) diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/utils.lua b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/utils.lua index c2ee27f2..ff13132d 100644 --- a/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/utils.lua +++ b/config/neovim/store/lazy-plugins/telescope.nvim/lua/telescope/utils.lua @@ -216,13 +216,25 @@ end)() utils.path_tail = (function() local os_sep = utils.get_separator() - return function(path) - for i = #path, 1, -1 do - if path:sub(i, i) == os_sep then - return path:sub(i + 1, -1) + if os_sep == "/" then + return function(path) + for i = #path, 1, -1 do + if path:sub(i, i) == os_sep then + return path:sub(i + 1, -1) + end end + return path + end + else + return function(path) + for i = #path, 1, -1 do + local c = path:sub(i, i) + if c == os_sep or c == "/" then + return path:sub(i + 1, -1) + end + end + return path end - return path end end)() @@ -727,4 +739,16 @@ utils.reverse_table = function(input_table) return temp_table end +utils.split_lines = (function() + if utils.iswin then + return function(s, opts) + return vim.split(s, "\r?\n", opts) + end + else + return function(s, opts) + return vim.split(s, "\n", opts) + end + end +end)() + return utils diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/lua/tests/automated/utils_spec.lua b/config/neovim/store/lazy-plugins/telescope.nvim/lua/tests/automated/utils_spec.lua index 51c35266..b99a665c 100644 --- a/config/neovim/store/lazy-plugins/telescope.nvim/lua/tests/automated/utils_spec.lua +++ b/config/neovim/store/lazy-plugins/telescope.nvim/lua/tests/automated/utils_spec.lua @@ -307,3 +307,87 @@ describe("transform_path", function() end, new_relpath "doc/mydoc.md", new_relpath "d/mydoc.md") end) end) + +describe("path_tail", function() + local function assert_tails(paths) + for _, path in ipairs(paths) do + it("gets the tail of " .. path, function() + local tail = vim.fn.fnamemodify(path, ":p:t") + eq(tail, utils.path_tail(path)) + end) + end + end + + if jit and jit.os:lower() == "windows" then + describe("handles windows paths", function() + local paths = { + [[C:\Users\username\AppData\Local\nvim-data\log]], + [[D:\Projects\project_folder\source_code.py]], + [[E:\Music\song.mp3]], + [[/home/usuario/documents/archivo.txt]], + [[/var/www/html/index.html]], + [[/mnt/backup/backup_file.tar.gz]], + } + + assert_tails(paths) + end) + elseif jit and jit.os:lower() == "linux" then + describe("handles linux paths", function() + local paths = { + [[/home/usuario/documents/archivo.txt]], + [[/var/www/html/index.html]], + [[/mnt/backup/backup_file.tar.gz]], + } + + assert_tails(paths) + end) + elseif jit and jit.os:lower() == "osx" then + describe("handles macos paths", function() + local paths = { + [[/Users/Usuario/Documents/archivo.txt]], + [[/Applications/App.app/Contents/MacOS/app_executable]], + [[/Volumes/ExternalDrive/Data/file.xlsx]], + } + + assert_tails(paths) + end) + end +end) + +describe("split_lines", function() + local expect = { + "", + "", + "line3 of the file", + "", + "line5 of the file", + "", + "", + "line8 of the file, last line of file", + "", + } + + local function get_fake_file(line_ending) + return table.concat(expect, line_ending) + end + + local newline_file = get_fake_file "\n" + local carriage_newline_file = get_fake_file "\r\n" + + if utils.iswin then + describe("handles files on Windows", function() + it("reads file with newline only", function() + assert.are.same(expect, utils.split_lines(newline_file)) + end) + it("reads file with carriage return and newline", function() + assert.are.same(expect, utils.split_lines(carriage_newline_file)) + end) + end) + else + describe("handles files on non Windows environment", function() + it("reads file with newline only", function() + assert.are.same(expect, utils.split_lines(newline_file)) + end) + end) + end +end) diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/rock_manifest b/config/neovim/store/lazy-plugins/telescope.nvim/rock_manifest index 52662f77..f9ea896a 100644 --- a/config/neovim/store/lazy-plugins/telescope.nvim/rock_manifest +++ b/config/neovim/store/lazy-plugins/telescope.nvim/rock_manifest @@ -22,7 +22,7 @@ rock_manifest = { }, doc = { ["secret.txt"] = "59f2d5cd8b01a044b4e7f598244869ec", - ["telescope.txt"] = "190706f7b21d86c8809b8b0d946d8aec", + ["telescope.txt"] = "7216a8bf6e20d1fffcd8a31b127219c7", ["telescope_changelog.txt"] = "5c807cb49d45799276be85c33693c08f" }, ftplugin = { @@ -38,7 +38,7 @@ rock_manifest = { actions = { ["generate.lua"] = "b627dbab3b7d2a572779707529331a5f", ["history.lua"] = "6b34c6a357dfad0762f099c1ba3b426f", - ["init.lua"] = "0d6ea5eaeb361e6298663fbf0ea52206", + ["init.lua"] = "40eb8512d6b1f07e26043e3489dcf94d", ["layout.lua"] = "91470edb5dd37a3025e141d5cc6691bd", ["mt.lua"] = "9c22e387921dbfbd56afdf3fed7b84af", ["set.lua"] = "e0b8491c7e789e09c032e650d8c858ef", @@ -51,10 +51,10 @@ rock_manifest = { ["string_distance.lua"] = "1d63486c008b414586ec505b36c361a2" }, builtin = { - ["__diagnostics.lua"] = "f2edc0b78359facb94a2269bf28fb0a7", + ["__diagnostics.lua"] = "debd53606d5dee06bb2031026c7c3145", ["__files.lua"] = "d2c0373381ef70771adae4b6e9bb03ce", ["__git.lua"] = "a40e030790285c1e8706d181f0b4a831", - ["__internal.lua"] = "04bf667684de70d6c6d600ba7c40ee99", + ["__internal.lua"] = "89209cb8f9d22b8b6712243182f06c66", ["__lsp.lua"] = "03e5d78027aa37c04280151029744063", ["init.lua"] = "0e0188ef0f37c07387270ea8594c0f2e" }, @@ -76,8 +76,8 @@ rock_manifest = { ["health.lua"] = "885a0947d640b003eba0b9aac67f5a21", ["init.lua"] = "defe6eaf81f3596ccfafb9647afdac9f", ["log.lua"] = "5c57992c1ac7c17c2e5879d38921f819", - ["make_entry.lua"] = "ece9c42534f9296fb9873147fe53291c", - ["mappings.lua"] = "5cfd5f1aff126928f745439d5c61b12b", + ["make_entry.lua"] = "4fe6b147629c109e23c3962ba9cf2ba6", + ["mappings.lua"] = "aa736d661e2200619a98629ebb07f505", ["operators.lua"] = "e7244d086698dfaa71be2133820e57ee", pickers = { ["entry_display.lua"] = "27c74c2c4812244722444ebafbccd1ae", @@ -88,13 +88,13 @@ rock_manifest = { ["scroller.lua"] = "54fc7267917bf9f9076a632293a73cd5", ["window.lua"] = "fc74d7849a1381643289a65678e14aa3" }, - ["pickers.lua"] = "b72754962d52ff38ec5af1ba74d51d34", + ["pickers.lua"] = "2dd384f602a65ad2df4ac75ffc77bcfa", previewers = { - ["buffer_previewer.lua"] = "415436f46b3df7c247fbee9a466a4467", + ["buffer_previewer.lua"] = "544d3e3417a9c496277f3a8118141007", ["init.lua"] = "fa1745a8bef70d35f713d3c4b3c70257", ["previewer.lua"] = "3b02d1b4a9aeb5c6a79771709ca799cc", ["term_previewer.lua"] = "6d38b050b6bc564215113e7cb42bb42a", - ["utils.lua"] = "9d4808a9af4dca92c1fb6f5993185213" + ["utils.lua"] = "6aad15a9e8ec96ddb7576e0f3bd9bc48" }, ["sorters.lua"] = "bb1c9e687331d5cf0952582b2dadab7f", ["state.lua"] = "450c0b38c2497ae8c505a882257e0bed", @@ -104,7 +104,7 @@ rock_manifest = { ["runner.lua"] = "1201b1158848fc7e6a581f258776a977" }, ["themes.lua"] = "02e18c91826ee7834ffedc9378cbc9b9", - ["utils.lua"] = "a0d3abb98a237ada18f8a57421270af7" + ["utils.lua"] = "fe4d526b4086bc9e2f28b7c716eea000" }, tests = { automated = { @@ -121,7 +121,7 @@ rock_manifest = { ["scroller_spec.lua"] = "3595abe16efe6753888274f11f1818ad", ["sorters_spec.lua"] = "6a5c265752ac0ea6a07ef39d66518b8e", ["telescope_spec.lua"] = "573cee7dce62d9f8cd0d3592f784aade", - ["utils_spec.lua"] = "e246ecc4ce2e9676a16c0269cf770bcc" + ["utils_spec.lua"] = "48b3bda11ba9261ddc0b1c122adfbb44" }, fixtures = { find_files = { diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/manifest b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/manifest similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/manifest rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/manifest diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/autoload/health/telescope.vim b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/autoload/health/telescope.vim similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/autoload/health/telescope.vim rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/autoload/health/telescope.vim diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/earth b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/earth similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/earth rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/earth diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/jupiter b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/jupiter similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/jupiter rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/jupiter diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/mars b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/mars similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/mars rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/mars diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/mercury b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/mercury similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/mercury rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/mercury diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/moon b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/moon similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/moon rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/moon diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/neptune b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/neptune similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/neptune rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/neptune diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/pluto b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/pluto similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/pluto rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/pluto diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/saturn b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/saturn similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/saturn rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/saturn diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/uranus b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/uranus similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/uranus rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/uranus diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/venus b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/venus similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/data/memes/planets/venus rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/data/memes/planets/venus diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/doc/secret.txt b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/doc/secret.txt similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/doc/secret.txt rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/doc/secret.txt diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/doc/telescope.txt b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/doc/telescope.txt similarity index 99% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/doc/telescope.txt rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/doc/telescope.txt index f63162d6..a38a88f8 100644 --- a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/doc/telescope.txt +++ b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/doc/telescope.txt @@ -3393,6 +3393,30 @@ actions.insert_original_cword({prompt_bufnr}) *telescope.actions.insert_original {prompt_bufnr} (number) The prompt bufnr +actions.insert_original_cWORD({prompt_bufnr}) *telescope.actions.insert_original_cWORD()* + Insert the WORD under the cursor of the original (pre-Telescope) window + + + Parameters: ~ + {prompt_bufnr} (number) The prompt bufnr + + +actions.insert_original_cfile({prompt_bufnr}) *telescope.actions.insert_original_cfile()* + Insert the file under the cursor of the original (pre-Telescope) window + + + Parameters: ~ + {prompt_bufnr} (number) The prompt bufnr + + +actions.insert_original_cline({prompt_bufnr}) *telescope.actions.insert_original_cline()* + Insert the line under the cursor of the original (pre-Telescope) window + + + Parameters: ~ + {prompt_bufnr} (number) The prompt bufnr + + ================================================================================ ACTIONS_STATE *telescope.actions.state* diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/doc/telescope_changelog.txt b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/doc/telescope_changelog.txt similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/doc/telescope_changelog.txt rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/doc/telescope_changelog.txt diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/ftplugin/TelescopePrompt.lua b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/ftplugin/TelescopePrompt.lua similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/ftplugin/TelescopePrompt.lua rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/ftplugin/TelescopePrompt.lua diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/ftplugin/TelescopeResults.lua b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/ftplugin/TelescopeResults.lua similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/ftplugin/TelescopeResults.lua rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/ftplugin/TelescopeResults.lua diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/plugin/telescope.lua b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/plugin/telescope.lua similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/plugin/telescope.lua rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/plugin/telescope.lua diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/rock_manifest b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/rock_manifest similarity index 89% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/rock_manifest rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/rock_manifest index 52662f77..f9ea896a 100644 --- a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/rock_manifest +++ b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/rock_manifest @@ -22,7 +22,7 @@ rock_manifest = { }, doc = { ["secret.txt"] = "59f2d5cd8b01a044b4e7f598244869ec", - ["telescope.txt"] = "190706f7b21d86c8809b8b0d946d8aec", + ["telescope.txt"] = "7216a8bf6e20d1fffcd8a31b127219c7", ["telescope_changelog.txt"] = "5c807cb49d45799276be85c33693c08f" }, ftplugin = { @@ -38,7 +38,7 @@ rock_manifest = { actions = { ["generate.lua"] = "b627dbab3b7d2a572779707529331a5f", ["history.lua"] = "6b34c6a357dfad0762f099c1ba3b426f", - ["init.lua"] = "0d6ea5eaeb361e6298663fbf0ea52206", + ["init.lua"] = "40eb8512d6b1f07e26043e3489dcf94d", ["layout.lua"] = "91470edb5dd37a3025e141d5cc6691bd", ["mt.lua"] = "9c22e387921dbfbd56afdf3fed7b84af", ["set.lua"] = "e0b8491c7e789e09c032e650d8c858ef", @@ -51,10 +51,10 @@ rock_manifest = { ["string_distance.lua"] = "1d63486c008b414586ec505b36c361a2" }, builtin = { - ["__diagnostics.lua"] = "f2edc0b78359facb94a2269bf28fb0a7", + ["__diagnostics.lua"] = "debd53606d5dee06bb2031026c7c3145", ["__files.lua"] = "d2c0373381ef70771adae4b6e9bb03ce", ["__git.lua"] = "a40e030790285c1e8706d181f0b4a831", - ["__internal.lua"] = "04bf667684de70d6c6d600ba7c40ee99", + ["__internal.lua"] = "89209cb8f9d22b8b6712243182f06c66", ["__lsp.lua"] = "03e5d78027aa37c04280151029744063", ["init.lua"] = "0e0188ef0f37c07387270ea8594c0f2e" }, @@ -76,8 +76,8 @@ rock_manifest = { ["health.lua"] = "885a0947d640b003eba0b9aac67f5a21", ["init.lua"] = "defe6eaf81f3596ccfafb9647afdac9f", ["log.lua"] = "5c57992c1ac7c17c2e5879d38921f819", - ["make_entry.lua"] = "ece9c42534f9296fb9873147fe53291c", - ["mappings.lua"] = "5cfd5f1aff126928f745439d5c61b12b", + ["make_entry.lua"] = "4fe6b147629c109e23c3962ba9cf2ba6", + ["mappings.lua"] = "aa736d661e2200619a98629ebb07f505", ["operators.lua"] = "e7244d086698dfaa71be2133820e57ee", pickers = { ["entry_display.lua"] = "27c74c2c4812244722444ebafbccd1ae", @@ -88,13 +88,13 @@ rock_manifest = { ["scroller.lua"] = "54fc7267917bf9f9076a632293a73cd5", ["window.lua"] = "fc74d7849a1381643289a65678e14aa3" }, - ["pickers.lua"] = "b72754962d52ff38ec5af1ba74d51d34", + ["pickers.lua"] = "2dd384f602a65ad2df4ac75ffc77bcfa", previewers = { - ["buffer_previewer.lua"] = "415436f46b3df7c247fbee9a466a4467", + ["buffer_previewer.lua"] = "544d3e3417a9c496277f3a8118141007", ["init.lua"] = "fa1745a8bef70d35f713d3c4b3c70257", ["previewer.lua"] = "3b02d1b4a9aeb5c6a79771709ca799cc", ["term_previewer.lua"] = "6d38b050b6bc564215113e7cb42bb42a", - ["utils.lua"] = "9d4808a9af4dca92c1fb6f5993185213" + ["utils.lua"] = "6aad15a9e8ec96ddb7576e0f3bd9bc48" }, ["sorters.lua"] = "bb1c9e687331d5cf0952582b2dadab7f", ["state.lua"] = "450c0b38c2497ae8c505a882257e0bed", @@ -104,7 +104,7 @@ rock_manifest = { ["runner.lua"] = "1201b1158848fc7e6a581f258776a977" }, ["themes.lua"] = "02e18c91826ee7834ffedc9378cbc9b9", - ["utils.lua"] = "a0d3abb98a237ada18f8a57421270af7" + ["utils.lua"] = "fe4d526b4086bc9e2f28b7c716eea000" }, tests = { automated = { @@ -121,7 +121,7 @@ rock_manifest = { ["scroller_spec.lua"] = "3595abe16efe6753888274f11f1818ad", ["sorters_spec.lua"] = "6a5c265752ac0ea6a07ef39d66518b8e", ["telescope_spec.lua"] = "573cee7dce62d9f8cd0d3592f784aade", - ["utils_spec.lua"] = "e246ecc4ce2e9676a16c0269cf770bcc" + ["utils_spec.lua"] = "48b3bda11ba9261ddc0b1c122adfbb44" }, fixtures = { find_files = { diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/scripts/gendocs.lua b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/scripts/gendocs.lua similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/scripts/gendocs.lua rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/scripts/gendocs.lua diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/scripts/minimal_init.vim b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/scripts/minimal_init.vim similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/scripts/minimal_init.vim rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/scripts/minimal_init.vim diff --git a/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/telescope.nvim-scm-1.rockspec b/config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/telescope.nvim-scm-1.rockspec similarity index 100% rename from config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-25-rocks/telescope.nvim/scm-1/telescope.nvim-scm-1.rockspec rename to config/neovim/store/lazy-plugins/telescope.nvim/telescope.nvim-scm-1-unstable-2024-05-27-rocks/telescope.nvim/scm-1/telescope.nvim-scm-1.rockspec diff --git a/config/neovim/store/lazy-plugins/todo-comments.nvim/doc/tags b/config/neovim/store/lazy-plugins/todo-comments.nvim/doc/tags new file mode 100644 index 00000000..3724c017 --- /dev/null +++ b/config/neovim/store/lazy-plugins/todo-comments.nvim/doc/tags @@ -0,0 +1,9 @@ +todo-comments.nvim-links todo-comments.nvim.txt /*todo-comments.nvim-links* +todo-comments.nvim-table-of-contents todo-comments.nvim.txt /*todo-comments.nvim-table-of-contents* +todo-comments.nvim-todo-comments todo-comments.nvim.txt /*todo-comments.nvim-todo-comments* +todo-comments.nvim-todo-comments-configuration todo-comments.nvim.txt /*todo-comments.nvim-todo-comments-configuration* +todo-comments.nvim-todo-comments-features todo-comments.nvim.txt /*todo-comments.nvim-todo-comments-features* +todo-comments.nvim-todo-comments-installation todo-comments.nvim.txt /*todo-comments.nvim-todo-comments-installation* +todo-comments.nvim-todo-comments-requirements todo-comments.nvim.txt /*todo-comments.nvim-todo-comments-requirements* +todo-comments.nvim-todo-comments-usage todo-comments.nvim.txt /*todo-comments.nvim-todo-comments-usage* +todo-comments.nvim.txt todo-comments.nvim.txt /*todo-comments.nvim.txt* diff --git a/config/neovim/store/lazy-plugins/trouble.nvim/doc/tags b/config/neovim/store/lazy-plugins/trouble.nvim/doc/tags new file mode 100644 index 00000000..16e20e4e --- /dev/null +++ b/config/neovim/store/lazy-plugins/trouble.nvim/doc/tags @@ -0,0 +1,11 @@ +trouble.nvim-links trouble.nvim.txt /*trouble.nvim-links* +trouble.nvim-table-of-contents trouble.nvim.txt /*trouble.nvim-table-of-contents* +trouble.nvim-trouble-v2 trouble.nvim.txt /*trouble.nvim-trouble-v2* +trouble.nvim-trouble-v2-colors trouble.nvim.txt /*trouble.nvim-trouble-v2-colors* +trouble.nvim-trouble-v2-configuration trouble.nvim.txt /*trouble.nvim-trouble-v2-configuration* +trouble.nvim-trouble-v2-features trouble.nvim.txt /*trouble.nvim-trouble-v2-features* +trouble.nvim-trouble-v2-installation trouble.nvim.txt /*trouble.nvim-trouble-v2-installation* +trouble.nvim-trouble-v2-requirements trouble.nvim.txt /*trouble.nvim-trouble-v2-requirements* +trouble.nvim-trouble-v2-usage trouble.nvim.txt /*trouble.nvim-trouble-v2-usage* +trouble.nvim-trouble-v3-beta! trouble.nvim.txt /*trouble.nvim-trouble-v3-beta!* +trouble.nvim.txt trouble.nvim.txt /*trouble.nvim.txt* diff --git a/config/neovim/store/lazy-plugins/vim-illuminate/doc/tags b/config/neovim/store/lazy-plugins/vim-illuminate/doc/tags new file mode 100644 index 00000000..55c79a95 --- /dev/null +++ b/config/neovim/store/lazy-plugins/vim-illuminate/doc/tags @@ -0,0 +1,10 @@ +illuminate-commands illuminate.txt /*illuminate-commands* +illuminate-configuration illuminate.txt /*illuminate-configuration* +illuminate-functions illuminate.txt /*illuminate-functions* +illuminate-highlight-groups illuminate.txt /*illuminate-highlight-groups* +illuminate-links illuminate.txt /*illuminate-links* +illuminate-overview illuminate.txt /*illuminate-overview* +illuminate-quickstart illuminate.txt /*illuminate-quickstart* +illuminate-table-of-contents illuminate.txt /*illuminate-table-of-contents* +illuminate-vim-users illuminate.txt /*illuminate-vim-users* +illuminate.txt illuminate.txt /*illuminate.txt* diff --git a/config/neovim/store/lazy-plugins/vim-sandwich/doc/tags b/config/neovim/store/lazy-plugins/vim-sandwich/doc/tags new file mode 100644 index 00000000..94442a0a --- /dev/null +++ b/config/neovim/store/lazy-plugins/vim-sandwich/doc/tags @@ -0,0 +1,99 @@ +(operator-sandwich-add) operator-sandwich.txt /*(operator-sandwich-add)* +(operator-sandwich-add-query1st) operator-sandwich.txt /*(operator-sandwich-add-query1st)* +(operator-sandwich-delete) operator-sandwich.txt /*(operator-sandwich-delete)* +(operator-sandwich-dot) operator-sandwich.txt /*(operator-sandwich-dot)* +(operator-sandwich-predot) operator-sandwich.txt /*(operator-sandwich-predot)* +(operator-sandwich-release-count) operator-sandwich.txt /*(operator-sandwich-release-count)* +(operator-sandwich-replace) operator-sandwich.txt /*(operator-sandwich-replace)* +(operator-sandwich-replace-query1st) operator-sandwich.txt /*(operator-sandwich-replace-query1st)* +(operator-sandwich-squash-count) operator-sandwich.txt /*(operator-sandwich-squash-count)* +(operator-sandwich-synchro-count) operator-sandwich.txt /*(operator-sandwich-synchro-count)* +(sandwich-add) sandwich.txt /*(sandwich-add)* +(sandwich-delete) sandwich.txt /*(sandwich-delete)* +(sandwich-delete-auto) sandwich.txt /*(sandwich-delete-auto)* +(sandwich-replace) sandwich.txt /*(sandwich-replace)* +(sandwich-replace-auto) sandwich.txt /*(sandwich-replace-auto)* +(textobj-sandwich-auto-a) textobj-sandwich.txt /*(textobj-sandwich-auto-a)* +(textobj-sandwich-auto-i) textobj-sandwich.txt /*(textobj-sandwich-auto-i)* +(textobj-sandwich-literal-query-a) textobj-sandwich.txt /*(textobj-sandwich-literal-query-a)* +(textobj-sandwich-literal-query-i) textobj-sandwich.txt /*(textobj-sandwich-literal-query-i)* +(textobj-sandwich-query-a) textobj-sandwich.txt /*(textobj-sandwich-query-a)* +(textobj-sandwich-query-i) textobj-sandwich.txt /*(textobj-sandwich-query-i)* +OperatorSandwichAddPost operator-sandwich.txt /*OperatorSandwichAddPost* +OperatorSandwichAddPre operator-sandwich.txt /*OperatorSandwichAddPre* +OperatorSandwichDeletePost operator-sandwich.txt /*OperatorSandwichDeletePost* +OperatorSandwichDeletePre operator-sandwich.txt /*OperatorSandwichDeletePre* +OperatorSandwichReplacePost operator-sandwich.txt /*OperatorSandwichReplacePost* +OperatorSandwichReplacePre operator-sandwich.txt /*OperatorSandwichReplacePre* +b:operator_sandwich_options operator-sandwich.txt /*b:operator_sandwich_options* +b:operator_sandwich_recipes operator-sandwich.txt /*b:operator_sandwich_recipes* +b:sandwich_recipes sandwich.txt /*b:sandwich_recipes* +b:textobj_sandwich_options textobj-sandwich.txt /*b:textobj_sandwich_options* +b:textobj_sandwich_recipes textobj-sandwich.txt /*b:textobj_sandwich_recipes* +g:operator#sandwich#default_recipes operator-sandwich.txt /*g:operator#sandwich#default_recipes* +g:operator#sandwich#highlight_duration operator-sandwich.txt /*g:operator#sandwich#highlight_duration* +g:operator#sandwich#options operator-sandwich.txt /*g:operator#sandwich#options* +g:operator#sandwich#persistent_highlight operator-sandwich.txt /*g:operator#sandwich#persistent_highlight* +g:operator#sandwich#recipes operator-sandwich.txt /*g:operator#sandwich#recipes* +g:operator#sandwich#timeout operator-sandwich.txt /*g:operator#sandwich#timeout* +g:operator#sandwich#timeoutlen operator-sandwich.txt /*g:operator#sandwich#timeoutlen* +g:sandwich#default_recipes sandwich.txt /*g:sandwich#default_recipes* +g:sandwich#input_fallback sandwich.txt /*g:sandwich#input_fallback* +g:sandwich#recipes sandwich.txt /*g:sandwich#recipes* +g:sandwich#timeout sandwich.txt /*g:sandwich#timeout* +g:sandwich#timeoutlen sandwich.txt /*g:sandwich#timeoutlen* +g:sandwich_no_default_key_mappings sandwich.txt /*g:sandwich_no_default_key_mappings* +g:textobj#sandwich#default_recipes textobj-sandwich.txt /*g:textobj#sandwich#default_recipes* +g:textobj#sandwich#latest_jump textobj-sandwich.txt /*g:textobj#sandwich#latest_jump* +g:textobj#sandwich#options textobj-sandwich.txt /*g:textobj#sandwich#options* +g:textobj#sandwich#recipes textobj-sandwich.txt /*g:textobj#sandwich#recipes* +g:textobj#sandwich#stimeoutlen textobj-sandwich.txt /*g:textobj#sandwich#stimeoutlen* +g:textobj#sandwich#timeout textobj-sandwich.txt /*g:textobj#sandwich#timeout* +g:textobj#sandwich#timeoutlen textobj-sandwich.txt /*g:textobj#sandwich#timeoutlen* +hl-OperatorSandwichAdd operator-sandwich.txt /*hl-OperatorSandwichAdd* +hl-OperatorSandwichBuns operator-sandwich.txt /*hl-OperatorSandwichBuns* +hl-OperatorSandwichChange operator-sandwich.txt /*hl-OperatorSandwichChange* +hl-OperatorSandwichDelete operator-sandwich.txt /*hl-OperatorSandwichDelete* +operator#sandwich#get_info() operator-sandwich.txt /*operator#sandwich#get_info()* +operator#sandwich#keymap() operator-sandwich.txt /*operator#sandwich#keymap()* +operator#sandwich#kind() operator-sandwich.txt /*operator#sandwich#kind()* +operator#sandwich#quench() operator-sandwich.txt /*operator#sandwich#quench()* +operator#sandwich#query1st() operator-sandwich.txt /*operator#sandwich#query1st()* +operator#sandwich#set() operator-sandwich.txt /*operator#sandwich#set()* +operator#sandwich#set_default() operator-sandwich.txt /*operator#sandwich#set_default()* +operator#sandwich#setlocal() operator-sandwich.txt /*operator#sandwich#setlocal()* +operator#sandwich#show() operator-sandwich.txt /*operator#sandwich#show()* +operator-sandwich operator-sandwich.txt /*operator-sandwich* +operator-sandwich-api operator-sandwich.txt /*operator-sandwich-api* +operator-sandwich-autocommands operator-sandwich.txt /*operator-sandwich-autocommands* +operator-sandwich-configuration operator-sandwich.txt /*operator-sandwich-configuration* +operator-sandwich-contents operator-sandwich.txt /*operator-sandwich-contents* +operator-sandwich-highlight-group operator-sandwich.txt /*operator-sandwich-highlight-group* +operator-sandwich-introduction operator-sandwich.txt /*operator-sandwich-introduction* +operator-sandwich-keymappings operator-sandwich.txt /*operator-sandwich-keymappings* +operator-sandwich-miscellaneous operator-sandwich.txt /*operator-sandwich-miscellaneous* +operator-sandwich.txt operator-sandwich.txt /*operator-sandwich.txt* +sandwich#util#addlocal() sandwich.txt /*sandwich#util#addlocal()* +sandwich-configuration sandwich.txt /*sandwich-configuration* +sandwich-contents sandwich.txt /*sandwich-contents* +sandwich-filetype-recipes sandwich.txt /*sandwich-filetype-recipes* +sandwich-functions sandwich.txt /*sandwich-functions* +sandwich-introduction sandwich.txt /*sandwich-introduction* +sandwich-keymappings sandwich.txt /*sandwich-keymappings* +sandwich-magiccharacters sandwich.txt /*sandwich-magiccharacters* +sandwich-miscellaneous sandwich.txt /*sandwich-miscellaneous* +sandwich-quick-start sandwich.txt /*sandwich-quick-start* +sandwich.txt sandwich.txt /*sandwich.txt* +sandwich.vim sandwich.txt /*sandwich.vim* +textobj#sandwich#auto() textobj-sandwich.txt /*textobj#sandwich#auto()* +textobj#sandwich#query() textobj-sandwich.txt /*textobj#sandwich#query()* +textobj#sandwich#set() textobj-sandwich.txt /*textobj#sandwich#set()* +textobj#sandwich#set_default() textobj-sandwich.txt /*textobj#sandwich#set_default()* +textobj#sandwich#setlocal() textobj-sandwich.txt /*textobj#sandwich#setlocal()* +textobj-sandwich textobj-sandwich.txt /*textobj-sandwich* +textobj-sandwich-configuration textobj-sandwich.txt /*textobj-sandwich-configuration* +textobj-sandwich-contents textobj-sandwich.txt /*textobj-sandwich-contents* +textobj-sandwich-introduction textobj-sandwich.txt /*textobj-sandwich-introduction* +textobj-sandwich-keymappings textobj-sandwich.txt /*textobj-sandwich-keymappings* +textobj-sandwich-miscellaneous textobj-sandwich.txt /*textobj-sandwich-miscellaneous* +textobj-sandwich.txt textobj-sandwich.txt /*textobj-sandwich.txt* diff --git a/config/neovim/store/lazy-plugins/vim-sandwich/doc/tags-ja b/config/neovim/store/lazy-plugins/vim-sandwich/doc/tags-ja new file mode 100644 index 00000000..a8776054 --- /dev/null +++ b/config/neovim/store/lazy-plugins/vim-sandwich/doc/tags-ja @@ -0,0 +1,99 @@ +!_TAG_FILE_ENCODING utf-8 // +(operator-sandwich-add) operator-sandwich.jax /*(operator-sandwich-add)* +(operator-sandwich-add-query1st) operator-sandwich.jax /*(operator-sandwich-add-query1st)* +(operator-sandwich-delete) operator-sandwich.jax /*(operator-sandwich-delete)* +(operator-sandwich-dot) operator-sandwich.jax /*(operator-sandwich-dot)* +(operator-sandwich-predot) operator-sandwich.jax /*(operator-sandwich-predot)* +(operator-sandwich-release-count) operator-sandwich.jax /*(operator-sandwich-release-count)* +(operator-sandwich-replace) operator-sandwich.jax /*(operator-sandwich-replace)* +(operator-sandwich-replace-query1st) operator-sandwich.jax /*(operator-sandwich-replace-query1st)* +(operator-sandwich-squash-count) operator-sandwich.jax /*(operator-sandwich-squash-count)* +(operator-sandwich-synchro-count) operator-sandwich.jax /*(operator-sandwich-synchro-count)* +(sandwich-add) sandwich.jax /*(sandwich-add)* +(sandwich-delete) sandwich.jax /*(sandwich-delete)* +(sandwich-delete-auto) sandwich.jax /*(sandwich-delete-auto)* +(sandwich-replace) sandwich.jax /*(sandwich-replace)* +(sandwich-replace-auto) sandwich.jax /*(sandwich-replace-auto)* +(textobj-sandwich-auto-a) textobj-sandwich.jax /*(textobj-sandwich-auto-a)* +(textobj-sandwich-auto-i) textobj-sandwich.jax /*(textobj-sandwich-auto-i)* +(textobj-sandwich-literal-query-a) textobj-sandwich.jax /*(textobj-sandwich-literal-query-a)* +(textobj-sandwich-literal-query-i) textobj-sandwich.jax /*(textobj-sandwich-literal-query-i)* +(textobj-sandwich-query-a) textobj-sandwich.jax /*(textobj-sandwich-query-a)* +(textobj-sandwich-query-i) textobj-sandwich.jax /*(textobj-sandwich-query-i)* +OperatorSandwichAddPost operator-sandwich.jax /*OperatorSandwichAddPost* +OperatorSandwichAddPre operator-sandwich.jax /*OperatorSandwichAddPre* +OperatorSandwichDeletePost operator-sandwich.jax /*OperatorSandwichDeletePost* +OperatorSandwichDeletePre operator-sandwich.jax /*OperatorSandwichDeletePre* +OperatorSandwichReplacePost operator-sandwich.jax /*OperatorSandwichReplacePost* +OperatorSandwichReplacePre operator-sandwich.jax /*OperatorSandwichReplacePre* +b:operator_sandwich_options operator-sandwich.jax /*b:operator_sandwich_options* +b:operator_sandwich_recipes operator-sandwich.jax /*b:operator_sandwich_recipes* +b:sandwich_recipes sandwich.jax /*b:sandwich_recipes* +b:textobj_sandwich_options textobj-sandwich.jax /*b:textobj_sandwich_options* +b:textobj_sandwich_recipes textobj-sandwich.jax /*b:textobj_sandwich_recipes* +g:operator#sandwich#default_recipes operator-sandwich.jax /*g:operator#sandwich#default_recipes* +g:operator#sandwich#highlight_duration operator-sandwich.jax /*g:operator#sandwich#highlight_duration* +g:operator#sandwich#options operator-sandwich.jax /*g:operator#sandwich#options* +g:operator#sandwich#persistent_highlight operator-sandwich.jax /*g:operator#sandwich#persistent_highlight* +g:operator#sandwich#recipes operator-sandwich.jax /*g:operator#sandwich#recipes* +g:operator#sandwich#timeout operator-sandwich.jax /*g:operator#sandwich#timeout* +g:operator#sandwich#timeoutlen operator-sandwich.jax /*g:operator#sandwich#timeoutlen* +g:sandwich#default_recipes sandwich.jax /*g:sandwich#default_recipes* +g:sandwich#input_fallback sandwich.jax /*g:sandwich#input_fallback* +g:sandwich#recipes sandwich.jax /*g:sandwich#recipes* +g:sandwich#timeout sandwich.jax /*g:sandwich#timeout* +g:sandwich#timeoutlen sandwich.jax /*g:sandwich#timeoutlen* +g:textobj#sandwich#default_recipes textobj-sandwich.jax /*g:textobj#sandwich#default_recipes* +g:textobj#sandwich#latest_jump textobj-sandwich.jax /*g:textobj#sandwich#latest_jump* +g:textobj#sandwich#options textobj-sandwich.jax /*g:textobj#sandwich#options* +g:textobj#sandwich#recipes textobj-sandwich.jax /*g:textobj#sandwich#recipes* +g:textobj#sandwich#stimeoutlen textobj-sandwich.jax /*g:textobj#sandwich#stimeoutlen* +g:textobj#sandwich#timeout textobj-sandwich.jax /*g:textobj#sandwich#timeout* +g:textobj#sandwich#timeoutlen textobj-sandwich.jax /*g:textobj#sandwich#timeoutlen* +hl-OperatorSandwichAdd operator-sandwich.jax /*hl-OperatorSandwichAdd* +hl-OperatorSandwichBuns operator-sandwich.jax /*hl-OperatorSandwichBuns* +hl-OperatorSandwichChange operator-sandwich.jax /*hl-OperatorSandwichChange* +hl-OperatorSandwichDelete operator-sandwich.jax /*hl-OperatorSandwichDelete* +operator#sandwich#get_info() operator-sandwich.jax /*operator#sandwich#get_info()* +operator#sandwich#keymap() operator-sandwich.jax /*operator#sandwich#keymap()* +operator#sandwich#kind() operator-sandwich.jax /*operator#sandwich#kind()* +operator#sandwich#quench() operator-sandwich.jax /*operator#sandwich#quench()* +operator#sandwich#query1st() operator-sandwich.jax /*operator#sandwich#query1st()* +operator#sandwich#set() operator-sandwich.jax /*operator#sandwich#set()* +operator#sandwich#set_default() operator-sandwich.jax /*operator#sandwich#set_default()* +operator#sandwich#setlocal() operator-sandwich.jax /*operator#sandwich#setlocal()* +operator#sandwich#show() operator-sandwich.jax /*operator#sandwich#show()* +operator-sandwich operator-sandwich.jax /*operator-sandwich* +operator-sandwich-api operator-sandwich.jax /*operator-sandwich-api* +operator-sandwich-autocommands operator-sandwich.jax /*operator-sandwich-autocommands* +operator-sandwich-configuration operator-sandwich.jax /*operator-sandwich-configuration* +operator-sandwich-contents operator-sandwich.jax /*operator-sandwich-contents* +operator-sandwich-highlight-group operator-sandwich.jax /*operator-sandwich-highlight-group* +operator-sandwich-introduction operator-sandwich.jax /*operator-sandwich-introduction* +operator-sandwich-keymappings operator-sandwich.jax /*operator-sandwich-keymappings* +operator-sandwich-miscellaneous operator-sandwich.jax /*operator-sandwich-miscellaneous* +operator-sandwich.jax operator-sandwich.jax /*operator-sandwich.jax* +sandwich#util#addlocal() sandwich.jax /*sandwich#util#addlocal()* +sandwich-configuration sandwich.jax /*sandwich-configuration* +sandwich-contents sandwich.jax /*sandwich-contents* +sandwich-filetype-recipes sandwich.jax /*sandwich-filetype-recipes* +sandwich-functions sandwich.jax /*sandwich-functions* +sandwich-introduction sandwich.jax /*sandwich-introduction* +sandwich-keymappings sandwich.jax /*sandwich-keymappings* +sandwich-magiccharacters sandwich.jax /*sandwich-magiccharacters* +sandwich-miscellaneous sandwich.jax /*sandwich-miscellaneous* +sandwich-quick-start sandwich.jax /*sandwich-quick-start* +sandwich.jax sandwich.jax /*sandwich.jax* +sandwich.vim sandwich.jax /*sandwich.vim* +textobj#sandwich#auto() textobj-sandwich.jax /*textobj#sandwich#auto()* +textobj#sandwich#query() textobj-sandwich.jax /*textobj#sandwich#query()* +textobj#sandwich#set() textobj-sandwich.jax /*textobj#sandwich#set()* +textobj#sandwich#set_default() textobj-sandwich.jax /*textobj#sandwich#set_default()* +textobj#sandwich#setlocal() textobj-sandwich.jax /*textobj#sandwich#setlocal()* +textobj-sandwich textobj-sandwich.jax /*textobj-sandwich* +textobj-sandwich-configuration textobj-sandwich.jax /*textobj-sandwich-configuration* +textobj-sandwich-contents textobj-sandwich.jax /*textobj-sandwich-contents* +textobj-sandwich-introduction textobj-sandwich.jax /*textobj-sandwich-introduction* +textobj-sandwich-keymappings textobj-sandwich.jax /*textobj-sandwich-keymappings* +textobj-sandwich-miscellaneous textobj-sandwich.jax /*textobj-sandwich-miscellaneous* +textobj-sandwich.jax textobj-sandwich.jax /*textobj-sandwich.jax* diff --git a/config/neovim/store/lazy-plugins/which-key.nvim/doc/tags b/config/neovim/store/lazy-plugins/which-key.nvim/doc/tags new file mode 100644 index 00000000..f937988d --- /dev/null +++ b/config/neovim/store/lazy-plugins/which-key.nvim/doc/tags @@ -0,0 +1,12 @@ +which-key.nvim-links which-key.nvim.txt /*which-key.nvim-links* +which-key.nvim-table-of-contents which-key.nvim.txt /*which-key.nvim-table-of-contents* +which-key.nvim-which-key which-key.nvim.txt /*which-key.nvim-which-key* +which-key.nvim-which-key-colors which-key.nvim.txt /*which-key.nvim-which-key-colors* +which-key.nvim-which-key-configuration which-key.nvim.txt /*which-key.nvim-which-key-configuration* +which-key.nvim-which-key-features which-key.nvim.txt /*which-key.nvim-which-key-features* +which-key.nvim-which-key-installation which-key.nvim.txt /*which-key.nvim-which-key-installation* +which-key.nvim-which-key-plugins which-key.nvim.txt /*which-key.nvim-which-key-plugins* +which-key.nvim-which-key-requirements which-key.nvim.txt /*which-key.nvim-which-key-requirements* +which-key.nvim-which-key-setup which-key.nvim.txt /*which-key.nvim-which-key-setup* +which-key.nvim-which-key-usage which-key.nvim.txt /*which-key.nvim-which-key-usage* +which-key.nvim.txt which-key.nvim.txt /*which-key.nvim.txt* diff --git a/config/neovim/store/lazy-plugins/yanky.nvim/doc/tags b/config/neovim/store/lazy-plugins/yanky.nvim/doc/tags new file mode 100644 index 00000000..43de8bbc --- /dev/null +++ b/config/neovim/store/lazy-plugins/yanky.nvim/doc/tags @@ -0,0 +1,15 @@ +yanky-links yanky.txt /*yanky-links* +yanky-table-of-contents yanky.txt /*yanky-table-of-contents* +yanky-🍃-yanky.nvim yanky.txt /*yanky-🍃-yanky.nvim* +yanky-🍃-yanky.nvim-⚓-text-object yanky.txt /*yanky-🍃-yanky.nvim-⚓-text-object* +yanky-🍃-yanky.nvim-⚙️-configuration yanky.txt /*yanky-🍃-yanky.nvim-⚙️-configuration* +yanky-🍃-yanky.nvim-⚡️-requirements yanky.txt /*yanky-🍃-yanky.nvim-⚡️-requirements* +yanky-🍃-yanky.nvim-✨-features yanky.txt /*yanky-🍃-yanky.nvim-✨-features* +yanky-🍃-yanky.nvim-⭐-special-put yanky.txt /*yanky-🍃-yanky.nvim-⭐-special-put* +yanky-🍃-yanky.nvim-🎉-credits yanky.txt /*yanky-🍃-yanky.nvim-🎉-credits* +yanky-🍃-yanky.nvim-🎨-colors yanky.txt /*yanky-🍃-yanky.nvim-🎨-colors* +yanky-🍃-yanky.nvim-📜-yank-history-picker yanky.txt /*yanky-🍃-yanky.nvim-📜-yank-history-picker* +yanky-🍃-yanky.nvim-📦-installation yanky.txt /*yanky-🍃-yanky.nvim-📦-installation* +yanky-🍃-yanky.nvim-🖇️-yank-ring yanky.txt /*yanky-🍃-yanky.nvim-🖇️-yank-ring* +yanky-🍃-yanky.nvim-🤝-integrations yanky.txt /*yanky-🍃-yanky.nvim-🤝-integrations* +yanky.txt yanky.txt /*yanky.txt* diff --git a/config/neovim/store/lazy-plugins/yanky.nvim/lua/yanky/system_clipboard.lua b/config/neovim/store/lazy-plugins/yanky.nvim/lua/yanky/system_clipboard.lua index d821796c..edd0e5b2 100644 --- a/config/neovim/store/lazy-plugins/yanky.nvim/lua/yanky/system_clipboard.lua +++ b/config/neovim/store/lazy-plugins/yanky.nvim/lua/yanky/system_clipboard.lua @@ -12,33 +12,33 @@ function system_clipboard.setup() system_clipboard.history = require("yanky.history") if system_clipboard.config.sync_with_ring then - local yanky_clipboard_augroup = vim.api.nvim_create_augroup("YankySyncClipboard", { clear = true }) - local fetching = false - vim.api.nvim_create_autocmd("FocusGained", { - group = yanky_clipboard_augroup, - pattern = "*", - callback = function(_) - if fetching then - return + local focused_real = true -- realtime state of focus + local focused_delayed = true -- delayed state of focus + + local timer = nil + vim.api.nvim_create_autocmd({ "FocusGained", "FocusLost" }, { + group = vim.api.nvim_create_augroup("YankySyncClipboard", { clear = true }), + callback = function(ev) + if ev.event == "FocusLost" then + focused_real = false + if timer then + timer:stop() + end + timer = vim.defer_fn(function() + if not focused_real then -- still not focused + system_clipboard.on_focus_lost() + focused_delayed = false + end + end, 500) + elseif ev.event == "FocusGained" then + if not focused_delayed then + system_clipboard.on_focus_gained() + end + focused_real = true + focused_delayed = true end - fetching = true - local ok, err = pcall(system_clipboard.on_focus_gained) - vim.schedule(function() - fetching = false - end) - if not ok then - error(err) - end - end, - }) - vim.api.nvim_create_autocmd("FocusLost", { - group = yanky_clipboard_augroup, - pattern = "*", - callback = function(_) - if fetching then - return - end - system_clipboard.on_focus_lost() + -- don't execute focus autocmds while fetching the clipboard, + -- since clipboard tools can steal focus end, }) end diff --git a/config/neovim/store/nvim-treesitter/.github/workflows/lint.yml b/config/neovim/store/nvim-treesitter/.github/workflows/lint.yml index b73f03cf..7123332b 100644 --- a/config/neovim/store/nvim-treesitter/.github/workflows/lint.yml +++ b/config/neovim/store/nvim-treesitter/.github/workflows/lint.yml @@ -36,15 +36,16 @@ jobs: format-queries: name: Lint queries runs-on: ubuntu-latest + env: + NVIM_TAG: stable steps: - uses: actions/checkout@v4 - name: Prepare run: | - wget https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz - tar -zxf nvim-linux64.tar.gz - sudo ln -s "$PWD"/nvim-linux64/bin/nvim /usr/local/bin + bash ./scripts/ci-install.sh - name: Lint run: | + nvim --headless -c "TSInstallSync query" -c "q" nvim -l scripts/format-queries.lua git diff --exit-code diff --git a/config/neovim/store/nvim-treesitter/doc/builtin-tests/dir1/file1-1 b/config/neovim/store/nvim-treesitter/doc/builtin-tests/dir1/file1-1 deleted file mode 100644 index 1a2e58ae..00000000 --- a/config/neovim/store/nvim-treesitter/doc/builtin-tests/dir1/file1-1 +++ /dev/null @@ -1,5 +0,0 @@ -dir1/file1-1 - -aaa -bbb -ccc diff --git a/config/neovim/store/nvim-treesitter/doc/builtin-tests/dir1/file1-2 b/config/neovim/store/nvim-treesitter/doc/builtin-tests/dir1/file1-2 deleted file mode 100644 index 33ab8b74..00000000 --- a/config/neovim/store/nvim-treesitter/doc/builtin-tests/dir1/file1-2 +++ /dev/null @@ -1,5 +0,0 @@ -dir1/file1-2 - -aaa -bbb -ccc diff --git a/config/neovim/store/nvim-treesitter/doc/builtin-tests/file b/config/neovim/store/nvim-treesitter/doc/builtin-tests/file deleted file mode 100644 index 1611a526..00000000 --- a/config/neovim/store/nvim-treesitter/doc/builtin-tests/file +++ /dev/null @@ -1,5 +0,0 @@ -file - -aaa -bbb -ccc diff --git a/config/neovim/store/nvim-treesitter/doc/lua/nvim-web-devicons.lua b/config/neovim/store/nvim-treesitter/doc/lua/nvim-web-devicons.lua deleted file mode 100644 index eeb1bb70..00000000 --- a/config/neovim/store/nvim-treesitter/doc/lua/nvim-web-devicons.lua +++ /dev/null @@ -1,17 +0,0 @@ -vim.cmd('hi DevIconLicense guifg=#111111') -vim.cmd('hi DevIconMakefile guifg=#222222') -vim.cmd('hi DevIconGif guifg=#333333') -vim.cmd('hi DevIconLua guifg=#444444') -vim.cmd('hi DevIconTxt guifg=#555555') -vim.cmd('hi DevIconDefault guifg=#666666') - -return { - get_icon = function(filename, _, options) - if filename == 'LICENSE' then return '', 'DevIconLicense' end - if filename == 'Makefile' then return '', 'DevIconMakefile' end - if vim.endswith(filename, 'gif') then return '', 'DevIconGif' end - if vim.endswith(filename, 'lua') then return '', 'DevIconLua' end - if vim.endswith(filename, 'txt') then return '', 'DevIconTxt' end - if (options or {}).default then return '', 'DevIconDefault' end - end, -} diff --git a/config/neovim/store/nvim-treesitter/doc/mocks/spawn.lua b/config/neovim/store/nvim-treesitter/doc/mocks/spawn.lua deleted file mode 100644 index 6086b166..00000000 --- a/config/neovim/store/nvim-treesitter/doc/mocks/spawn.lua +++ /dev/null @@ -1,50 +0,0 @@ -_G.process_log = {} - -local n_pid, n_stdout = 0, 0 -local new_process = function(pid) - return { - pid = pid, - close = function(_) table.insert(_G.process_log, 'Process ' .. pid .. ' was closed.') end, - } -end - --- Mock `stdout` by using global `_G.stdout_data_feed` array as source. --- Each feed's element should be either string (for usable data) or a table --- with `err` field (for error). -vim.loop.new_pipe = function() - n_stdout = n_stdout + 1 - local cur_stdout_id = 'Stdout_' .. n_stdout - - return { - read_start = function(_, callback) - -- It is not possible in Neovim<=0.9 to execute `vim.fn` functions during - -- `pipe:read_start()` - local vim_fn_orig = vim.deepcopy(vim.fn) - vim.fn = setmetatable({}, { __index = function() error('Can not use `vim.fn` during `read_start`.') end }) - - for _, x in ipairs(_G.stdout_data_feed or {}) do - if type(x) == 'table' then callback(x.err, nil) end - if type(x) == 'string' then callback(nil, x) end - end - callback(nil, nil) - - vim.fn = vim_fn_orig - end, - close = function() table.insert(_G.process_log, 'Stdout ' .. cur_stdout_id .. ' was closed.') end, - } -end - -_G.spawn_log = {} -vim.loop.spawn = function(path, options, on_exit) - local options_without_callables = vim.deepcopy(options) - options_without_callables.stdio = nil - table.insert(_G.spawn_log, { executable = path, options = options_without_callables }) - - vim.schedule(function() on_exit() end) - - n_pid = n_pid + 1 - local pid = 'Pid_' .. n_pid - return new_process(pid), pid -end - -vim.loop.process_kill = function(process) table.insert(_G.process_log, 'Process ' .. process.pid .. ' was killed.') end diff --git a/config/neovim/store/nvim-treesitter/doc/real-files/LICENSE b/config/neovim/store/nvim-treesitter/doc/real-files/LICENSE deleted file mode 100644 index ac3dbebb..00000000 --- a/config/neovim/store/nvim-treesitter/doc/real-files/LICENSE +++ /dev/null @@ -1 +0,0 @@ -MIT (c) diff --git a/config/neovim/store/nvim-treesitter/doc/real-files/Makefile b/config/neovim/store/nvim-treesitter/doc/real-files/Makefile deleted file mode 100644 index eeecfe5c..00000000 --- a/config/neovim/store/nvim-treesitter/doc/real-files/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -VAR ?= 1 - -all: test diff --git a/config/neovim/store/nvim-treesitter/doc/real-files/a.lua b/config/neovim/store/nvim-treesitter/doc/real-files/a.lua deleted file mode 100644 index 140a9a09..00000000 --- a/config/neovim/store/nvim-treesitter/doc/real-files/a.lua +++ /dev/null @@ -1,5 +0,0 @@ -local a = 1 -local t = { - x = math.max(1, 2), - y = math.min(1, 2), -} diff --git a/config/neovim/store/nvim-treesitter/doc/real-files/b.txt b/config/neovim/store/nvim-treesitter/doc/real-files/b.txt deleted file mode 100644 index ae951ea8..00000000 --- a/config/neovim/store/nvim-treesitter/doc/real-files/b.txt +++ /dev/null @@ -1,26 +0,0 @@ -Line 1 -Line 2 -Line 3 -Line 4 -Line 5 -Line 6 -Line 7 -Line 8 -Line 9 -Line 10 -Line 11 -Line 12 -Line 13 -Line 14 -Line 15 -Line 16 -Line 17 -Line 18 -Line 19 -Line 20 -Line 21 -Line 22 -Line 23 -Line 24 -Line 25 -Line 26 diff --git a/config/neovim/store/nvim-treesitter/doc/real-files/c.gif b/config/neovim/store/nvim-treesitter/doc/real-files/c.gif deleted file mode 100644 index ccdd7b74..00000000 Binary files a/config/neovim/store/nvim-treesitter/doc/real-files/c.gif and /dev/null differ diff --git a/config/neovim/store/nvim-treesitter/doc/tags b/config/neovim/store/nvim-treesitter/doc/tags new file mode 100644 index 00000000..813e79d6 --- /dev/null +++ b/config/neovim/store/nvim-treesitter/doc/tags @@ -0,0 +1,47 @@ +:TSBufDisable nvim-treesitter.txt /*:TSBufDisable* +:TSBufEnable nvim-treesitter.txt /*:TSBufEnable* +:TSBufToggle nvim-treesitter.txt /*:TSBufToggle* +:TSDisable nvim-treesitter.txt /*:TSDisable* +:TSEditQuery nvim-treesitter.txt /*:TSEditQuery* +:TSEditQueryUserAfter nvim-treesitter.txt /*:TSEditQueryUserAfter* +:TSEnable nvim-treesitter.txt /*:TSEnable* +:TSInstall nvim-treesitter.txt /*:TSInstall* +:TSInstallInfo nvim-treesitter.txt /*:TSInstallInfo* +:TSInstallSync nvim-treesitter.txt /*:TSInstallSync* +:TSModuleInfo nvim-treesitter.txt /*:TSModuleInfo* +:TSToggle nvim-treesitter.txt /*:TSToggle* +:TSUninstall nvim-treesitter.txt /*:TSUninstall* +:TSUpdate nvim-treesitter.txt /*:TSUpdate* +:TSUpdateSync nvim-treesitter.txt /*:TSUpdateSync* +nvim-treesitter nvim-treesitter.txt /*nvim-treesitter* +nvim-treesitter-commands nvim-treesitter.txt /*nvim-treesitter-commands* +nvim-treesitter-functions nvim-treesitter.txt /*nvim-treesitter-functions* +nvim-treesitter-highlight-mod nvim-treesitter.txt /*nvim-treesitter-highlight-mod* +nvim-treesitter-incremental-selection-mod nvim-treesitter.txt /*nvim-treesitter-incremental-selection-mod* +nvim-treesitter-indentation-aligned_indent.align nvim-treesitter.txt /*nvim-treesitter-indentation-aligned_indent.align* +nvim-treesitter-indentation-indent.begin nvim-treesitter.txt /*nvim-treesitter-indentation-indent.begin* +nvim-treesitter-indentation-indent.branch nvim-treesitter.txt /*nvim-treesitter-indentation-indent.branch* +nvim-treesitter-indentation-indent.dedent nvim-treesitter.txt /*nvim-treesitter-indentation-indent.dedent* +nvim-treesitter-indentation-indent.end nvim-treesitter.txt /*nvim-treesitter-indentation-indent.end* +nvim-treesitter-indentation-mod nvim-treesitter.txt /*nvim-treesitter-indentation-mod* +nvim-treesitter-indentation-queries nvim-treesitter.txt /*nvim-treesitter-indentation-queries* +nvim-treesitter-intro nvim-treesitter.txt /*nvim-treesitter-intro* +nvim-treesitter-modules nvim-treesitter.txt /*nvim-treesitter-modules* +nvim-treesitter-performance nvim-treesitter.txt /*nvim-treesitter-performance* +nvim-treesitter-quickstart nvim-treesitter.txt /*nvim-treesitter-quickstart* +nvim-treesitter-utils nvim-treesitter.txt /*nvim-treesitter-utils* +nvim_treesitter#foldexpr() nvim-treesitter.txt /*nvim_treesitter#foldexpr()* +nvim_treesitter#statusline() nvim-treesitter.txt /*nvim_treesitter#statusline()* +ts_utils.get_named_children nvim-treesitter.txt /*ts_utils.get_named_children* +ts_utils.get_next_node nvim-treesitter.txt /*ts_utils.get_next_node* +ts_utils.get_node_at_cursor nvim-treesitter.txt /*ts_utils.get_node_at_cursor* +ts_utils.get_previous_node nvim-treesitter.txt /*ts_utils.get_previous_node* +ts_utils.goto_node nvim-treesitter.txt /*ts_utils.goto_node* +ts_utils.highlight_node nvim-treesitter.txt /*ts_utils.highlight_node* +ts_utils.highlight_range nvim-treesitter.txt /*ts_utils.highlight_range* +ts_utils.is_parent nvim-treesitter.txt /*ts_utils.is_parent* +ts_utils.memoize_by_buf_tick nvim-treesitter.txt /*ts_utils.memoize_by_buf_tick* +ts_utils.node_length nvim-treesitter.txt /*ts_utils.node_length* +ts_utils.node_to_lsp_range nvim-treesitter.txt /*ts_utils.node_to_lsp_range* +ts_utils.swap_nodes nvim-treesitter.txt /*ts_utils.swap_nodes* +ts_utils.update_selection nvim-treesitter.txt /*ts_utils.update_selection* diff --git a/config/neovim/store/nvim-treesitter/lockfile.json b/config/neovim/store/nvim-treesitter/lockfile.json index 894fb999..419eeca1 100644 --- a/config/neovim/store/nvim-treesitter/lockfile.json +++ b/config/neovim/store/nvim-treesitter/lockfile.json @@ -51,7 +51,7 @@ "revision": "2326d709fb9cf73cf124fdbc803c267f851721a4" }, "c": { - "revision": "82fb86aa544843bd17a9f0f3dc16edf645a34349" + "revision": "00ed08f1a6c18141bfd7a81638e4d239a0bb55cc" }, "c_sharp": { "revision": "82fa8f05f41a33e9bc830f85d74a9548f0291738" @@ -87,7 +87,7 @@ "revision": "594289eadfec719198e560f9d7fd243c4db678d5" }, "cpp": { - "revision": "2369fa991eba294e9238e28280ffcd58132f94bc" + "revision": "d29fbff09a8c9ff4f3074de2595dfca12cb33da9" }, "css": { "revision": "f6be52c3d1cdb1c5e4dd7d8bce0a57497f55d6af" @@ -135,13 +135,13 @@ "revision": "648183d86f6f8ffb240ea11b4c6873f6f45d8b67" }, "earthfile": { - "revision": "91fc9434283aec06139e37fc007ad00922f278b4" + "revision": "336001d79dd62668088bc6fe6d72a774a449fa2d" }, "ebnf": { "revision": "8e635b0b723c620774dfb8abf382a7f531894b40" }, "eds": { - "revision": "fde62029d4c715562230070b9af51a9500c2ce10" + "revision": "5517bdb90c90703df49579a4b04689a614780be2" }, "eex": { "revision": "f742f2fe327463335e8671a87c0b9b396905d1d1" @@ -324,7 +324,7 @@ "revision": "bcb84a2d4bcd6f55b911c42deade75c8f90cb0c5" }, "inko": { - "revision": "7860637ce1b43f5f79cfb7cc3311bf3234e9479f" + "revision": "234c87be1dac20f766ddf6f486a7bde2a4bc5594" }, "ispc": { "revision": "9b2f9aec2106b94b4e099fe75e73ebd8ae707c04" @@ -447,7 +447,7 @@ "revision": "570f3d7be01fffc751237f4cfcf52d04e20532d1" }, "nickel": { - "revision": "58baf89db8fdae54a84bcf22c80ff10ee3f929ed" + "revision": "52478738c5a072ab3ad62c74db5d0902dab064cd" }, "nim": { "revision": "961c2798cec9250c44f7d7225ddb33d47d25856a" @@ -570,7 +570,7 @@ "revision": "2c57cac27e207425f8df15327884434cb12365a3" }, "query": { - "revision": "a12c4a1cd8aa6e0340ecb7089a05cd345a12bae3" + "revision": "f767fb0ac5e711b6d44c5e0c8d1f349687a86ce0" }, "r": { "revision": "391400572538ff9854341a175ed8ab4b1e45f44b" @@ -648,7 +648,7 @@ "revision": "ba1b3868eaa960b945593404af9a7c2f296d3643" }, "solidity": { - "revision": "b5a23ead0f69d38b5c9a630f52f5c129132c16ed" + "revision": "1c94fe3d5351dfcff3551ec1f49614cbf758e444" }, "soql": { "revision": "c99ad4b16d112fea91745e3f1b769754239fdaba" @@ -690,7 +690,7 @@ "revision": "2c97326cd96b7c3016c3d249e8dc244c89b4abeb" }, "swift": { - "revision": "03af4d057afc56edf6a703e6606b86f782353f22" + "revision": "26354ddec08c7efde4fa16bd29429f3310d2e2c5" }, "sxhkdrc": { "revision": "440d5f913d9465c9c776a1bd92334d32febcf065" @@ -831,7 +831,7 @@ "revision": "e877f6ade4b77d5ef8787075141053631ba12318" }, "zathurarc": { - "revision": "e9e8de071ab79ed1f6e3365f05fcf890b6d85a2f" + "revision": "5918bf1785662c43a841b0b6a27a129337ec3a23" }, "zig": { "revision": "0d08703e4c3f426ec61695d7617415fff97029bd" diff --git a/config/neovim/store/nvim-treesitter/queries/ada/init-files/test-init.lua b/config/neovim/store/nvim-treesitter/queries/ada/init-files/test-init.lua deleted file mode 100644 index cf11b7e4..00000000 --- a/config/neovim/store/nvim-treesitter/queries/ada/init-files/test-init.lua +++ /dev/null @@ -1,9 +0,0 @@ --- Avoid hit-enter-prompt -vim.o.cmdheight = 2 --- Avoid storing unnecessary data (also sometimes avoid hit-enter-prompt) -vim.o.swapfile = false - -vim.cmd('set rtp+=.') -_G.n_event = 0 -vim.cmd('autocmd User MiniStarterOpened lua _G.n_event = _G.n_event + 1') -require('mini.starter').setup({ autoopen = true }) diff --git a/config/neovim/store/nvim-treesitter/queries/ada/sessions/Session.vim b/config/neovim/store/nvim-treesitter/queries/ada/sessions/Session.vim deleted file mode 100644 index e69de29b..00000000 diff --git a/config/neovim/store/nvim-treesitter/queries/ada/sessions/session_global.lua b/config/neovim/store/nvim-treesitter/queries/ada/sessions/session_global.lua deleted file mode 100644 index e69de29b..00000000 diff --git a/config/neovim/store/nvim-treesitter/queries/cpp/highlights.scm b/config/neovim/store/nvim-treesitter/queries/cpp/highlights.scm index 1779d59e..e39a2925 100644 --- a/config/neovim/store/nvim-treesitter/queries/cpp/highlights.scm +++ b/config/neovim/store/nvim-treesitter/queries/cpp/highlights.scm @@ -229,8 +229,8 @@ "public" "private" "protected" - "virtual" "final" + (virtual) ] @keyword.modifier [ diff --git a/config/neovim/store/nvim-treesitter/queries/query/highlights.scm b/config/neovim/store/nvim-treesitter/queries/query/highlights.scm index 210d03dc..c02ee3f2 100644 --- a/config/neovim/store/nvim-treesitter/queries/query/highlights.scm +++ b/config/neovim/store/nvim-treesitter/queries/query/highlights.scm @@ -5,9 +5,6 @@ (capture (identifier) @type) -(anonymous_node - (identifier) @string) - (predicate name: (identifier) @function.call) diff --git a/config/neovim/store/nvim-treesitter/queries/solidity/highlights.scm b/config/neovim/store/nvim-treesitter/queries/solidity/highlights.scm index 37f2d6df..1f1d2fe9 100644 --- a/config/neovim/store/nvim-treesitter/queries/solidity/highlights.scm +++ b/config/neovim/store/nvim-treesitter/queries/solidity/highlights.scm @@ -262,38 +262,39 @@ "=>" ] @punctuation.delimiter -; Operators: currently broken: https://github.com/JoranHonig/tree-sitter-solidity/issues/59 -;[ -; "&&" -; "||" -; ">>" -; ">>>" -; "<<" -; "&" -; "^" -; "|" -; "+" -; "-" -; "*" -; "/" -; "%" -; "**" -; "=" -; "<" -; "<=" -; "==" -; "!=" -; "!==" -; ">=" -; ">" -; "!" -; "~" -; "-" -; "+" -; "++" -; "--" -; ":=" -;] @operator +; Operators +[ + "&&" + "||" + ">>" + ">>>" + "<<" + "&" + "^" + "|" + "+" + "-" + "*" + "/" + "%" + "**" + "=" + "<" + "<=" + "==" + "!=" + "!==" + ">=" + ">" + "!" + "~" + "-" + "+" + "++" + "--" + ":=" +] @operator + [ "delete" "new" diff --git a/config/neovim/store/nvim-treesitter/scripts/format-queries.lua b/config/neovim/store/nvim-treesitter/scripts/format-queries.lua index 25f0df2a..ce89b043 100755 --- a/config/neovim/store/nvim-treesitter/scripts/format-queries.lua +++ b/config/neovim/store/nvim-treesitter/scripts/format-queries.lua @@ -200,7 +200,7 @@ local format_queries = [[ (capture) @format.prepend-space ;; Workaround to just use the string's content -(anonymous_node (identifier) @format.keep) +(anonymous_node (string) @format.keep) ; ( (_) ) handler (grouping @@ -248,7 +248,7 @@ local format_queries = [[ . [ (anonymous_node - name: (identifier) .) + name: (string) .) (named_node [ "_" diff --git a/config/neovim/store/treesitter-parsers/parser/ada.so b/config/neovim/store/treesitter-parsers/parser/ada.so new file mode 100755 index 00000000..b8bc3eab Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/ada.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/agda.so b/config/neovim/store/treesitter-parsers/parser/agda.so new file mode 100755 index 00000000..e47e9718 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/agda.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/angular.so b/config/neovim/store/treesitter-parsers/parser/angular.so new file mode 100755 index 00000000..2af7b970 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/angular.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/apex.so b/config/neovim/store/treesitter-parsers/parser/apex.so new file mode 100755 index 00000000..afba8a80 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/apex.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/arduino.so b/config/neovim/store/treesitter-parsers/parser/arduino.so new file mode 100755 index 00000000..cfb3fa37 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/arduino.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/asm.so b/config/neovim/store/treesitter-parsers/parser/asm.so new file mode 100755 index 00000000..44063bcb Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/asm.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/astro.so b/config/neovim/store/treesitter-parsers/parser/astro.so new file mode 100755 index 00000000..657d5932 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/astro.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/authzed.so b/config/neovim/store/treesitter-parsers/parser/authzed.so new file mode 100755 index 00000000..3724f899 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/authzed.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/awk.so b/config/neovim/store/treesitter-parsers/parser/awk.so new file mode 100755 index 00000000..bc4bd33b Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/awk.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/bass.so b/config/neovim/store/treesitter-parsers/parser/bass.so new file mode 100755 index 00000000..25f4cbc6 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/bass.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/beancount.so b/config/neovim/store/treesitter-parsers/parser/beancount.so new file mode 100755 index 00000000..c0093160 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/beancount.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/bicep.so b/config/neovim/store/treesitter-parsers/parser/bicep.so new file mode 100755 index 00000000..4e7c80f7 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/bicep.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/bitbake.so b/config/neovim/store/treesitter-parsers/parser/bitbake.so new file mode 100755 index 00000000..3217c0d2 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/bitbake.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/blueprint.so b/config/neovim/store/treesitter-parsers/parser/blueprint.so new file mode 100755 index 00000000..41201685 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/blueprint.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/bp.so b/config/neovim/store/treesitter-parsers/parser/bp.so new file mode 100755 index 00000000..7c6639c2 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/bp.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/c.so b/config/neovim/store/treesitter-parsers/parser/c.so index c5045cc6..b47416cf 100755 Binary files a/config/neovim/store/treesitter-parsers/parser/c.so and b/config/neovim/store/treesitter-parsers/parser/c.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/c_sharp.so b/config/neovim/store/treesitter-parsers/parser/c_sharp.so new file mode 100755 index 00000000..e9aa3e7f Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/c_sharp.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/cairo.so b/config/neovim/store/treesitter-parsers/parser/cairo.so new file mode 100755 index 00000000..44b164f6 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/cairo.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/capnp.so b/config/neovim/store/treesitter-parsers/parser/capnp.so new file mode 100755 index 00000000..bf775de8 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/capnp.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/chatito.so b/config/neovim/store/treesitter-parsers/parser/chatito.so new file mode 100755 index 00000000..46472ac6 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/chatito.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/comment.so b/config/neovim/store/treesitter-parsers/parser/comment.so new file mode 100755 index 00000000..3f506711 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/comment.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/commonlisp.so b/config/neovim/store/treesitter-parsers/parser/commonlisp.so new file mode 100755 index 00000000..e6b41ead Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/commonlisp.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/cooklang.so b/config/neovim/store/treesitter-parsers/parser/cooklang.so new file mode 100755 index 00000000..b5fd4b7f Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/cooklang.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/corn.so b/config/neovim/store/treesitter-parsers/parser/corn.so new file mode 100755 index 00000000..d6527977 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/corn.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/cpon.so b/config/neovim/store/treesitter-parsers/parser/cpon.so new file mode 100755 index 00000000..0ccfcf60 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/cpon.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/cpp.so b/config/neovim/store/treesitter-parsers/parser/cpp.so index c154aac5..398c0628 100755 Binary files a/config/neovim/store/treesitter-parsers/parser/cpp.so and b/config/neovim/store/treesitter-parsers/parser/cpp.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/css.so b/config/neovim/store/treesitter-parsers/parser/css.so new file mode 100755 index 00000000..77f707f4 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/css.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/cuda.so b/config/neovim/store/treesitter-parsers/parser/cuda.so new file mode 100755 index 00000000..70768b13 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/cuda.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/cue.so b/config/neovim/store/treesitter-parsers/parser/cue.so new file mode 100755 index 00000000..a1cf6050 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/cue.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/d.so b/config/neovim/store/treesitter-parsers/parser/d.so new file mode 100755 index 00000000..5a3c800d Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/d.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/dart.so b/config/neovim/store/treesitter-parsers/parser/dart.so new file mode 100755 index 00000000..d6844fa3 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/dart.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/devicetree.so b/config/neovim/store/treesitter-parsers/parser/devicetree.so new file mode 100755 index 00000000..1677d5a8 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/devicetree.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/dhall.so b/config/neovim/store/treesitter-parsers/parser/dhall.so new file mode 100755 index 00000000..9120bb19 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/dhall.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/diff.so b/config/neovim/store/treesitter-parsers/parser/diff.so new file mode 100755 index 00000000..15392672 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/diff.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/djot.so b/config/neovim/store/treesitter-parsers/parser/djot.so new file mode 100755 index 00000000..c9375a8c Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/djot.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/dtd.so b/config/neovim/store/treesitter-parsers/parser/dtd.so new file mode 100755 index 00000000..6a37c29d Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/dtd.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/earthfile.so b/config/neovim/store/treesitter-parsers/parser/earthfile.so new file mode 100755 index 00000000..dd11fb31 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/earthfile.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/ebnf.so b/config/neovim/store/treesitter-parsers/parser/ebnf.so new file mode 100755 index 00000000..51e70587 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/ebnf.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/eds.so b/config/neovim/store/treesitter-parsers/parser/eds.so new file mode 100755 index 00000000..d5feef42 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/eds.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/eex.so b/config/neovim/store/treesitter-parsers/parser/eex.so new file mode 100755 index 00000000..302c980e Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/eex.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/elixir.so b/config/neovim/store/treesitter-parsers/parser/elixir.so new file mode 100755 index 00000000..0dd02e0f Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/elixir.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/elm.so b/config/neovim/store/treesitter-parsers/parser/elm.so new file mode 100755 index 00000000..68710714 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/elm.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/elsa.so b/config/neovim/store/treesitter-parsers/parser/elsa.so new file mode 100755 index 00000000..7ee81263 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/elsa.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/elvish.so b/config/neovim/store/treesitter-parsers/parser/elvish.so new file mode 100755 index 00000000..9b1b3e48 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/elvish.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/embedded_template.so b/config/neovim/store/treesitter-parsers/parser/embedded_template.so new file mode 100755 index 00000000..5994ec0b Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/embedded_template.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/erlang.so b/config/neovim/store/treesitter-parsers/parser/erlang.so new file mode 100755 index 00000000..e4c37b10 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/erlang.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/facility.so b/config/neovim/store/treesitter-parsers/parser/facility.so new file mode 100755 index 00000000..4c424a65 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/facility.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/faust.so b/config/neovim/store/treesitter-parsers/parser/faust.so new file mode 100755 index 00000000..582c61cd Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/faust.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/fennel.so b/config/neovim/store/treesitter-parsers/parser/fennel.so new file mode 100755 index 00000000..333ffdf7 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/fennel.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/fidl.so b/config/neovim/store/treesitter-parsers/parser/fidl.so new file mode 100755 index 00000000..5c93895e Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/fidl.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/firrtl.so b/config/neovim/store/treesitter-parsers/parser/firrtl.so new file mode 100755 index 00000000..9735d316 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/firrtl.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/foam.so b/config/neovim/store/treesitter-parsers/parser/foam.so new file mode 100755 index 00000000..11ddd304 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/foam.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/forth.so b/config/neovim/store/treesitter-parsers/parser/forth.so new file mode 100755 index 00000000..8b6a0c9b Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/forth.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/fortran.so b/config/neovim/store/treesitter-parsers/parser/fortran.so new file mode 100755 index 00000000..f4f7d043 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/fortran.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/fsh.so b/config/neovim/store/treesitter-parsers/parser/fsh.so new file mode 100755 index 00000000..7631d7f6 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/fsh.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/func.so b/config/neovim/store/treesitter-parsers/parser/func.so new file mode 100755 index 00000000..43ff47cc Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/func.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/fusion.so b/config/neovim/store/treesitter-parsers/parser/fusion.so new file mode 100755 index 00000000..817577c4 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/fusion.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/gdscript.so b/config/neovim/store/treesitter-parsers/parser/gdscript.so new file mode 100755 index 00000000..70418506 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/gdscript.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/gdshader.so b/config/neovim/store/treesitter-parsers/parser/gdshader.so new file mode 100755 index 00000000..763a6fc0 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/gdshader.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/git_config.so b/config/neovim/store/treesitter-parsers/parser/git_config.so new file mode 100755 index 00000000..91e629cc Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/git_config.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/git_rebase.so b/config/neovim/store/treesitter-parsers/parser/git_rebase.so new file mode 100755 index 00000000..dc03bca2 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/git_rebase.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/gitattributes.so b/config/neovim/store/treesitter-parsers/parser/gitattributes.so new file mode 100755 index 00000000..ec4d0076 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/gitattributes.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/gitcommit.so b/config/neovim/store/treesitter-parsers/parser/gitcommit.so new file mode 100755 index 00000000..34b1c5fb Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/gitcommit.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/gleam.so b/config/neovim/store/treesitter-parsers/parser/gleam.so new file mode 100755 index 00000000..75ce0711 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/gleam.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/glimmer.so b/config/neovim/store/treesitter-parsers/parser/glimmer.so new file mode 100755 index 00000000..09d434a1 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/glimmer.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/glsl.so b/config/neovim/store/treesitter-parsers/parser/glsl.so new file mode 100755 index 00000000..0c26fe2e Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/glsl.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/gn.so b/config/neovim/store/treesitter-parsers/parser/gn.so new file mode 100755 index 00000000..08b16484 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/gn.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/gnuplot.so b/config/neovim/store/treesitter-parsers/parser/gnuplot.so new file mode 100755 index 00000000..abf6f16e Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/gnuplot.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/go.so b/config/neovim/store/treesitter-parsers/parser/go.so new file mode 100755 index 00000000..678f66f9 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/go.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/godot_resource.so b/config/neovim/store/treesitter-parsers/parser/godot_resource.so new file mode 100755 index 00000000..39052652 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/godot_resource.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/gomod.so b/config/neovim/store/treesitter-parsers/parser/gomod.so new file mode 100755 index 00000000..cc59037a Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/gomod.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/gosum.so b/config/neovim/store/treesitter-parsers/parser/gosum.so new file mode 100755 index 00000000..2a39c472 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/gosum.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/gotmpl.so b/config/neovim/store/treesitter-parsers/parser/gotmpl.so new file mode 100755 index 00000000..bde65bd6 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/gotmpl.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/gowork.so b/config/neovim/store/treesitter-parsers/parser/gowork.so new file mode 100755 index 00000000..40d58286 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/gowork.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/gpg.so b/config/neovim/store/treesitter-parsers/parser/gpg.so new file mode 100755 index 00000000..bc6455b3 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/gpg.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/graphql.so b/config/neovim/store/treesitter-parsers/parser/graphql.so new file mode 100755 index 00000000..299908c2 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/graphql.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/groovy.so b/config/neovim/store/treesitter-parsers/parser/groovy.so new file mode 100755 index 00000000..4a9e770e Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/groovy.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/gstlaunch.so b/config/neovim/store/treesitter-parsers/parser/gstlaunch.so new file mode 100755 index 00000000..bca81dc1 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/gstlaunch.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/hack.so b/config/neovim/store/treesitter-parsers/parser/hack.so new file mode 100755 index 00000000..d9f20c80 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/hack.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/hare.so b/config/neovim/store/treesitter-parsers/parser/hare.so new file mode 100755 index 00000000..ebb1154d Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/hare.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/hcl.so b/config/neovim/store/treesitter-parsers/parser/hcl.so new file mode 100755 index 00000000..ab45352e Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/hcl.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/heex.so b/config/neovim/store/treesitter-parsers/parser/heex.so new file mode 100755 index 00000000..80cdf4e0 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/heex.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/helm.so b/config/neovim/store/treesitter-parsers/parser/helm.so new file mode 100755 index 00000000..9640fd35 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/helm.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/hjson.so b/config/neovim/store/treesitter-parsers/parser/hjson.so new file mode 100755 index 00000000..a25d917b Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/hjson.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/hlsl.so b/config/neovim/store/treesitter-parsers/parser/hlsl.so new file mode 100755 index 00000000..57f72f32 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/hlsl.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/hlsplaylist.so b/config/neovim/store/treesitter-parsers/parser/hlsplaylist.so new file mode 100755 index 00000000..225927b7 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/hlsplaylist.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/hocon.so b/config/neovim/store/treesitter-parsers/parser/hocon.so new file mode 100755 index 00000000..9e9d2c12 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/hocon.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/hoon.so b/config/neovim/store/treesitter-parsers/parser/hoon.so new file mode 100755 index 00000000..c068eba8 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/hoon.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/htmldjango.so b/config/neovim/store/treesitter-parsers/parser/htmldjango.so new file mode 100755 index 00000000..badb39ad Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/htmldjango.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/http.so b/config/neovim/store/treesitter-parsers/parser/http.so new file mode 100755 index 00000000..43b9da2e Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/http.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/hurl.so b/config/neovim/store/treesitter-parsers/parser/hurl.so new file mode 100755 index 00000000..3b6b5b9b Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/hurl.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/hyprlang.so b/config/neovim/store/treesitter-parsers/parser/hyprlang.so new file mode 100755 index 00000000..0e5569fe Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/hyprlang.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/idl.so b/config/neovim/store/treesitter-parsers/parser/idl.so new file mode 100755 index 00000000..a4591fa5 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/idl.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/inko.so b/config/neovim/store/treesitter-parsers/parser/inko.so new file mode 100755 index 00000000..24225ed1 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/inko.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/ispc.so b/config/neovim/store/treesitter-parsers/parser/ispc.so new file mode 100755 index 00000000..f5f6e1a2 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/ispc.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/janet_simple.so b/config/neovim/store/treesitter-parsers/parser/janet_simple.so new file mode 100755 index 00000000..0f11fc67 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/janet_simple.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/jq.so b/config/neovim/store/treesitter-parsers/parser/jq.so new file mode 100755 index 00000000..c0324111 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/jq.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/jsdoc.so b/config/neovim/store/treesitter-parsers/parser/jsdoc.so new file mode 100755 index 00000000..fc19449d Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/jsdoc.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/json5.so b/config/neovim/store/treesitter-parsers/parser/json5.so new file mode 100755 index 00000000..cf105164 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/json5.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/jsonc.so b/config/neovim/store/treesitter-parsers/parser/jsonc.so new file mode 100755 index 00000000..2a911c79 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/jsonc.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/jsonnet.so b/config/neovim/store/treesitter-parsers/parser/jsonnet.so new file mode 100755 index 00000000..7cac6cc4 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/jsonnet.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/just.so b/config/neovim/store/treesitter-parsers/parser/just.so new file mode 100755 index 00000000..d1b8a651 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/just.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/kconfig.so b/config/neovim/store/treesitter-parsers/parser/kconfig.so new file mode 100755 index 00000000..e0fa4667 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/kconfig.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/kdl.so b/config/neovim/store/treesitter-parsers/parser/kdl.so new file mode 100755 index 00000000..d31f4f42 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/kdl.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/koto.so b/config/neovim/store/treesitter-parsers/parser/koto.so new file mode 100755 index 00000000..055314c4 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/koto.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/kusto.so b/config/neovim/store/treesitter-parsers/parser/kusto.so new file mode 100755 index 00000000..af15c153 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/kusto.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/lalrpop.so b/config/neovim/store/treesitter-parsers/parser/lalrpop.so new file mode 100755 index 00000000..20b2e8cd Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/lalrpop.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/latex.so b/config/neovim/store/treesitter-parsers/parser/latex.so new file mode 100755 index 00000000..87956cf6 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/latex.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/ledger.so b/config/neovim/store/treesitter-parsers/parser/ledger.so new file mode 100755 index 00000000..f14a39c6 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/ledger.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/leo.so b/config/neovim/store/treesitter-parsers/parser/leo.so new file mode 100755 index 00000000..bcf7708f Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/leo.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/linkerscript.so b/config/neovim/store/treesitter-parsers/parser/linkerscript.so new file mode 100755 index 00000000..9aceef16 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/linkerscript.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/liquid.so b/config/neovim/store/treesitter-parsers/parser/liquid.so new file mode 100755 index 00000000..47c11f79 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/liquid.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/liquidsoap.so b/config/neovim/store/treesitter-parsers/parser/liquidsoap.so new file mode 100755 index 00000000..055257a6 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/liquidsoap.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/llvm.so b/config/neovim/store/treesitter-parsers/parser/llvm.so new file mode 100755 index 00000000..39d5705c Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/llvm.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/luadoc.so b/config/neovim/store/treesitter-parsers/parser/luadoc.so new file mode 100755 index 00000000..eee360da Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/luadoc.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/luap.so b/config/neovim/store/treesitter-parsers/parser/luap.so new file mode 100755 index 00000000..228a82cb Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/luap.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/luau.so b/config/neovim/store/treesitter-parsers/parser/luau.so new file mode 100755 index 00000000..3644ca7c Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/luau.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/m68k.so b/config/neovim/store/treesitter-parsers/parser/m68k.so new file mode 100755 index 00000000..60b0f98b Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/m68k.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/matlab.so b/config/neovim/store/treesitter-parsers/parser/matlab.so new file mode 100755 index 00000000..b020aacb Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/matlab.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/menhir.so b/config/neovim/store/treesitter-parsers/parser/menhir.so new file mode 100755 index 00000000..81c1f0d1 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/menhir.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/mermaid.so b/config/neovim/store/treesitter-parsers/parser/mermaid.so new file mode 100755 index 00000000..6aa5be6d Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/mermaid.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/meson.so b/config/neovim/store/treesitter-parsers/parser/meson.so new file mode 100755 index 00000000..a7ece949 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/meson.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/mlir.so b/config/neovim/store/treesitter-parsers/parser/mlir.so new file mode 100755 index 00000000..4f05d230 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/mlir.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/muttrc.so b/config/neovim/store/treesitter-parsers/parser/muttrc.so new file mode 100755 index 00000000..4c039868 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/muttrc.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/nickel.so b/config/neovim/store/treesitter-parsers/parser/nickel.so new file mode 100755 index 00000000..15861bd5 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/nickel.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/nim.so b/config/neovim/store/treesitter-parsers/parser/nim.so new file mode 100755 index 00000000..0e3671b8 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/nim.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/nim_format_string.so b/config/neovim/store/treesitter-parsers/parser/nim_format_string.so new file mode 100755 index 00000000..76ecd79a Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/nim_format_string.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/ninja.so b/config/neovim/store/treesitter-parsers/parser/ninja.so new file mode 100755 index 00000000..81ee96c8 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/ninja.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/norg.so b/config/neovim/store/treesitter-parsers/parser/norg.so new file mode 100755 index 00000000..5e4b1bf1 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/norg.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/nqc.so b/config/neovim/store/treesitter-parsers/parser/nqc.so new file mode 100755 index 00000000..7732430f Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/nqc.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/objc.so b/config/neovim/store/treesitter-parsers/parser/objc.so new file mode 100755 index 00000000..2cd73465 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/objc.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/ocaml.so b/config/neovim/store/treesitter-parsers/parser/ocaml.so new file mode 100755 index 00000000..e4e98929 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/ocaml.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/ocaml_interface.so b/config/neovim/store/treesitter-parsers/parser/ocaml_interface.so new file mode 100755 index 00000000..451f747a Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/ocaml_interface.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/ocamllex.so b/config/neovim/store/treesitter-parsers/parser/ocamllex.so new file mode 100755 index 00000000..7ecd4c97 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/ocamllex.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/odin.so b/config/neovim/store/treesitter-parsers/parser/odin.so new file mode 100755 index 00000000..dbd68e7a Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/odin.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/pascal.so b/config/neovim/store/treesitter-parsers/parser/pascal.so new file mode 100755 index 00000000..62216a56 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/pascal.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/pem.so b/config/neovim/store/treesitter-parsers/parser/pem.so new file mode 100755 index 00000000..69ce853d Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/pem.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/php.so b/config/neovim/store/treesitter-parsers/parser/php.so new file mode 100755 index 00000000..dfeae78e Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/php.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/php_only.so b/config/neovim/store/treesitter-parsers/parser/php_only.so new file mode 100755 index 00000000..923f293c Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/php_only.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/phpdoc.so b/config/neovim/store/treesitter-parsers/parser/phpdoc.so new file mode 100755 index 00000000..38dcc38b Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/phpdoc.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/pioasm.so b/config/neovim/store/treesitter-parsers/parser/pioasm.so new file mode 100755 index 00000000..d98d0da6 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/pioasm.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/po.so b/config/neovim/store/treesitter-parsers/parser/po.so new file mode 100755 index 00000000..85a9243f Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/po.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/pod.so b/config/neovim/store/treesitter-parsers/parser/pod.so new file mode 100755 index 00000000..796c707d Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/pod.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/poe_filter.so b/config/neovim/store/treesitter-parsers/parser/poe_filter.so new file mode 100755 index 00000000..50542cf6 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/poe_filter.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/pony.so b/config/neovim/store/treesitter-parsers/parser/pony.so new file mode 100755 index 00000000..7dbccb13 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/pony.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/prisma.so b/config/neovim/store/treesitter-parsers/parser/prisma.so new file mode 100755 index 00000000..67252fe0 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/prisma.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/promql.so b/config/neovim/store/treesitter-parsers/parser/promql.so new file mode 100755 index 00000000..fe39874a Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/promql.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/properties.so b/config/neovim/store/treesitter-parsers/parser/properties.so new file mode 100755 index 00000000..5940a186 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/properties.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/proto.so b/config/neovim/store/treesitter-parsers/parser/proto.so new file mode 100755 index 00000000..c82ac4ac Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/proto.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/prql.so b/config/neovim/store/treesitter-parsers/parser/prql.so new file mode 100755 index 00000000..5f3d59a3 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/prql.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/psv.so b/config/neovim/store/treesitter-parsers/parser/psv.so new file mode 100755 index 00000000..0bb206ab Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/psv.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/pug.so b/config/neovim/store/treesitter-parsers/parser/pug.so new file mode 100755 index 00000000..8b20e656 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/pug.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/puppet.so b/config/neovim/store/treesitter-parsers/parser/puppet.so new file mode 100755 index 00000000..5da719cf Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/puppet.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/purescript.so b/config/neovim/store/treesitter-parsers/parser/purescript.so new file mode 100755 index 00000000..dfdc11c4 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/purescript.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/pymanifest.so b/config/neovim/store/treesitter-parsers/parser/pymanifest.so new file mode 100755 index 00000000..df93daf9 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/pymanifest.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/ql.so b/config/neovim/store/treesitter-parsers/parser/ql.so new file mode 100755 index 00000000..dcc59d76 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/ql.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/qmldir.so b/config/neovim/store/treesitter-parsers/parser/qmldir.so new file mode 100755 index 00000000..a35a05a1 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/qmldir.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/qmljs.so b/config/neovim/store/treesitter-parsers/parser/qmljs.so new file mode 100755 index 00000000..63f3a473 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/qmljs.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/query.so b/config/neovim/store/treesitter-parsers/parser/query.so new file mode 100755 index 00000000..f2c47b4b Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/query.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/racket.so b/config/neovim/store/treesitter-parsers/parser/racket.so new file mode 100755 index 00000000..c2f6dfb9 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/racket.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/rasi.so b/config/neovim/store/treesitter-parsers/parser/rasi.so new file mode 100755 index 00000000..d680c146 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/rasi.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/rbs.so b/config/neovim/store/treesitter-parsers/parser/rbs.so new file mode 100755 index 00000000..996daac3 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/rbs.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/re2c.so b/config/neovim/store/treesitter-parsers/parser/re2c.so new file mode 100755 index 00000000..80e3b7f7 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/re2c.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/readline.so b/config/neovim/store/treesitter-parsers/parser/readline.so new file mode 100755 index 00000000..d46d987c Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/readline.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/rego.so b/config/neovim/store/treesitter-parsers/parser/rego.so new file mode 100755 index 00000000..8be7454a Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/rego.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/rnoweb.so b/config/neovim/store/treesitter-parsers/parser/rnoweb.so new file mode 100755 index 00000000..12b701ae Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/rnoweb.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/robot.so b/config/neovim/store/treesitter-parsers/parser/robot.so new file mode 100755 index 00000000..e1e52b20 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/robot.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/roc.so b/config/neovim/store/treesitter-parsers/parser/roc.so new file mode 100755 index 00000000..28304d59 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/roc.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/ron.so b/config/neovim/store/treesitter-parsers/parser/ron.so new file mode 100755 index 00000000..b66129cf Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/ron.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/rst.so b/config/neovim/store/treesitter-parsers/parser/rst.so new file mode 100755 index 00000000..bf79d855 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/rst.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/scfg.so b/config/neovim/store/treesitter-parsers/parser/scfg.so new file mode 100755 index 00000000..4b1d099d Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/scfg.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/scheme.so b/config/neovim/store/treesitter-parsers/parser/scheme.so new file mode 100755 index 00000000..1377d7fb Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/scheme.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/slang.so b/config/neovim/store/treesitter-parsers/parser/slang.so new file mode 100755 index 00000000..ce71a5c6 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/slang.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/slint.so b/config/neovim/store/treesitter-parsers/parser/slint.so new file mode 100755 index 00000000..a03b1351 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/slint.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/smali.so b/config/neovim/store/treesitter-parsers/parser/smali.so new file mode 100755 index 00000000..8eff6e9e Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/smali.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/smithy.so b/config/neovim/store/treesitter-parsers/parser/smithy.so new file mode 100755 index 00000000..4cb0e8c3 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/smithy.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/snakemake.so b/config/neovim/store/treesitter-parsers/parser/snakemake.so new file mode 100755 index 00000000..1c7837dd Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/snakemake.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/solidity.so b/config/neovim/store/treesitter-parsers/parser/solidity.so new file mode 100755 index 00000000..a693d7e4 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/solidity.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/soql.so b/config/neovim/store/treesitter-parsers/parser/soql.so new file mode 100755 index 00000000..2f7d124c Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/soql.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/sosl.so b/config/neovim/store/treesitter-parsers/parser/sosl.so new file mode 100755 index 00000000..d3e402d7 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/sosl.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/sourcepawn.so b/config/neovim/store/treesitter-parsers/parser/sourcepawn.so new file mode 100755 index 00000000..c368a926 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/sourcepawn.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/sparql.so b/config/neovim/store/treesitter-parsers/parser/sparql.so new file mode 100755 index 00000000..588172a9 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/sparql.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/squirrel.so b/config/neovim/store/treesitter-parsers/parser/squirrel.so new file mode 100755 index 00000000..d62749c5 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/squirrel.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/ssh_config.so b/config/neovim/store/treesitter-parsers/parser/ssh_config.so new file mode 100755 index 00000000..cda16841 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/ssh_config.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/starlark.so b/config/neovim/store/treesitter-parsers/parser/starlark.so new file mode 100755 index 00000000..73ba368b Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/starlark.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/strace.so b/config/neovim/store/treesitter-parsers/parser/strace.so new file mode 100755 index 00000000..b8ff64d8 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/strace.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/styled.so b/config/neovim/store/treesitter-parsers/parser/styled.so new file mode 100755 index 00000000..6878f96f Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/styled.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/supercollider.so b/config/neovim/store/treesitter-parsers/parser/supercollider.so new file mode 100755 index 00000000..bcb0fb98 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/supercollider.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/surface.so b/config/neovim/store/treesitter-parsers/parser/surface.so new file mode 100755 index 00000000..93c816ee Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/surface.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/svelte.so b/config/neovim/store/treesitter-parsers/parser/svelte.so new file mode 100755 index 00000000..603f7dfd Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/svelte.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/swift.so b/config/neovim/store/treesitter-parsers/parser/swift.so new file mode 100755 index 00000000..26c28143 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/swift.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/sxhkdrc.so b/config/neovim/store/treesitter-parsers/parser/sxhkdrc.so new file mode 100755 index 00000000..f59fd323 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/sxhkdrc.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/systemtap.so b/config/neovim/store/treesitter-parsers/parser/systemtap.so new file mode 100755 index 00000000..2de8da67 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/systemtap.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/t32.so b/config/neovim/store/treesitter-parsers/parser/t32.so new file mode 100755 index 00000000..b9646f42 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/t32.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/tablegen.so b/config/neovim/store/treesitter-parsers/parser/tablegen.so new file mode 100755 index 00000000..5e51205d Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/tablegen.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/tact.so b/config/neovim/store/treesitter-parsers/parser/tact.so new file mode 100755 index 00000000..0a3d7428 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/tact.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/tcl.so b/config/neovim/store/treesitter-parsers/parser/tcl.so new file mode 100755 index 00000000..dcdaace8 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/tcl.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/teal.so b/config/neovim/store/treesitter-parsers/parser/teal.so new file mode 100755 index 00000000..03d71741 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/teal.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/templ.so b/config/neovim/store/treesitter-parsers/parser/templ.so new file mode 100755 index 00000000..1e0894c1 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/templ.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/terraform.so b/config/neovim/store/treesitter-parsers/parser/terraform.so new file mode 100755 index 00000000..d09d5e8c Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/terraform.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/textproto.so b/config/neovim/store/treesitter-parsers/parser/textproto.so new file mode 100755 index 00000000..39ce5fdf Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/textproto.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/thrift.so b/config/neovim/store/treesitter-parsers/parser/thrift.so new file mode 100755 index 00000000..56b2498b Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/thrift.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/tiger.so b/config/neovim/store/treesitter-parsers/parser/tiger.so new file mode 100755 index 00000000..8534c139 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/tiger.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/tlaplus.so b/config/neovim/store/treesitter-parsers/parser/tlaplus.so new file mode 100755 index 00000000..e2369faf Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/tlaplus.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/tmux.so b/config/neovim/store/treesitter-parsers/parser/tmux.so new file mode 100755 index 00000000..7f2b9924 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/tmux.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/todotxt.so b/config/neovim/store/treesitter-parsers/parser/todotxt.so new file mode 100755 index 00000000..efaddd6f Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/todotxt.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/tsv.so b/config/neovim/store/treesitter-parsers/parser/tsv.so new file mode 100755 index 00000000..0a0aa957 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/tsv.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/tsx.so b/config/neovim/store/treesitter-parsers/parser/tsx.so new file mode 100755 index 00000000..3c31e6b0 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/tsx.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/turtle.so b/config/neovim/store/treesitter-parsers/parser/turtle.so new file mode 100755 index 00000000..b18470f1 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/turtle.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/twig.so b/config/neovim/store/treesitter-parsers/parser/twig.so new file mode 100755 index 00000000..268003f8 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/twig.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/typespec.so b/config/neovim/store/treesitter-parsers/parser/typespec.so new file mode 100755 index 00000000..b64e514c Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/typespec.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/typoscript.so b/config/neovim/store/treesitter-parsers/parser/typoscript.so new file mode 100755 index 00000000..b8082df0 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/typoscript.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/typst.so b/config/neovim/store/treesitter-parsers/parser/typst.so new file mode 100755 index 00000000..e4fc1dc9 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/typst.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/udev.so b/config/neovim/store/treesitter-parsers/parser/udev.so new file mode 100755 index 00000000..059c278b Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/udev.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/ungrammar.so b/config/neovim/store/treesitter-parsers/parser/ungrammar.so new file mode 100755 index 00000000..8a3da62b Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/ungrammar.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/unison.so b/config/neovim/store/treesitter-parsers/parser/unison.so new file mode 100755 index 00000000..01cbc006 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/unison.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/usd.so b/config/neovim/store/treesitter-parsers/parser/usd.so new file mode 100755 index 00000000..92b2f188 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/usd.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/uxntal.so b/config/neovim/store/treesitter-parsers/parser/uxntal.so new file mode 100755 index 00000000..b033655b Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/uxntal.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/v.so b/config/neovim/store/treesitter-parsers/parser/v.so new file mode 100755 index 00000000..3e15cacd Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/v.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/vala.so b/config/neovim/store/treesitter-parsers/parser/vala.so new file mode 100755 index 00000000..ce7e1055 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/vala.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/vento.so b/config/neovim/store/treesitter-parsers/parser/vento.so new file mode 100755 index 00000000..d3c47ec6 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/vento.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/vhs.so b/config/neovim/store/treesitter-parsers/parser/vhs.so new file mode 100755 index 00000000..2f61afd6 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/vhs.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/vim.so b/config/neovim/store/treesitter-parsers/parser/vim.so new file mode 100755 index 00000000..0edef44b Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/vim.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/vimdoc.so b/config/neovim/store/treesitter-parsers/parser/vimdoc.so new file mode 100755 index 00000000..5e41a59c Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/vimdoc.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/vue.so b/config/neovim/store/treesitter-parsers/parser/vue.so new file mode 100755 index 00000000..d2d53c2f Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/vue.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/wgsl.so b/config/neovim/store/treesitter-parsers/parser/wgsl.so new file mode 100755 index 00000000..2630952e Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/wgsl.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/wgsl_bevy.so b/config/neovim/store/treesitter-parsers/parser/wgsl_bevy.so new file mode 100755 index 00000000..b5dea4be Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/wgsl_bevy.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/wing.so b/config/neovim/store/treesitter-parsers/parser/wing.so new file mode 100755 index 00000000..b3fe665e Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/wing.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/wit.so b/config/neovim/store/treesitter-parsers/parser/wit.so new file mode 100755 index 00000000..5cf84645 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/wit.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/xcompose.so b/config/neovim/store/treesitter-parsers/parser/xcompose.so new file mode 100755 index 00000000..4db91dc2 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/xcompose.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/yang.so b/config/neovim/store/treesitter-parsers/parser/yang.so new file mode 100755 index 00000000..db496e4c Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/yang.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/yuck.so b/config/neovim/store/treesitter-parsers/parser/yuck.so new file mode 100755 index 00000000..a2622425 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/yuck.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/zathurarc.so b/config/neovim/store/treesitter-parsers/parser/zathurarc.so new file mode 100755 index 00000000..c1ddbf21 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/zathurarc.so differ diff --git a/config/neovim/store/treesitter-parsers/parser/zig.so b/config/neovim/store/treesitter-parsers/parser/zig.so new file mode 100755 index 00000000..4b6e38c7 Binary files /dev/null and b/config/neovim/store/treesitter-parsers/parser/zig.so differ