What am I doing with my life...
This commit is contained in:
@@ -13,19 +13,53 @@ require('nvim-highlight-colors').setup()
|
||||
require("mini.extra").setup()
|
||||
require("mini.pairs").setup()
|
||||
require('mini.surround').setup()
|
||||
require('mini.sessions').setup()
|
||||
require("mini.statusline").setup()
|
||||
require('mini.basics').setup({options = { extra_ui = true }})
|
||||
require('mini.completion').setup({lsp_completion = { auto_setup = true }})
|
||||
require("mini.pick").setup({
|
||||
window = { config = function()
|
||||
local height = math.floor(0.50 * vim.o.lines)
|
||||
local width = math.floor(0.50 * vim.o.columns)
|
||||
return {
|
||||
anchor = 'NW', height = height, width = width,
|
||||
row = math.floor(0.5 * (vim.o.lines - height)),
|
||||
col = math.floor(0.5 * (vim.o.columns - width)),
|
||||
window = {
|
||||
config = function()
|
||||
local height = math.floor(0.50 * vim.o.lines)
|
||||
local width = math.floor(0.50 * vim.o.columns)
|
||||
return {
|
||||
anchor = 'NW', height = height, width = width,
|
||||
row = math.floor(0.5 * (vim.o.lines - height)),
|
||||
col = math.floor(0.5 * (vim.o.columns - width)),
|
||||
}
|
||||
end
|
||||
},
|
||||
|
||||
-- Add global mappings here
|
||||
mappings = {
|
||||
delete_buffer = {
|
||||
char = '<C-d>',
|
||||
func = function()
|
||||
local pick = require('mini.pick')
|
||||
local current_match = pick.get_picker_matches().current
|
||||
|
||||
-- Safety check: only attempt deletion if the item has a valid buffer number
|
||||
if current_match and current_match.bufnr then
|
||||
local bufnr = current_match.bufnr
|
||||
|
||||
-- Safely delete the buffer
|
||||
vim.api.nvim_buf_delete(bufnr, {})
|
||||
|
||||
-- Instantly remove it from the visible picker list
|
||||
local buffer_items = pick.get_picker_items()
|
||||
for i = #buffer_items, 1, -1 do
|
||||
if buffer_items[i].bufnr == bufnr then
|
||||
table.remove(buffer_items, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
pick.set_picker_items(buffer_items)
|
||||
else
|
||||
vim.notify("Current item is not a buffer", vim.log.levels.WARN)
|
||||
end
|
||||
end
|
||||
}
|
||||
end }
|
||||
}
|
||||
})
|
||||
|
||||
vim.cmd(":HighlightColors Off")
|
||||
@@ -44,13 +78,14 @@ map("n", "<leader>h", ":lua MiniPick.builtin.help()<CR>")
|
||||
map("n", "<leader>d", ":lua MiniExtra.pickers.diagnostic()<CR>")
|
||||
map("n", "<leader>ss", ":lua MiniPick.builtin.grep_live()<CR>")
|
||||
map("n", "<leader>tc", ":HighlightColors Toggle<CR>")
|
||||
map("n", "<leader>pp", ":lua MiniSessions.select()<CR>")
|
||||
map('n', '<leader>pa',
|
||||
function()
|
||||
-- Get the tail (:t) of the current working directory path (the folder name)
|
||||
local session_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':t')
|
||||
|
||||
-- Highlight Overrides
|
||||
-- local bg = "#1b1b1b"
|
||||
-- local border = "#96A6C8"
|
||||
-- vim.api.nvim_set_hl(0, "MiniPickBorder", { bg = bg, fg = border })
|
||||
-- vim.api.nvim_set_hl(0, "MiniPickNormal", { bg = bg })
|
||||
-- Completion popup background
|
||||
-- vim.api.nvim_set_hl(0, "Pmenu", { bg = bg })
|
||||
-- vim.api.nvim_set_hl(0, "NormalFloat", { bg = bg })
|
||||
-- vim.api.nvim_set_hl(0, 'FloatBorder', { bg = bg, fg = border })
|
||||
-- Create/overwrite the session silently
|
||||
require('mini.sessions').write(session_name)
|
||||
print("Session '" .. session_name .. "' saved!")
|
||||
end
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user