summaryrefslogtreecommitdiff
path: root/pkgs/custom-neovim/config/lua/plugins
diff options
context:
space:
mode:
authortriethyl <triethylammonium@pm.me>2025-08-24 11:51:30 -0400
committertriethyl <triethylammonium@pm.me>2025-08-24 11:51:30 -0400
commit3a1bb7c16c3b4efed6ca281017dcc94c48be5f2d (patch)
tree93c97a6c9030d108be51941a04dda7e3082ba1ed /pkgs/custom-neovim/config/lua/plugins
parent570bdd8a41786d1531de7b5116a6dbc0a78c61b3 (diff)
neovim: finished statusline and more
Diffstat (limited to 'pkgs/custom-neovim/config/lua/plugins')
-rw-r--r--pkgs/custom-neovim/config/lua/plugins/auto-session.lua7
-rw-r--r--pkgs/custom-neovim/config/lua/plugins/fidget.lua7
-rw-r--r--pkgs/custom-neovim/config/lua/plugins/heirline.lua24
-rw-r--r--pkgs/custom-neovim/config/lua/plugins/mini-files.lua73
-rw-r--r--pkgs/custom-neovim/config/lua/plugins/mini-pick.lua2
5 files changed, 111 insertions, 2 deletions
diff --git a/pkgs/custom-neovim/config/lua/plugins/auto-session.lua b/pkgs/custom-neovim/config/lua/plugins/auto-session.lua
new file mode 100644
index 0000000..b5a7a07
--- /dev/null
+++ b/pkgs/custom-neovim/config/lua/plugins/auto-session.lua
@@ -0,0 +1,7 @@
+return {
+ "auto-session",
+ lazy = false,
+ after = function ()
+ require("auto-session").setup()
+ end
+}
diff --git a/pkgs/custom-neovim/config/lua/plugins/fidget.lua b/pkgs/custom-neovim/config/lua/plugins/fidget.lua
new file mode 100644
index 0000000..d8b8baf
--- /dev/null
+++ b/pkgs/custom-neovim/config/lua/plugins/fidget.lua
@@ -0,0 +1,7 @@
+return {
+ "fidget.nvim",
+ lazy = false,
+ after = function ()
+ require("fidget").setup()
+ end
+}
diff --git a/pkgs/custom-neovim/config/lua/plugins/heirline.lua b/pkgs/custom-neovim/config/lua/plugins/heirline.lua
index bc0a503..6160c94 100644
--- a/pkgs/custom-neovim/config/lua/plugins/heirline.lua
+++ b/pkgs/custom-neovim/config/lua/plugins/heirline.lua
@@ -1,5 +1,6 @@
return {
"heirline.nvim",
+ enabled = false,
lazy = false,
after = function ()
-- Extra stuff from heirline.
@@ -206,7 +207,26 @@ return {
hl = { fg = "blue", bold = true },
}
- -- Git component.
+ -- Git branch component.
+ components.git_branch = {
+ -- condition = conditions.is_git_repo,
+ --
+ -- init = function (self)
+ -- self.branch = vim.b.minigit_summary.head_name or nil
+ -- end,
+
+ provider = function (self)
+ local branch = vim.b.minigit_summary.head_name or nil
+ if branch then
+ local icon = using_icons and " " or "branch: "
+ return icon .. branch
+ else
+ return "none"
+ end
+ end
+ }
+
+ -- Git status component.
components.git_status = {
condition = conditions.is_git_repo,
@@ -286,7 +306,7 @@ return {
-- Assemble statusline.
local statusline = {
components.mode, space,
- components.git, space,
+ components.git_branch, space,
components.cwd, space,
components.diagnostics,
diff --git a/pkgs/custom-neovim/config/lua/plugins/mini-files.lua b/pkgs/custom-neovim/config/lua/plugins/mini-files.lua
index d9b7d41..0dc977a 100644
--- a/pkgs/custom-neovim/config/lua/plugins/mini-files.lua
+++ b/pkgs/custom-neovim/config/lua/plugins/mini-files.lua
@@ -11,5 +11,78 @@ return {
preview = true,
},
}
+
+ -- Add functionality
+
+ -- Set focused directory as current working directory
+ local set_cwd = function()
+ local path = (MiniFiles.get_fs_entry() or {}).path
+ if path == nil then return vim.notify('Cursor is not on valid entry') end
+ vim.fn.chdir(vim.fs.dirname(path))
+ end
+
+ -- Yank in register full path of entry under cursor
+ local yank_path = function()
+ local path = (MiniFiles.get_fs_entry() or {}).path
+ if path == nil then return vim.notify('Cursor is not on valid entry') end
+ vim.fn.setreg(vim.v.register, path)
+ end
+
+ -- Open path with system default handler (useful for non-text files)
+ local ui_open = function() vim.ui.open(MiniFiles.get_fs_entry().path) end
+
+ vim.api.nvim_create_autocmd('User', {
+ pattern = 'MiniFilesBufferCreate',
+ callback = function(args)
+ local b = args.data.buf_id
+ vim.keymap.set('n', 'g~', set_cwd, { buffer = b, desc = 'Set cwd' })
+ vim.keymap.set('n', 'gX', ui_open, { buffer = b, desc = 'OS open' })
+ vim.keymap.set('n', 'gy', yank_path, { buffer = b, desc = 'Yank path' })
+ end,
+ })
+
+ -- Add custom bookmarks.
+ local set_mark = function(id, path, desc)
+ MiniFiles.set_bookmark(id, path, { desc = desc })
+ end
+
+ vim.api.nvim_create_autocmd('User', {
+ pattern = 'MiniFilesExplorerOpen',
+ callback = function()
+ set_mark('w', vim.fn.getcwd, 'Working directory') -- callable
+ set_mark('~', '~', 'Home directory')
+ end,
+ })
+
+ -- Add split keys
+ local map_split = function(buf_id, lhs, direction)
+ local rhs = function()
+ -- Make new window and set it as target
+ local cur_target = MiniFiles.get_explorer_state().target_window
+ local new_target = vim.api.nvim_win_call(cur_target, function()
+ vim.cmd(direction .. ' split')
+ return vim.api.nvim_get_current_win()
+ end)
+
+ MiniFiles.set_target_window(new_target)
+
+ MiniFiles.go_in()
+ end
+
+ -- Adding `desc` will result into `show_help` entries
+ local desc = 'Split ' .. direction
+ vim.keymap.set('n', lhs, rhs, { buffer = buf_id, desc = desc })
+ end
+
+ vim.api.nvim_create_autocmd('User', {
+ pattern = 'MiniFilesBufferCreate',
+ callback = function(args)
+ local buf_id = args.data.buf_id
+ -- Tweak keys to your liking
+ map_split(buf_id, '<C-s>', 'belowright horizontal')
+ map_split(buf_id, '<C-v>', 'belowright vertical')
+ map_split(buf_id, '<C-t>', 'tab')
+ end,
+ })
end
}
diff --git a/pkgs/custom-neovim/config/lua/plugins/mini-pick.lua b/pkgs/custom-neovim/config/lua/plugins/mini-pick.lua
index 25f88de..68e57ec 100644
--- a/pkgs/custom-neovim/config/lua/plugins/mini-pick.lua
+++ b/pkgs/custom-neovim/config/lua/plugins/mini-pick.lua
@@ -19,5 +19,7 @@ return {
}
vim.cmd.packadd("mini.extra")
require("mini.extra").setup()
+
+ vim.ui.select = MiniPick.ui_select
end
}