dotfiles/nvim/.config/nvim/lua/plugins/core.lua
Marty Oehme 6d82162f16
nvim: Switch basic file editor to mini.files
While we can still reach vifm through the `<leader>E` mapping, the basic
`<leader>e` file editor mapping has been switched over to the mini.files
browser.
It works somewhat like oil.nvim, in that you simply get a buffer to work
with that you can delete/move/copy/rename lines in and after doing a
synchronization (with `=`) all changes are actually applied to the
files.
Since I mostly need the quick file opening to do some quick renaming
operation or want to open an adjacent file this seems like the quickest
and most painless option to do so. For larger operations I still have
access to the full vifm experience.
2024-06-07 11:08:56 +02:00

224 lines
5.4 KiB
Lua

return {
-- allow seamless navigation between vim buffers and tmux/wezterm splits
{
"numToStr/Navigator.nvim",
branch = "master",
config = true,
event = "VeryLazy",
keys = {
{
"<c-w>h",
function()
require("Navigator").left()
end,
{ silent = true },
},
{
"<c-w>k",
function()
require("Navigator").up()
end,
{ silent = true },
},
{
"<c-w>l",
function()
require("Navigator").right()
end,
{ silent = true },
},
{
"<c-w>j",
function()
require("Navigator").down()
end,
{ silent = true },
},
{
"<c-w>p",
function()
require("Navigator").previous()
end,
{ silent = true },
},
},
},
-- jump between letters with improved fFtT quicksearch, mimics sneak
{
"folke/flash.nvim",
event = "VeryLazy",
opts = {},
keys = {
{
"s",
mode = { "n", "x" },
function()
require("flash").jump()
end,
desc = "Flash",
},
{
"S",
mode = { "n", "x", "o" },
function()
require("flash").treesitter()
end,
desc = "Flash Treesitter",
},
{
"r",
mode = "o",
function()
require("flash").remote()
end,
desc = "Remote Flash",
},
},
},
-- personal dict improvements for git sync
{ "micarmst/vim-spellsync", event = "VeryLazy" },
{
"folke/which-key.nvim",
config = true,
event = "CursorHold",
},
-- collection of plugins
{
"echasnovski/mini.nvim",
version = "*",
dependencies = { "rktjmp/fwatch.nvim" },
config = function()
-- automatic callback to invoke 'mini.base16' when colorscheme file is changed
local colorsfile = vim.fn.stdpath("state") .. "/colorscheme.lua"
local function source_colors()
if vim.fn.filereadable(colorsfile) == 1 then
vim.cmd("source " .. colorsfile)
end
end
-- set on startup
source_colors()
-- continuously watch colors file for changes
local fwatch = require("fwatch")
fwatch.watch(colorsfile, {
on_event = vim.schedule_wrap(function()
source_colors()
end),
})
require("mini.ai").setup()
-- Align tables and other alignable things
require("mini.align").setup({})
require("mini.bracketed").setup({
{
buffer = { suffix = "b", options = {} },
comment = { suffix = "c", options = {} },
conflict = { suffix = "", options = {} },
diagnostic = { suffix = "d", options = {} },
file = { suffix = "f", options = {} },
indent = { suffix = "", options = {} }, -- disable since we use indentscope above
jump = { suffix = "j", options = {} },
location = { suffix = "l", options = {} },
oldfile = { suffix = "o", options = {} },
quickfix = { suffix = "q", options = {} },
treesitter = { suffix = "t", options = {} },
undo = { suffix = "", options = {} }, -- disable since I don't need it
window = { suffix = "w", options = {} },
yank = { suffix = "y", options = {} },
},
})
require("mini.comment").setup({
hooks = {
pre = function()
-- use treesitter commentstring functionality if it's installed
if require("core.util").is_available("ts_context_commentstring") then
require("ts_context_commentstring.internal").update_commentstring()
end
end,
},
})
require("mini.cursorword").setup({ delay = 500 })
vim.api.nvim_set_hl(0, "MiniCursorword", { bold = true, underline = false })
vim.api.nvim_set_hl(0, "MiniCursorwordCurrent", { bold = true, underline = false })
require("mini.files").setup()
vim.api.nvim_create_autocmd("User", {
pattern = "MiniFilesWindowUpdate",
callback = function(args)
vim.wo[args.data.win_id].number = true
end,
})
require("mini.fuzzy").setup()
require("mini.indentscope").setup({
symbol = "",
draw = { animation = require("mini.indentscope").gen_animation.none() },
options = { indent_at_cursor = false },
})
require("mini.map").setup()
require("mini.move").setup()
require("mini.operators").setup()
require("mini.pairs").setup()
require("mini.trailspace").setup()
local starter = require("mini.starter")
starter.setup({
evaluate_single = true,
items = {
starter.sections.builtin_actions(),
starter.sections.recent_files(10, true),
starter.sections.recent_files(10, false),
-- Use this if you set up 'mini.sessions'
-- starter.sections.sessions(),
starter.sections.telescope(),
},
content_hooks = {
starter.gen_hook.adding_bullet(),
starter.gen_hook.padding(3, 2),
starter.gen_hook.aligning("center", "center"),
},
})
end,
event = "VimEnter", -- need to load pretty soon for Starter screen
keys = {
{
"<leader>sm",
function()
require("mini.map").toggle()
end,
silent = true,
desc = "minimap",
},
{
"<leader>ss",
function()
require("mini.starter").open()
end,
silent = true,
desc = "startpage",
},
{
"<localleader>w",
function()
require("mini.trailspace").trim()
end,
desc = "Trim trailing whitespace",
},
{
"<leader>e",
function()
local mf = require("mini.files")
if not mf.close() then
mf.open()
end
end,
desc = "floating file browser",
},
},
},
-- try to avoid putting files in util buffers, e.g. filetree, aerial, undotree, ..
{ "stevearc/stickybuf.nvim", config = true },
-- make it a little less painful to open really big (>2mb) files by disabling features
-- { "LunarVim/bigfile.nvim", lazy = false },
}