Install the plugin with your preferred package manager:
require("lazy").setup({
{
"lvim-tech/lvim-shell",
},
})use({
"lvim-tech/lvim-shell",
})local base_config = {
ui = {
float = {
border = { " ", " ", " ", " ", " ", " ", " ", " " },
float_hl = "NormalFloat",
border_hl = "FloatBorder",
blend = 0,
height = 0.9,
width = 0.9,
x = 0.5,
y = 0.5,
backdrop = true,
backdrop_hl = "NormalFloat",
backdrop_blend = 40,
zindex = 50,
},
split = "belowright new",
},
edit_cmd = "edit",
on_close = {},
on_open = {},
mappings = {
split = "<C-x>",
vsplit = "<C-v>",
tabedit = "<C-t>",
edit = "<C-e>",
close = "<q>",
qf = "<C-q>",
},
env = nil,
}local lvim_shell = require("lvim-shell")
local exe_file = "/path/to/shell-script"
-- Split
lvim_shell.split(exe_file, "<CR>", {
-- replace default configuration
})
--Float
lvim_shell.float(exe_file, "<CR>", {
-- replace default configuration
})local lvim_shell = require("lvim-shell")
_G.Neomutt = function(dir)
dir = dir or "."
lvim_shell.split("TERM=kitty-direct neomutt", "<CR>", config)
end
_G.Ranger = function(dir)
dir = dir or "."
lvim_shell.float("ranger --choosefiles=/tmp/lvim-shell " .. dir, "l", config)
end
_G.Vifm = function(dir)
dir = dir or "."
lvim_shell.float("vifm --choose-files /tmp/lvim-shell " .. dir, "l", config)
end
_G.LazyGit = function(dir)
dir = dir or "."
lvim_shell.float("lazygit -w " .. dir, "<CR>", nil)
end
_G.LazyDocker = function()
lvim_shell.float("lazydocker", "<CR>", config)
end
local file_managers = { "Ranger", "Vifm" }
local executable = vim.fn.executable
for _, fm in ipairs(file_managers) do
if executable(vim.fn.tolower(fm)) == 1 then
vim.api.nvim_create_user_command(fm, function(opts)
_G.Ranger[fm](opts.args)
end, {
nargs = "?",
complete = "dir",
})
end
end
vim.api.nvim_create_user_command("Neomutt", function(opts)
_G.Neomutt(opts.args)
end, { nargs = "?" })
vim.api.nvim_create_user_command("LazyGit", function(opts)
_G.LazyGit(opts.args)
end, { nargs = "?" })
vim.api.nvim_create_user_command("LazyDocker", function()
_G.LazyDocker()
end, {})