summaryrefslogtreecommitdiff
path: root/lua/bee
diff options
context:
space:
mode:
authorbee <beebeeb5k@gmail.com>2026-05-05 22:37:10 +0530
committerbee <beebeeb5k@gmail.com>2026-05-05 22:37:10 +0530
commit9365a8e96827cbf7bc5adad6d29bcd05b4d761b2 (patch)
tree0998a5dcfc4517e4112a2c589e04ac0dbc1e011b /lua/bee
parent0c50f17133b90c60735f1f51943f51f60372bdd3 (diff)
Migrate from nixcats to nix-wrapper-modules
Diffstat (limited to 'lua/bee')
-rw-r--r--lua/bee/LSPs/init.lua148
-rw-r--r--lua/bee/LSPs/on_attach.lua54
-rw-r--r--lua/bee/format.lua35
-rw-r--r--lua/bee/init.lua80
-rw-r--r--lua/bee/lint.lua18
-rw-r--r--lua/bee/plugins/blink.lua150
-rw-r--r--lua/bee/plugins/git.lua62
-rw-r--r--lua/bee/plugins/init.lua9
-rw-r--r--lua/bee/plugins/oil.lua72
-rw-r--r--lua/bee/plugins/treesitter.lua192
-rw-r--r--lua/bee/plugins/ui.lua69
-rw-r--r--lua/bee/utils/init.lua77
12 files changed, 966 insertions, 0 deletions
diff --git a/lua/bee/LSPs/init.lua b/lua/bee/LSPs/init.lua
new file mode 100644
index 0000000..3bc86a5
--- /dev/null
+++ b/lua/bee/LSPs/init.lua
@@ -0,0 +1,148 @@
+local MP = ...
+local get_nixd_opts = nixInfo(nil, "info", "nixdExtras", "get_configs")
+return {
+ {
+ "mason.nvim",
+ auto_enable = true,
+ priority = 55,
+ on_plugin = { "nvim-lspconfig" },
+ lsp = function(plugin)
+ vim.cmd.MasonInstall(plugin.name)
+ end,
+ },
+ {
+ "nvim-lspconfig",
+ auto_enable = true,
+ priority = 50,
+ lsp = function(plugin)
+ vim.lsp.config(plugin.name, plugin.lsp or {})
+ vim.lsp.enable(plugin.name)
+ end,
+ before = function(_)
+ vim.lsp.config("*", {
+ on_attach = require(MP:relpath("on_attach")),
+ })
+ end,
+ },
+ {
+ "lua_ls",
+ for_cat = "lua",
+ lsp = {
+ filetypes = { "lua" },
+ settings = {
+ Lua = {
+ runtime = { version = "LuaJIT" },
+ formatters = {
+ ignoreComments = true,
+ },
+ signatureHelp = { enabled = true },
+ diagnostics = {
+ globals = { "vim", "make_test" },
+ disable = {},
+ },
+ workspace = {
+ checkThirdParty = false,
+ library = {
+ -- '${3rd}/luv/library',
+ -- unpack(vim.api.nvim_get_runtime_file('', true)),
+ },
+ },
+ completion = {
+ callSnippet = "Replace",
+ },
+ telemetry = { enabled = false },
+ },
+ },
+ },
+ },
+ {
+ "nixd",
+ for_cat = "nix",
+ after = function(_)
+ vim.api.nvim_create_user_command("StartNilLSP", function()
+ vim.lsp.start(vim.lsp.config.nil_ls)
+ end, { desc = "Run nil-ls (when you really need docs for the builtins and nixd refuse)" })
+ end,
+ lsp = {
+ filetypes = { "nix" },
+ settings = {
+ nixd = {
+ nixpkgs = {
+ expr = nixInfo("import <nixpkgs> {}", "info", "nixdExtras", "nixpkgs"),
+ },
+ formatting = {
+ command = { "nixfmt" },
+ },
+ options = {
+ -- (builtins.getFlake "path:${builtins.toString <path_to_system_flake>}").legacyPackages.<system>.nixosConfigurations."<user@host>".options
+ nixos = {
+ expr = get_nixd_opts
+ and get_nixd_opts("nixos", nixInfo(nil, "info", "nixdExtras", "flake-path")),
+ },
+ -- (builtins.getFlake "path:${builtins.toString <path_to_system_flake>}").legacyPackages.<system>.homeConfigurations."<user@host>".options
+ ["home-manager"] = {
+ expr = get_nixd_opts
+ and get_nixd_opts("home-manager", nixInfo(nil, "info", "nixdExtras", "flake-path")), -- <- if flake-path is nil it will be lsp root dir
+ },
+ },
+ diagnostic = {
+ suppress = {
+ "sema-escaping-with",
+ },
+ },
+ },
+ },
+ },
+ },
+ {
+ "clangd",
+ for_cat = "C",
+ lsp = {
+ filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto" },
+ on_attach = function(client, bufnr)
+ require(MP:relpath("on_attach"))(client, bufnr)
+ -- the stuff they were adding that was overriding my on_attach
+ dofile(nixInfo.utils.get_nix_plugin_path("nvim-lspconfig") .. "/lsp/clangd.lua").on_attach(
+ client,
+ bufnr
+ )
+ end,
+ -- unneded thanks to clangd_extensions-nvim I think
+ -- settings = {
+ -- clangd_config = {
+ -- init_options = {
+ -- compilationDatabasePath="./build",
+ -- },
+ -- }
+ -- }
+ },
+ },
+ {
+ "gopls",
+ for_cat = "go",
+ lsp = {
+ filetypes = { "go", "gomod", "gowork", "gotmpl", "templ" },
+ },
+ },
+ {
+ "zls",
+ for_cat = "zig",
+ lsp = {
+ filetypes = { "zig", "zir" },
+ },
+ },
+ {
+ "rust_analyzer",
+ for_cat = "rust",
+ lsp = {
+ filetypes = { "rust" },
+ },
+ },
+ {
+ "bashls",
+ for_cat = "bash",
+ lsp = {
+ filetypes = { "bash", "sh" },
+ },
+ },
+}
diff --git a/lua/bee/LSPs/on_attach.lua b/lua/bee/LSPs/on_attach.lua
new file mode 100644
index 0000000..d4d69e4
--- /dev/null
+++ b/lua/bee/LSPs/on_attach.lua
@@ -0,0 +1,54 @@
+-- vim.api.nvim_create_autocmd('LspAttach', {
+-- group = vim.api.nvim_create_augroup('my-lsp-attach', { clear = true }),
+-- callback = function(event)
+-- require('birdee.LSPs.on_attach')(vim.lsp.get_client_by_id(event.data.client_id), event.buf)
+-- end,
+-- })
+return function(_, bufnr)
+ -- we create a function that lets us more easily define mappings specific
+ -- for LSP related items. It sets the mode, buffer and description for us each time.
+
+ local map = function(keys, func, desc, mode)
+ if desc then
+ desc = "LSP: " .. desc
+ end
+ vim.keymap.set(mode or "n", keys, func, { buffer = bufnr, desc = desc })
+ end
+
+ map("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
+ map("<leader>la", vim.lsp.buf.code_action, "[L]sp [A]ction")
+
+ -- See `:help K` for why this keymap
+ map("K", vim.lsp.buf.hover, "Hover Documentation")
+ map("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
+
+ -- Lesser used LSP functionality
+ map("<leader>wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder")
+ map("<leader>wr", vim.lsp.buf.remove_workspace_folder, "[W]orkspace [R]emove Folder")
+ map("<leader>wl", function()
+ print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
+ end, "[W]orkspace [L]ist Folders")
+
+ -- Create a command `:Format` local to the LSP buffer
+ vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
+ vim.lsp.buf.format()
+ end, { desc = "Format current buffer with LSP" })
+ map("<leader>Fl", ":Format<CR>", "[F]ormat with [l]sp")
+ map("<leader>FL", ":Format<CR>", "[F]ormat with [L]SP")
+ -- The following two autocommands are used to highlight references of the
+ -- word under your cursor when your cursor rests there for a little while.
+ -- See `:help CursorHold` for information about when this is executed
+ -- When you move your cursor, the highlights will be cleared (the second autocommand).
+ -- local client = vim.lsp.get_client_by_id(event.data.client_id)
+ -- if client and client.server_capabilities.documentHighlightProvider then
+ -- vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
+ -- buffer = event.buf,
+ -- callback = vim.lsp.buf.document_highlight,
+ -- })
+
+ -- vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
+ -- buffer = event.buf,
+ -- callback = vim.lsp.buf.clear_references,
+ -- })
+ -- end
+end
diff --git a/lua/bee/format.lua b/lua/bee/format.lua
new file mode 100644
index 0000000..c8d1214
--- /dev/null
+++ b/lua/bee/format.lua
@@ -0,0 +1,35 @@
+return {
+ "conform.nvim",
+ auto_enable = true,
+ event = "FileType",
+ keys = {
+ { "<leader>lf", desc = "[F]ormat [F]ile" },
+ },
+ after = function(_)
+ local conform = require("conform")
+ conform.setup({
+ format_on_save = {
+ timeout_ms = 1000,
+ lsp_format = "fallback",
+ quiet = true,
+ },
+ formatters_by_ft = {
+ lua = { "stylua" },
+ nix = { "nixfmt" },
+ c = { "clang_format" },
+ cpp = { "clang_format" },
+ cmake = { "cmake_format" },
+ -- Use a sub-list to run only the first available formatter
+ javascript = { { "prettierd", "prettier" } },
+ },
+ })
+
+ vim.keymap.set({ "n", "v" }, "<leader>lf", function()
+ conform.format({
+ lsp_fallback = true,
+ async = false,
+ timeout_ms = 1000,
+ })
+ end, { desc = "[L]anguage [F]ormat" })
+ end,
+}
diff --git a/lua/bee/init.lua b/lua/bee/init.lua
new file mode 100644
index 0000000..23991ef
--- /dev/null
+++ b/lua/bee/init.lua
@@ -0,0 +1,80 @@
+local MP = ...
+do
+ local ok
+ ok, _G.nixInfo = pcall(require, vim.g.nix_info_plugin_name)
+ if not ok then
+ package.loaded[vim.g.nix_info_plugin_name] = setmetatable({}, {
+ __call = function(_, default)
+ return default
+ end,
+ })
+ _G.nixInfo = require(vim.g.nix_info_plugin_name)
+ end
+ nixInfo.isNix = vim.g.nix_info_plugin_name ~= nil
+ nixInfo.utils = require(MP:relpath("utils"))
+ nixInfo.lze = setmetatable(require("lze"), getmetatable(require("lzextras")))
+ function nixInfo.get_nix_plugin_path(name)
+ return nixInfo(nil, "plugins", "lazy", name) or nixInfo(nil, "plugins", "start", name)
+ end
+end
+
+nixInfo.lze.register_handlers({
+ nixInfo.utils.auto_enable_handler,
+ nixInfo.utils.for_cat_handler,
+ nixInfo.lze.lsp,
+})
+nixInfo.lze.h.lsp.set_ft_fallback(nixInfo.utils.lsp_ft_fallback)
+nixInfo.lze.load({
+ { import = MP:relpath("plugins") },
+ { import = MP:relpath("format") },
+ { import = MP:relpath("lint") },
+ { import = MP:relpath("LSPs") },
+ {
+ "base46",
+ lazy = false,
+ auto_enable = true,
+ event = "VimEnter",
+ after = function(_)
+ require("base46").setup()
+ end,
+ },
+ {
+ "vim-startuptime",
+ auto_enable = true,
+ cmd = { "StartupTime" },
+ before = function(_)
+ vim.g.startuptime_event_width = 0
+ vim.g.startuptime_tries = 10
+ vim.g.startuptime_exe_path = nixInfo(vim.v.progpath, "progpath")
+ end,
+ },
+ {
+ "mini.surround",
+ auto_enable = true,
+ event = "DeferredUIEnter",
+ after = function(_)
+ require("mini.surround").setup()
+ end,
+ },
+ {
+ "mini.pick",
+ lazy = true,
+ auto_enable = true,
+ keys = {
+ { "<leader>ff", desc = "File finder" },
+ { "<leader>bb", desc = "List open buffers" },
+ { "<leader>sg", desc = "Live grep" },
+ { "<leader>/", desc = "Grep" },
+ },
+ after = function(_)
+ require("mini.pick").setup({
+ vim.keymap.set("n", "<leader>ff", "<cmd>Pick files<cr>", { desc = "File finder" }),
+ vim.keymap.set("n", "<leader>bb", "<cmd>Pick buffers<cr>", { desc = "List open buffers" }),
+ vim.keymap.set("n", "<leader>sg", "<cmd>Pick grep_live<cr>", { desc = "live grep" }),
+ vim.keymap.set("n", "<leader>/", "<cmd>Pick grep<cr>", { desc = "Grep" }),
+ })
+ end,
+ },
+})
+
+vim.cmd.colorscheme("matugen")
diff --git a/lua/bee/lint.lua b/lua/bee/lint.lua
new file mode 100644
index 0000000..d29ea3a
--- /dev/null
+++ b/lua/bee/lint.lua
@@ -0,0 +1,18 @@
+return {
+ "nvim-lint",
+ auto_enable = true,
+ event = "FileType",
+ after = function(_)
+ require("lint").linters_by_ft = {
+ cpp = { "cpplint" },
+ javascript = { "eslint" },
+ typescript = { "eslint" },
+ }
+
+ vim.api.nvim_create_autocmd({ "BufWritePost" }, {
+ callback = function()
+ require("lint").try_lint()
+ end,
+ })
+ end,
+}
diff --git a/lua/bee/plugins/blink.lua b/lua/bee/plugins/blink.lua
new file mode 100644
index 0000000..7fd147b
--- /dev/null
+++ b/lua/bee/plugins/blink.lua
@@ -0,0 +1,150 @@
+local MP = ...
+return {
+ {
+ "luasnip",
+ auto_enable = true,
+ dep_of = { "blink.cmp" },
+ after = function(_)
+ local luasnip = require("luasnip")
+ require("luasnip.loaders.from_vscode").lazy_load()
+ luasnip.config.setup({})
+
+ local ls = require("luasnip")
+ local s = ls.snippet
+ local t = ls.text_node
+ local i = ls.insert_node
+ local extras = require("luasnip.extras")
+ local rep = extras.rep
+ local fmta = require("luasnip.extras.fmt").fmta
+ local c = ls.choice_node
+ local f = ls.function_node
+ local d = ls.dynamic_node
+ local sn = ls.snippet_node
+
+ vim.keymap.set({ "i", "s" }, "<M-n>", function()
+ if ls.choice_active() then
+ ls.change_choice(1)
+ end
+ end)
+ end,
+ },
+ {
+ "colorful-menu.nvim",
+ auto_enable = true,
+ on_plugin = { "blink.cmp" },
+ },
+ {
+ "blink.cmp",
+ auto_enable = true,
+ event = { "InsertEnter", "CmdlineEnter" },
+ after = function(_)
+ require("blink.cmp").setup({
+ keymap = { preset = "default" },
+ cmdline = {
+ enabled = true,
+ completion = {
+ menu = {
+ auto_show = true,
+ },
+ },
+ sources = function()
+ local type = vim.fn.getcmdtype()
+ -- Search forward and backward
+ if type == "/" or type == "?" then
+ return { "buffer" }
+ end
+ -- Commands
+ if type == ":" or type == "@" then
+ return { "cmdline" }
+ end
+ return {}
+ end,
+ },
+ term = {
+ enabled = false,
+ },
+ fuzzy = {
+ sorts = {
+ "exact",
+ "score",
+ "sort_text",
+ },
+ },
+ appearance = {
+ nerd_font_variant = "mono",
+ },
+ signature = {
+ enabled = true,
+ window = {
+ show_documentation = true,
+ },
+ },
+ completion = {
+ menu = {
+ draw = {
+ columns = {
+ { "label", "label_description", gap = 1 },
+ { "srckind" },
+ },
+ treesitter = { "lsp" },
+ components = {
+ srckind = {
+ ellipsis = false,
+ width = { fill = true },
+ text = function(ctx)
+ return ctx.kind
+ end,
+ highlight = function(ctx)
+ return ctx.kind_hl
+ end,
+ },
+ label = {
+ text = function(ctx)
+ return require("colorful-menu").blink_components_text(ctx)
+ end,
+ highlight = function(ctx)
+ return require("colorful-menu").blink_components_highlight(ctx)
+ end,
+ },
+ },
+ },
+ },
+ documentation = {
+ auto_show = true,
+ },
+ },
+ ---@type blink.cmp.SnippetsConfig
+ snippets = {
+ preset = "luasnip",
+ active = function(filter)
+ local snippet = require("luasnip")
+ local blink = require("blink.cmp")
+ if snippet.in_snippet() and not blink.is_visible() then
+ return true
+ else
+ if not snippet.in_snippet() and vim.fn.mode() == "n" then
+ snippet.unlink_current()
+ vim.snippet.stop()
+ end
+ return false
+ end
+ end,
+ },
+ sources = {
+ default = { "lsp", "path", "snippets", "buffer", "omni" },
+ providers = {
+ path = {
+ score_offset = 50,
+ },
+ lsp = {
+ score_offset = 40,
+ },
+ snippets = {
+ score_offset = 40,
+ },
+ },
+ },
+ })
+ end,
+ },
+}
diff --git a/lua/bee/plugins/git.lua b/lua/bee/plugins/git.lua
new file mode 100644
index 0000000..78be9b4
--- /dev/null
+++ b/lua/bee/plugins/git.lua
@@ -0,0 +1,62 @@
+return {
+ {
+ "vim-fugitive",
+ auto_enable = {
+ "vim-fugitive",
+ "vim-rhubarb",
+ },
+ keys = { { "<leader>gg", "<CMD>G<CR>", desc = "Open git" } },
+ cmd = {
+ "G",
+ "Git",
+ "Gdiffsplit",
+ "Gvdiffsplit",
+ "Gedit",
+ "Gread",
+ "Gwrite",
+ "Ggrep",
+ "GMove",
+ "Glgrep",
+ "GRename",
+ "GDelete",
+ "GRemove",
+ "GBrowse",
+ "DiffviewOpen",
+ "DiffviewClose",
+ "DiffviewToggleFiles",
+ "DiffviewFocusFiles",
+ "DiffviewRefresh",
+ "DiffviewFileHistory",
+ },
+ load = function(name)
+ nixInfo.lze.loaders.multi({
+ name,
+ "vim-rhubarb",
+ "diffview.nvim",
+ })
+ end,
+ },
+ {
+ "mini.diff",
+ auto_enable = true,
+ event = "DeferredUIEnter",
+ after = function(_)
+ require("mini.diff").setup({
+ view = {
+ style = "sign",
+ signs = { add = "│", change = "~", delete = "-" },
+ priority = 9,
+ },
+ mappings = {
+ apply = "",
+ reset = "",
+ textobject = "",
+ goto_first = "",
+ goto_prev = "",
+ goto_next = "",
+ goto_last = "",
+ },
+ })
+ end,
+ },
+}
diff --git a/lua/bee/plugins/init.lua b/lua/bee/plugins/init.lua
new file mode 100644
index 0000000..59e0a41
--- /dev/null
+++ b/lua/bee/plugins/init.lua
@@ -0,0 +1,9 @@
+local MP = ...
+
+return {
+ { import = MP:relpath("ui") },
+ { import = MP:relpath("oil") },
+ { import = MP:relpath("git") },
+ { import = MP:relpath("blink") },
+ { import = MP:relpath("treesitter") },
+}
diff --git a/lua/bee/plugins/oil.lua b/lua/bee/plugins/oil.lua
new file mode 100644
index 0000000..5f8c6d6
--- /dev/null
+++ b/lua/bee/plugins/oil.lua
@@ -0,0 +1,72 @@
+return {
+ {
+ "oil.nvim",
+ lazy = true,
+ keys = { { "<leader>o", "<CMD>Oil<CR>", desc = "Open oil" } },
+ auto_enable = true,
+ after = function()
+ vim.g.loaded_netrwPlugin = 1
+ vim.keymap.set("n", "<leader>o", "<cmd>Oil .<CR>", { noremap = true, desc = "Open nvim root directory" })
+ require("oil").setup({
+ keymaps = {
+ ["-"] = "actions.parent",
+ ["<CR>"] = "actions.select",
+ ["<C-v>"] = "actions.select_vsplit",
+ ["<C-s>"] = "actions.select_split",
+ },
+ vim.keymap.set("n", "<leader>o", "<cmd>Oil<cr>", { desc = "Open Oil" }),
+
+ -- Oil will take over directory buffers (e.g. `vim .` or `:e src/`)
+ -- Set to false if you still want to use netrw.
+ default_file_explorer = true,
+ -- Id is automatically added at the beginning, and name at the end
+ -- See :help oil-columns
+ columns = {
+ "icon",
+ "permissions",
+ "size",
+ -- "mtime",
+ },
+ -- Buffer-local options to use for oil buffers
+ buf_options = {
+ buflisted = false,
+ bufhidden = "hide",
+ },
+ -- Window-local options to use for oil buffers
+ win_options = {
+ wrap = false,
+ signcolumn = "no",
+ cursorcolumn = false,
+ foldcolumn = "0",
+ spell = false,
+ list = false,
+ conceallevel = 3,
+ concealcursor = "nvic",
+ },
+ -- Send deleted files to the trash instead of permanently deleting them (:help oil-trash)
+ delete_to_trash = false,
+ -- Skip the confirmation popup for simple operations (:help oil.skip_confirm_for_simple_edits)
+ skip_confirm_for_simple_edits = false,
+ -- Selecting a new/moved/renamed file or directory will prompt you to save changes first
+ -- (:help prompt_save_on_select_new_entry)
+ prompt_save_on_select_new_entry = true,
+ -- Oil will automatically delete hidden buffers after this delay
+ -- You can set the delay to false to disable cleanup entirely
+ -- Note that the cleanup process only starts when none of the oil buffers are currently displayed
+ cleanup_delay_ms = 2000,
+ lsp_file_methods = {
+ -- Time to wait for LSP file operations to complete before skipping
+ timeout_ms = 1000,
+ -- Set to true to autosave buffers that are updated with LSP willRenameFiles
+ -- Set to "unmodified" to only save unmodified buffers
+ autosave_changes = false,
+ },
+ -- Constrain the cursor to the editable parts of the oil buffer
+ -- Set to `false` to disable, or "name" to keep it on the file names
+ constrain_cursor = "editable",
+ -- Set to true to watch the filesystem for changes and reload oil
+ experimental_watch_for_changes = false,
+ })
+ end,
+ },
+}
diff --git a/lua/bee/plugins/treesitter.lua b/lua/bee/plugins/treesitter.lua
new file mode 100644
index 0000000..bfce021
--- /dev/null
+++ b/lua/bee/plugins/treesitter.lua
@@ -0,0 +1,192 @@
+-- Docs say not to lazy load it
+return {
+ {
+ "nvim-treesitter",
+ auto_enable = true,
+ lazy = false,
+ after = function(plugin)
+ ---@param buf integer
+ ---@param language string
+ local function treesitter_try_attach(buf, language)
+ -- check if parser exists and load it
+ if not vim.treesitter.language.add(language) then
+ return false
+ end
+ vim.treesitter.start(buf, language)
+
+ -- enables treesitter based folds
+ vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
+ vim.wo.foldmethod = "expr"
+ -- ensure folds are open to begin with
+ vim.o.foldlevel = 99
+
+ -- enables treesitter based indentation
+ vim.b.did_indent = 1 -- this right here prevents built-in indent scripts from loading
+ vim.bo.indentexpr = "v:lua.require'nvim-treesitter.indent'.get_indent(v:lnum)"
+
+ return true
+ end
+
+ local installable_parsers = nixInfo.isNix or require("nvim-treesitter").get_available()
+ vim.api.nvim_create_autocmd("FileType", {
+ callback = function(args)
+ local buf, filetype = args.buf, args.match
+ local language = vim.treesitter.language.get_lang(filetype)
+ if not language then
+ return
+ end
+
+ if not treesitter_try_attach(buf, language) and not nixInfo.isNix then
+ -- we do something more interesting in nix and don't do this there
+ ---@cast installable_parsers string[]
+ if vim.tbl_contains(installable_parsers, language) then
+ -- not already installed, so try to install them via nvim-treesitter if possible
+ require("nvim-treesitter").install(language):await(function()
+ treesitter_try_attach(buf, language)
+ end)
+ end
+ end
+ end,
+ })
+ end,
+ },
+ {
+ "nvim-treesitter-textobjects",
+ auto_enable = true,
+ lazy = false,
+ before = function(plugin)
+ vim.g.no_plugin_maps = true
+ end,
+ after = function(plugin)
+ require("nvim-treesitter-textobjects").setup({
+ select = {
+ -- Automatically jump forward to textobj, similar to targets.vim
+ lookahead = true,
+ -- You can choose the select mode (default is charwise 'v')
+ --
+ -- Can also be a function which gets passed a table with the keys
+ -- * query_string: eg '@function.inner'
+ -- * method: eg 'v' or 'o'
+ -- and should return the mode ('v', 'V', or '<c-v>') or a table
+ -- mapping query_strings to modes.
+ selection_modes = {
+ ["@parameter.outer"] = "v", -- charwise
+ ["@function.outer"] = "V", -- linewise
+ -- ['@class.outer'] = '<c-v>', -- blockwise
+ },
+ -- If you set this to `true` (default is `false`) then any textobject is
+ -- extended to include preceding or succeeding whitespace. Succeeding
+ -- whitespace has priority in order to act similarly to eg the built-in
+ -- `ap`.
+ --
+ -- Can also be a function which gets passed a table with the keys
+ -- * query_string: eg '@function.inner'
+ -- * selection_mode: eg 'v'
+ -- and should return true of false
+ include_surrounding_whitespace = false,
+ },
+ move = {
+ set_jumps = true,
+ },
+ })
+
+ -- keymaps
+ -- You can use the capture groups defined in `textobjects.scm`
+ vim.keymap.set({ "x", "o" }, "am", function()
+ require("nvim-treesitter-textobjects.select").select_textobject("@function.outer", "textobjects")
+ end)
+ vim.keymap.set({ "x", "o" }, "im", function()
+ require("nvim-treesitter-textobjects.select").select_textobject("@function.inner", "textobjects")
+ end)
+ vim.keymap.set({ "x", "o" }, "ac", function()
+ require("nvim-treesitter-textobjects.select").select_textobject("@class.outer", "textobjects")
+ end)
+ vim.keymap.set({ "x", "o" }, "ic", function()
+ require("nvim-treesitter-textobjects.select").select_textobject("@class.inner", "textobjects")
+ end)
+ -- You can also use captures from other query groups like `locals.scm`
+ vim.keymap.set({ "x", "o" }, "as", function()
+ require("nvim-treesitter-textobjects.select").select_textobject("@local.scope", "locals")
+ end)
+ vim.keymap.set("n", "<leader>a", function()
+ require("nvim-treesitter-textobjects.swap").swap_next("@parameter.inner")
+ end)
+ vim.keymap.set("n", "<leader>A", function()
+ require("nvim-treesitter-textobjects.swap").swap_previous("@parameter.outer")
+ end)
+
+ -- You can use the capture groups defined in `textobjects.scm`
+ vim.keymap.set({ "n", "x", "o" }, "]m", function()
+ require("nvim-treesitter-textobjects.move").goto_next_start("@function.outer", "textobjects")
+ end)
+ vim.keymap.set({ "n", "x", "o" }, "]]", function()
+ require("nvim-treesitter-textobjects.move").goto_next_start("@class.outer", "textobjects")
+ end)
+ -- You can also pass a list to group multiple queries.
+ vim.keymap.set({ "n", "x", "o" }, "]o", function()
+ require("nvim-treesitter-textobjects.move").goto_next_start(
+ { "@loop.inner", "@loop.outer" },
+ "textobjects"
+ )
+ end)
+ -- You can also use captures from other query groups like `locals.scm` or `folds.scm`
+ vim.keymap.set({ "n", "x", "o" }, "]s", function()
+ require("nvim-treesitter-textobjects.move").goto_next_start("@local.scope", "locals")
+ end)
+ vim.keymap.set({ "n", "x", "o" }, "]z", function()
+ require("nvim-treesitter-textobjects.move").goto_next_start("@fold", "folds")
+ end)
+
+ vim.keymap.set({ "n", "x", "o" }, "]M", function()
+ require("nvim-treesitter-textobjects.move").goto_next_end("@function.outer", "textobjects")
+ end)
+ vim.keymap.set({ "n", "x", "o" }, "][", function()
+ require("nvim-treesitter-textobjects.move").goto_next_end("@class.outer", "textobjects")
+ end)
+
+ vim.keymap.set({ "n", "x", "o" }, "[m", function()
+ require("nvim-treesitter-textobjects.move").goto_previous_start("@function.outer", "textobjects")
+ end)
+ vim.keymap.set({ "n", "x", "o" }, "[[", function()
+ require("nvim-treesitter-textobjects.move").goto_previous_start("@class.outer", "textobjects")
+ end)
+
+ vim.keymap.set({ "n", "x", "o" }, "[M", function()
+ require("nvim-treesitter-textobjects.move").goto_previous_end("@function.outer", "textobjects")
+ end)
+ vim.keymap.set({ "n", "x", "o" }, "[]", function()
+ require("nvim-treesitter-textobjects.move").goto_previous_end("@class.outer", "textobjects")
+ end)
+ local ts_repeat_move = require("nvim-treesitter-textobjects.repeatable_move")
+
+ -- Repeat movement with ; and ,
+ -- ensure ; goes forward and , goes backward regardless of the last direction
+ -- vim.keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move_next)
+ -- vim.keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_previous)
+
+ -- vim way: ; goes to the direction you were moving.
+ vim.keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move)
+ vim.keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_opposite)
+
+ -- Optionally, make builtin f, F, t, T also repeatable with ; and ,
+ vim.keymap.set({ "n", "x", "o" }, "f", ts_repeat_move.builtin_f_expr, { expr = true })
+ vim.keymap.set({ "n", "x", "o" }, "F", ts_repeat_move.builtin_F_expr, { expr = true })
+ vim.keymap.set({ "n", "x", "o" }, "t", ts_repeat_move.builtin_t_expr, { expr = true })
+ vim.keymap.set({ "n", "x", "o" }, "T", ts_repeat_move.builtin_T_expr, { expr = true })
+ end,
+ },
+ {
+ "nvim-ts-autotag",
+ auto_enable = true,
+ lazy = false,
+ after = function(plugin)
+ require("nvim-ts-autotag").setup({
+ opts = {
+ enable_close = true,
+ enable_rename = true,
+ enable_close_on_slash = false,
+ },
+ })
+ end,
+ },
+}
diff --git a/lua/bee/plugins/ui.lua b/lua/bee/plugins/ui.lua
new file mode 100644
index 0000000..8ce2a3c
--- /dev/null
+++ b/lua/bee/plugins/ui.lua
@@ -0,0 +1,69 @@
+return {
+ {
+ "lualine.nvim",
+ auto_enable = true,
+ after = function(_)
+ require("lualine").setup({
+ options = {
+ component_separators = { left = "|", right = "|" },
+ section_separators = {},
+ },
+ sections = {
+ lualine_a = {
+ {
+ "mode",
+ fmt = function(mode)
+ return ({
+ ["NORMAL"] = "っ( ' ᵕ ' )っ",
+ ["O-PENDING"] = "っ( º _ º )っ",
+ ["INSERT"] = "っ(>‿<)っ✎",
+ ["VISUAL"] = "っ(⊙‿⊙)っ",
+ ["V-LINE"] = "っ(ò_ó)っ¤=[]::>",
+ ["V-BLOCK"] = "っ[ •̀ ⌂ •́ ]っ",
+ ["REPLACE"] = "っ( O )っ",
+ ["V-REPLACE"] = "っ[ O ]っ",
+ ["COMMAND"] = "っ(ง •̀_•́)ง",
+ ["TERMINAL"] = "っ( ͡° ͜ʖ ͡°)っ",
+ ["EX"] = "っ( ͡ಠ ͜ʖ ͡ಠ)ง",
+ ["SHELL"] = "っ(©_©)っ",
+ ["MORE"] = "っ(°-° )っ",
+ ["CONFIRM"] = "っ( 0_0)?",
+
+ -- ["SELECT"] = "っ(づ。◕‿‿◕。)づ",
+ -- ["S-LINE"] = "っ(づ。◕‿‿◕。)づ¤",
+ -- ["S-BLOCK"] = "っ[づ。◕‿‿◕。]づ",
+ })[mode] or mode
+ end,
+ },
+ },
+ lualine_c = {
+ {
+ "filename",
+ path = 1,
+ },
+ },
+ },
+ inactive_sections = {
+ lualine_a = { "filename" },
+ lualine_b = {},
+ lualine_c = {},
+ lualine_x = {},
+ lualine_y = {},
+ lualine_z = { "location" },
+ },
+ })
+ end,
+ },
+ {
+ "mini.indentscope",
+ auto_enable = true,
+ event = "DeferredUIEnter",
+ after = function(_)
+ require("mini.indentscope").setup({
+ draw = {
+ delay = 200,
+ },
+ })
+ end,
+ },
+}
diff --git a/lua/bee/utils/init.lua b/lua/bee/utils/init.lua
new file mode 100644
index 0000000..4296561
--- /dev/null
+++ b/lua/bee/utils/init.lua
@@ -0,0 +1,77 @@
+local M = {}
+
+local nixInfo = _G.nixInfo or function(default, ...)
+ return default
+end
+
+function M.get_nix_plugin_path(name)
+ if vim.g.nix_info_plugin_name then
+ return nixInfo(nil, "plugins", "lazy", name) or nixInfo(nil, "plugins", "start", name)
+ else
+ return vim.api.nvim_get_runtime_file("pack/*/*/" .. name, false)[1]
+ end
+end
+
+function M.lsp_ft_fallback(name)
+ local nvimlspcfg = M.get_nix_plugin_path("nvim-lspconfig")
+ if not nvimlspcfg then
+ local matches = vim.api.nvim_get_runtime_file("pack/*/*/nvim-lspconfig", false)
+ nvimlspcfg = assert(matches[1], "nvim-lspconfig not found!")
+ end
+ vim.api.nvim_create_user_command("LspGetFiletypesToClipboard", function(opts)
+ local lspname =
+ assert(opts.fargs[1] or vim.fn.getreg("+") or name, "no name to search for provided or in clipboard")
+ local ok, lspcfg = pcall(dofile, nvimlspcfg .. "/lsp/" .. lspname .. ".lua")
+ if not ok or not lspcfg then
+ error("failed to get config for lsp: " .. lspname)
+ end
+ vim.fn.setreg("+", "filetypes = " .. vim.inspect(lspcfg.filetypes or {}) .. ",")
+ end, { nargs = "?" })
+ vim.schedule(function()
+ vim.notify((name or "lsp") .. " not provided filetype", vim.log.levels.WARN)
+ end)
+ return name and dofile(nvimlspcfg .. "/lsp/" .. name .. ".lua").filetypes or {}
+end
+
+M.auto_enable_handler = {
+ spec_field = "auto_enable",
+ set_lazy = false,
+ modify = function(plugin)
+ if vim.g.nix_info_plugin_name then
+ if type(plugin.auto_enable) == "table" then
+ for _, name in pairs(plugin.auto_enable) do
+ if not M.get_nix_plugin_path(name) then
+ plugin.enabled = false
+ break
+ end
+ end
+ elseif type(plugin.auto_enable) == "string" then
+ if not M.get_nix_plugin_path(plugin.auto_enable) then
+ plugin.enabled = false
+ end
+ elseif type(plugin.auto_enable) == "boolean" and plugin.auto_enable then
+ if not M.get_nix_plugin_path(plugin.name) then
+ plugin.enabled = false
+ end
+ end
+ end
+ return plugin
+ end,
+}
+
+M.for_cat_handler = {
+ spec_field = "for_cat",
+ set_lazy = false,
+ modify = function(plugin)
+ if vim.g.nix_info_plugin_name then
+ if type(plugin.for_cat) == "table" then
+ plugin.enabled = nixInfo(plugin.for_cat.default, "settings", "cats", plugin.for_cat.cat)
+ elseif type(plugin.for_cat) == "string" then
+ plugin.enabled = nixInfo(false, "settings", "cats", plugin.for_cat)
+ end
+ end
+ return plugin
+ end,
+}
+
+return M