2022-12-27 14:02:03 +01:00
|
|
|
local K = require("my.keymaps")
|
2022-12-27 20:45:43 +01:00
|
|
|
local env = require("my.helpers.env")
|
2022-03-09 19:03:04 +01:00
|
|
|
|
2022-12-27 20:45:43 +01:00
|
|
|
local M = {
|
|
|
|
"preservim/vimux", -- interact with tmux from within vim
|
|
|
|
cmd = { "VimuxPromptCommand", "VimuxRunCommand", "VimuxRunLastCommand" },
|
|
|
|
-- TODO: only enable when actually inside tmux
|
|
|
|
cond = env.vscode.not_active()
|
|
|
|
and env.neovide.not_active()
|
|
|
|
and env.firenvim.not_active(),
|
|
|
|
}
|
|
|
|
|
|
|
|
function M.init()
|
2022-12-27 14:02:03 +01:00
|
|
|
--{{{ Register keybinds
|
2022-12-27 20:45:43 +01:00
|
|
|
K.nmap(
|
|
|
|
"<leader>vp",
|
|
|
|
":VimuxPromptCommand<CR>",
|
|
|
|
"[V]imux: [p]rompt for command"
|
|
|
|
)
|
2022-12-27 14:02:03 +01:00
|
|
|
K.nmap("<leader>vc", ':VimuxRunCommand "clear"<CR>', "[V]imux: [c]lear pane")
|
|
|
|
K.nmap(
|
|
|
|
"<leader>vl",
|
|
|
|
":VimuxRunLastCommand<CR>",
|
|
|
|
"[V]imux: rerun [l]ast command"
|
|
|
|
)
|
|
|
|
--}}}
|
|
|
|
--{{{ Register which-key docs
|
|
|
|
local status, wk = pcall(require, "which-key")
|
|
|
|
|
|
|
|
if status then
|
|
|
|
wk.register({
|
|
|
|
["<leader>v"] = {
|
2022-12-27 20:45:43 +01:00
|
|
|
name = "[V]imux",
|
2022-12-27 14:02:03 +01:00
|
|
|
},
|
|
|
|
})
|
|
|
|
end
|
|
|
|
--}}}
|
2022-03-09 19:03:04 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
return M
|