chore(nvim): improve slimux configuration and key mapping

This commit is contained in:
João Paulo Dubas 2024-09-16 17:20:20 -03:00
parent f98a4d5bcf
commit 5e39fc19a8
No known key found for this signature in database

View File

@ -106,28 +106,41 @@ return {
}, },
{ {
'EvWilson/slimux.nvim', 'EvWilson/slimux.nvim',
lazy = true,
opts = function() opts = function()
local slimux = require('slimux') local status_ok, slimux = pcall(require, 'slimux')
if not status_ok then
return {}
end
return { return {
target_socket = slimux.get_tmux_socket(), target_socket = slimux.get_tmux_socket(),
target_pane = string.format('%s.2', slimux.get_tmux_window()), target_pane = string.format('%s.1', slimux.get_tmux_window()),
} }
end, end,
keys = function() keys = function()
local slimux = require('slimux') local status_ok, which_key = pcall(require, 'which-key')
if status_ok then
which_key.add {
{ '<leader>m', group = 'Toggle ter[m]inal' },
}
end
local slimux_status_ok, slimux = pcall(require, 'slimux')
if not slimux_status_ok then
return {}
end
return { return {
{ {
'v', '<leader>xr',
'<leader>r',
slimux.send_highlighted_text, slimux.send_highlighted_text,
mode = 'v',
desc = 'Send currently highlighted text to configured tmux pane', desc = 'Send currently highlighted text to configured tmux pane',
}, },
{ {
'n',
'<leader>r', '<leader>r',
slimux.send_paragraph_text, slimux.send_paragraph_text,
mode = 'n',
desc = 'Send paragraph under cursor to configured tmux pane', desc = 'Send paragraph under cursor to configured tmux pane',
} },
} }
end, end,
}, },