92 lines
3.0 KiB
Lua
92 lines
3.0 KiB
Lua
vim.pack.add({
|
|
{ src = "https://github.com/nvim-mini/mini.nvim" },
|
|
{ src = "https://github.com/neovim/nvim-lspconfig" },
|
|
{ src = "https://github.com/romus204/tree-sitter-manager.nvim" },
|
|
{ src = "https://github.com/brenoprata10/nvim-highlight-colors" },
|
|
{ src = 'https://github.com/metalelf0/kintsugi-nvim' },
|
|
{ src = 'https://github.com/xiyaowong/transparent.nvim' }
|
|
})
|
|
|
|
require("tree-sitter-manager").setup()
|
|
require('nvim-highlight-colors').setup()
|
|
-- Mini setups
|
|
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)),
|
|
}
|
|
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
|
|
}
|
|
}
|
|
})
|
|
|
|
vim.cmd(":HighlightColors Off")
|
|
vim.cmd(":colorscheme kintsugi-dark")
|
|
|
|
-- Lsp specific, uses nvim-lspconfigs with the below
|
|
vim.lsp.enable({ "gopls", "ols" })
|
|
map("n", "L", ":lua vim.diagnostic.open_float()<CR>")
|
|
map("n", "gd", ":lua vim.lsp.buf.definition()<CR>")
|
|
map("n", "<leader>r", ":lua vim.lsp.buf.rename()<CR>")
|
|
map("n", "<leader>a", ":lua vim.lsp.buf.code_action()<CR>")
|
|
-- Mini Keybinds
|
|
map("n", "<leader>f", ":lua MiniPick.builtin.files()<CR>")
|
|
map("n", "<leader>o", ":lua MiniPick.builtin.buffers()<CR>")
|
|
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')
|
|
|
|
-- Create/overwrite the session silently
|
|
require('mini.sessions').write(session_name)
|
|
print("Session '" .. session_name .. "' saved!")
|
|
end
|
|
)
|