feat(nvim): add fm plugin for better file managment integration

This commit is contained in:
Stefan Imhoff
2022-12-23 16:44:45 +01:00
parent da8e34e67d
commit e798e34775
4 changed files with 58 additions and 14 deletions

56
nvim/after/plugin/fm.lua Normal file
View File

@@ -0,0 +1,56 @@
-- https://github.com/is0n/fm-nvim
local opts = { noremap = true, silent = true }
vim.keymap.set("n", "<M-g>", "<CMD>Lazygit<CR>", opts)
vim.keymap.set("n", "<M-l>", "<CMD>Lf<CR>", opts)
vim.keymap.set("n", "<leader>lf", "<CMD>Lf<CR>", opts)
vim.keymap.set("n", "<leader>lg", "<CMD>Lazygit<CR>", opts)
require("fm-nvim").setup({
edit_cmd = "edit",
on_close = {},
on_open = {},
ui = {
default = "float",
float = {
border = "rounded",
float_hl = "Normal",
border_hl = "FloatBorder",
blend = 0,
height = 0.9,
width = 0.9,
x = 0.5,
y = 0.5,
},
split = {
direction = "topleft",
size = 24,
},
},
cmds = {
lf_cmd = "lf",
fm_cmd = "fm",
nnn_cmd = "nnn",
fff_cmd = "fff",
twf_cmd = "twf",
fzf_cmd = "fzf",
fzy_cmd = "find . | fzy",
xplr_cmd = "xplr",
vifm_cmd = "vifm",
skim_cmd = "sk",
broot_cmd = "broot",
gitui_cmd = "gitui",
ranger_cmd = "ranger",
joshuto_cmd = "joshuto",
lazygit_cmd = "lazygit",
neomutt_cmd = "neomutt",
taskwarrior_cmd = "taskwarrior-tui",
},
mappings = {
vert_split = "<C-v>",
horz_split = "<C-h>",
tabedit = "<C-t>",
edit = "<C-e>",
ESC = "<ESC>",
},
})

View File

@@ -4,12 +4,8 @@ local Terminal = require("toggleterm.terminal").Terminal
local opts = { noremap = true, silent = true }
-- Keymaps
vim.keymap.set("n", "<M-g>", "<cmd>lua _LAZYGIT_TOGGLE()<CR>", opts)
vim.keymap.set("n", "<M-l>", "<cmd>lua _LF_TOGGLE()<CR>", opts)
vim.keymap.set("n", "<leader>lg", "<cmd>lua _LAZYGIT_TOGGLE()<CR>", opts)
vim.keymap.set("n", "<leader>ncdu", "<cmd>lua _NCDU_TOGGLE()<CR>", opts)
vim.keymap.set("n", "<leader>node", "<cmd>lua _NODE_TOGGLE()<CR>", opts)
vim.keymap.set("n", "<leader>lf", "<cmd>lua _LF_TOGGLE()<CR>", opts)
vim.keymap.set("n", "<leader>top", "<cmd>lua _HTOP_TOGGLE()<CR>", opts)
vim.keymap.set("n", "<leader>y", "<cmd>lua _PYTHON_TOGGLE()<CR>", opts)
@@ -51,22 +47,12 @@ end
vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()")
local lazygit = Terminal:new({ cmd = "lazygit", hidden = true })
local lf = Terminal:new({ cmd = "lf", hidden = true })
local tig = Terminal:new({ cmd = "tig", hidden = true })
local node = Terminal:new({ cmd = "node", hidden = true })
local ncdu = Terminal:new({ cmd = "ncdu", hidden = true })
local htop = Terminal:new({ cmd = "htop", hidden = true })
local python = Terminal:new({ cmd = "python", hidden = true })
function _LAZYGIT_TOGGLE()
lazygit:toggle()
end
function _LF_TOGGLE()
lf:toggle()
end
function _TIG_TOGGLE()
tig:toggle()
end