summaryrefslogtreecommitdiff
path: root/lua/bee/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lua/bee/plugins')
-rw-r--r--lua/bee/plugins/blink.lua290
-rw-r--r--lua/bee/plugins/git.lua99
-rw-r--r--lua/bee/plugins/init.lua11
-rw-r--r--lua/bee/plugins/oil.lua138
-rw-r--r--lua/bee/plugins/picker.lua62
-rw-r--r--lua/bee/plugins/ui.lua51
6 files changed, 431 insertions, 220 deletions
diff --git a/lua/bee/plugins/blink.lua b/lua/bee/plugins/blink.lua
index 7fd147b..2dae119 100644
--- a/lua/bee/plugins/blink.lua
+++ b/lua/bee/plugins/blink.lua
@@ -1,150 +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({})
+ {
+ "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
+ 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,
- },
+ 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
index 78be9b4..ed696cf 100644
--- a/lua/bee/plugins/git.lua
+++ b/lua/bee/plugins/git.lua
@@ -37,6 +37,25 @@ return {
end,
},
{
+ "neogit",
+ auto_enable = true,
+ keys = { { "<leader>gg", "<CMD>Neogit<CR>", desc = "Open git" } },
+ cmd = { "Neogit" },
+ after = function(_)
+ require("neogit").setup()
+ end,
+ },
+ {
+ "codediff.nvim",
+ auto_enable = true,
+ dep_of = { "neogit" },
+ cmd = "CodeDiff",
+ after = function()
+ require("codediff").setup()
+ end,
+ },
+
+ {
"mini.diff",
auto_enable = true,
event = "DeferredUIEnter",
@@ -59,4 +78,84 @@ return {
})
end,
},
+ {
+ "gitsigns.nvim",
+ auto_enable = true,
+ event = "DeferredUIEnter",
+ after = function(_)
+ require("gitsigns").setup({
+ -- See `:help gitsigns.txt`
+ signs = {
+ add = { text = "+" },
+ change = { text = "~" },
+ delete = { text = "_" },
+ topdelete = { text = "‾" },
+ changedelete = { text = "~" },
+ },
+ on_attach = function(bufnr)
+ local gs = package.loaded.gitsigns
+
+ local function map(mode, l, r, opts)
+ opts = opts or {}
+ opts.buffer = bufnr
+ vim.keymap.set(mode, l, r, opts)
+ end
+
+ -- Navigation
+ map({ "n", "v" }, "]c", function()
+ if vim.wo.diff then
+ return "]c"
+ end
+ vim.schedule(function()
+ gs.next_hunk()
+ end)
+ return "<Ignore>"
+ end, { expr = true, desc = "Jump to next hunk" })
+
+ map({ "n", "v" }, "[c", function()
+ if vim.wo.diff then
+ return "[c"
+ end
+ vim.schedule(function()
+ gs.prev_hunk()
+ end)
+ return "<Ignore>"
+ end, { expr = true, desc = "Jump to previous hunk" })
+
+ -- Actions
+ -- visual mode
+ map("v", "<leader>hs", function()
+ gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
+ end, { desc = "stage git hunk" })
+ map("v", "<leader>hr", function()
+ gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
+ end, { desc = "reset git hunk" })
+ -- normal mode
+ map("n", "<leader>gs", gs.stage_hunk, { desc = "git stage hunk" })
+ map("n", "<leader>gr", gs.reset_hunk, { desc = "git reset hunk" })
+ map("n", "<leader>gS", gs.stage_buffer, { desc = "git Stage buffer" })
+ map("n", "<leader>gu", gs.undo_stage_hunk, { desc = "undo stage hunk" })
+ map("n", "<leader>gR", gs.reset_buffer, { desc = "git Reset buffer" })
+ map("n", "<leader>gp", gs.preview_hunk, { desc = "preview git hunk" })
+ map("n", "<leader>gb", function()
+ gs.blame_line({ full = false })
+ end, { desc = "git blame line" })
+ -- map('n', '<leader>gd', gs.diffthis, { desc = 'git diff against index' })
+ map("n", "<leader>gD", function()
+ gs.diffthis("~")
+ end, { desc = "git diff against last commit" })
+
+ -- Toggles
+ map("n", "<leader>gtb", gs.toggle_current_line_blame, { desc = "toggle git blame line" })
+ map("n", "<leader>gtd", gs.toggle_deleted, { desc = "toggle git show deleted" })
+
+ -- Text object
+ map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", { desc = "select git hunk" })
+ end,
+ })
+ -- vim.cmd([[hi GitSignsAdd guifg=#04de21]])
+ -- vim.cmd([[hi GitSignsChange guifg=#83fce6]])
+ -- vim.cmd([[hi GitSignsDelete guifg=#fa2525]])
+ end,
+ },
}
diff --git a/lua/bee/plugins/init.lua b/lua/bee/plugins/init.lua
index 59e0a41..43d69e0 100644
--- a/lua/bee/plugins/init.lua
+++ b/lua/bee/plugins/init.lua
@@ -1,9 +1,10 @@
local MP = ...
return {
- { import = MP:relpath("ui") },
- { import = MP:relpath("oil") },
- { import = MP:relpath("git") },
- { import = MP:relpath("blink") },
- { import = MP:relpath("treesitter") },
+ { import = MP:relpath("ui") },
+ { import = MP:relpath("oil") },
+ { import = MP:relpath("git") },
+ { import = MP:relpath("blink") },
+ { import = MP:relpath("picker") },
+ { import = MP:relpath("treesitter") },
}
diff --git a/lua/bee/plugins/oil.lua b/lua/bee/plugins/oil.lua
index 5f8c6d6..6a5e69b 100644
--- a/lua/bee/plugins/oil.lua
+++ b/lua/bee/plugins/oil.lua
@@ -1,72 +1,70 @@
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,
- },
+ {
+ "oil.nvim",
+ lazy = false,
+ keys = { { "<leader>o", "<CMD>Oil<CR>", desc = "Open oil" } },
+ cmd = "Oil",
+ auto_enable = true,
+ after = function()
+ vim.g.loaded_netrwPlugin = 1
+ require("oil").setup({
+ keymaps = {
+ ["-"] = "actions.parent",
+ ["<CR>"] = "actions.select",
+ ["<C-v>"] = "actions.select_vsplit",
+ ["<C-s>"] = "actions.select_split",
+ },
+ -- 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/picker.lua b/lua/bee/plugins/picker.lua
new file mode 100644
index 0000000..9d23faa
--- /dev/null
+++ b/lua/bee/plugins/picker.lua
@@ -0,0 +1,62 @@
+return {
+ {
+ "fff.nvim",
+ auto_enable = true,
+ lazy = false, -- the plugin lazy-initialises itself
+ before = function(_)
+ vim.g.fff = {
+ lazy_sync = true,
+ debug = { enabled = false, show_scores = false },
+ }
+ end,
+ keys = {
+ {
+ "ff",
+ function()
+ require("fff").find_files()
+ end,
+ desc = "Find files",
+ },
+ {
+ "fg",
+ function()
+ require("fff").live_grep()
+ end,
+ desc = "Live grep",
+ },
+ {
+ "fz",
+ function()
+ require("fff").live_grep({ grep = { modes = { "fuzzy", "plain" } } })
+ end,
+ desc = "Live fuzy grep",
+ },
+ {
+ "fc",
+ function()
+ require("fff").live_grep({ query = vim.fn.expand("<cword>") })
+ end,
+ desc = "Search current word",
+ },
+ },
+ },
+ {
+ "mini.pick",
+ lazy = true,
+ auto_enable = true,
+ keys = {
+ { "<leader>ff", desc = "File finder" },
+ { "<leader>bb", desc = "List open buffers" },
+ { "<leader>fg", 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,
+ },
+}
diff --git a/lua/bee/plugins/ui.lua b/lua/bee/plugins/ui.lua
index 8ce2a3c..2a5a4fc 100644
--- a/lua/bee/plugins/ui.lua
+++ b/lua/bee/plugins/ui.lua
@@ -1,6 +1,7 @@
return {
{
"lualine.nvim",
+ event = "DeferredUIEnter",
auto_enable = true,
after = function(_)
require("lualine").setup({
@@ -66,4 +67,54 @@ return {
})
end,
},
+ {
+ "hlchunk.nvim",
+ auto_enable = false,
+ event = "DeferredUIEnter",
+ after = function()
+ local ignored_filetypes = {
+ gitcommit = true,
+ oil = true,
+ Neogitstatus = true,
+ TelescopePrompt = true,
+ NvimTree = true,
+ help = true,
+ -- nix = true,
+ }
+
+ require("hlchunk").setup({
+ chunk = {
+ enable = true,
+ priority = 15,
+ -- use_treesitter = true,
+ chars = {
+ horizontal_line = "─",
+ vertical_line = "│",
+ left_top = "┌",
+ left_bottom = "└",
+ right_arrow = "─",
+ },
+ textobject = "",
+ exclude_filetypes = ignored_filetypes,
+ max_file_size = 1024 * 1024,
+ error_sign = false,
+ straight = true,
+ use_treesitter = true,
+ -- animation related
+ duration = 0,
+ delay = 200,
+ },
+ indent = {
+ enable = true,
+ priority = 10,
+ style = { vim.api.nvim_get_hl(0, { name = "Whitespace" }) },
+ use_treesitter = true,
+ exclude_filetypes = ignored_filetypes,
+ chars = { "│" },
+ ahead_lines = 5,
+ delay = 100,
+ },
+ })
+ end,
+ },
}