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.
This commit is contained in:
Marty Oehme 2024-06-07 11:08:56 +02:00
parent 4f67a6d3ca
commit 6d82162f16
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
2 changed files with 46 additions and 24 deletions

View file

@ -107,8 +107,27 @@ return {
})
require("mini.ai").setup()
-- Align tables and other alignable things
-- 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()
@ -119,9 +138,19 @@ return {
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 = "",
@ -150,24 +179,6 @@ return {
starter.gen_hook.aligning("center", "center"),
},
})
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 = {} },
},
})
end,
event = "VimEnter", -- need to load pretty soon for Starter screen
keys = {
@ -176,14 +187,16 @@ return {
function()
require("mini.map").toggle()
end,
silent = true, desc = "minimap" ,
silent = true,
desc = "minimap",
},
{
"<leader>ss",
function()
require("mini.starter").open()
end,
silent = true, desc = "startpage" ,
silent = true,
desc = "startpage",
},
{
"<localleader>w",
@ -192,6 +205,16 @@ return {
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, ..

View file

@ -9,9 +9,8 @@ return {
end,
cmd = "Vifm",
keys = {
{ "<leader>e", "<cmd>Vifm<cr>", desc = "browse files" },
{ "<leader>E", ":Vifm getcwd()<cr>", desc = "browse project" },
{ "<leader>vc", ":Vifm " .. vim.fn.stdpath("config") .. "/lua<cr>", desc = "open config" },
{ "<leader>E", "<cmd>Vifm<cr>", desc = "buffer file browser" },
{ "<leader>vc", ":Vifm " .. vim.fn.stdpath("config") .. "<cr>", desc = "open config" },
},
event = { "BufEnter" },
}, -- integrate file manager