chore(nvim): use slimux to send commands to panes
Instead of sending lines using toggleterm, neovim will send commands/lines using slimux. Also, to keep the config clean, the rest.nvim is deleted for good.
This commit is contained in:
parent
9f362ad837
commit
f98a4d5bcf
@ -104,122 +104,30 @@ return {
|
||||
priority = 1000,
|
||||
config = true,
|
||||
},
|
||||
-- {
|
||||
-- 'rest-nvim/rest.nvim',
|
||||
-- dependencies = { 'luarocks.nvim' },
|
||||
-- ft = {
|
||||
-- 'http',
|
||||
-- 'rest',
|
||||
-- },
|
||||
-- config = function()
|
||||
-- require('rest-nvim').setup {
|
||||
-- client = 'curl',
|
||||
-- custom_dynamic_variables = {},
|
||||
-- encode_url = true,
|
||||
-- env_file = '.env',
|
||||
-- skip_ssl_verification = false,
|
||||
-- highlight = {
|
||||
-- enable = true,
|
||||
-- timeout = 15,
|
||||
-- },
|
||||
-- result = {
|
||||
-- behavior = {
|
||||
-- decode_url = true,
|
||||
-- formatters = {
|
||||
-- json = 'jq',
|
||||
-- html = false,
|
||||
-- },
|
||||
-- show_info = {
|
||||
-- curl_command = true,
|
||||
-- headers = true,
|
||||
-- http_info = true,
|
||||
-- url = true,
|
||||
-- },
|
||||
-- statistics = {
|
||||
-- enable = true,
|
||||
-- stats = {
|
||||
-- { 'total_time', title = 'Time taken:' },
|
||||
-- { 'size_download_t', title = 'Download size:' },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- split = {
|
||||
-- horizontal = false,
|
||||
-- in_place = false,
|
||||
-- },
|
||||
-- },
|
||||
-- }
|
||||
-- end,
|
||||
-- keys = function()
|
||||
-- local status_ok, which_key = pcall(require, 'which-key')
|
||||
-- if status_ok then
|
||||
-- which_key.register {
|
||||
-- ['<leader>t'] = { name = 'Res[t]', _ = 'which_key_ignore' },
|
||||
-- }
|
||||
-- end
|
||||
-- return {
|
||||
-- { '<leader>tr', '<cmd>Rest run<cr>', desc = 'Run the request under cursor' },
|
||||
-- {
|
||||
-- '<leader>tp',
|
||||
-- '<Plug>RestNvimPreview',
|
||||
-- desc = 'Preview the curl command for the request under cursor',
|
||||
-- },
|
||||
-- { '<leader>tl', '<cmd>Rest run last<cr>', desc = 'Re-run the last request' },
|
||||
-- }
|
||||
-- end,
|
||||
-- },
|
||||
{
|
||||
'akinsho/toggleterm.nvim',
|
||||
opts = {
|
||||
size = vim.o.lines * 0.75,
|
||||
open_mapping = [[<c-\>]],
|
||||
hide_numbers = true,
|
||||
shade_filetypes = {},
|
||||
shade_terminals = true,
|
||||
shading_factor = 2,
|
||||
direction = 'horizontal',
|
||||
shell = vim.o.shell,
|
||||
},
|
||||
'EvWilson/slimux.nvim',
|
||||
opts = function()
|
||||
local slimux = require('slimux')
|
||||
return {
|
||||
target_socket = slimux.get_tmux_socket(),
|
||||
target_pane = string.format('%s.2', slimux.get_tmux_window()),
|
||||
}
|
||||
end,
|
||||
keys = function()
|
||||
local status_ok, which_key = pcall(require, 'which-key')
|
||||
if status_ok then
|
||||
which_key.add {
|
||||
{ '<leader>m', group = 'Toggle ter[m]inal' },
|
||||
}
|
||||
end
|
||||
vim.api.nvim_create_autocmd('TermOpen', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-custom-term-open-mapping', { clear = true }),
|
||||
callback = function(args)
|
||||
local bufnr = args.buf
|
||||
local opts = { buffer = bufnr }
|
||||
vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts)
|
||||
vim.keymap.set('t', 'jk', [[<C-\><C-n>]], opts)
|
||||
vim.keymap.set('t', '<C-h>', [[<cmd>wincmd h<cr>]], opts)
|
||||
vim.keymap.set('t', '<C-j>', [[<cmd>wincmd j<cr>]], opts)
|
||||
vim.keymap.set('t', '<C-k>', [[<cmd>wincmd k<cr>]], opts)
|
||||
vim.keymap.set('t', '<C-l>', [[<cmd>wincmd l<cr>]], opts)
|
||||
vim.keymap.set('t', '<C-w>', [[<C-\><C-n><C-w>]], opts)
|
||||
end,
|
||||
})
|
||||
local slimux = require('slimux')
|
||||
return {
|
||||
{
|
||||
'<leader>mh',
|
||||
'<cmd>ToggleTerm direction=horizontal size=' .. tostring(vim.o.lines * 0.75) .. '<cr>',
|
||||
desc = 'Open ter[m]inal [h]orizontally',
|
||||
noremap = true,
|
||||
'v',
|
||||
'<leader>r',
|
||||
slimux.send_highlighted_text,
|
||||
desc = 'Send currently highlighted text to configured tmux pane',
|
||||
},
|
||||
{
|
||||
'<leader>mv',
|
||||
'<cmd>ToggleTerm direction=vertical size=' .. tostring(vim.o.columns * 0.5) .. '<cr>',
|
||||
desc = 'Open ter[m]inal [v]ertically',
|
||||
noremap = true,
|
||||
},
|
||||
{
|
||||
'<leader>mc',
|
||||
'<cmd>ToggleTermSendCurrentLine<cr>',
|
||||
desc = 'Send [c]urrent line under the cursor',
|
||||
noremap = true,
|
||||
},
|
||||
'n',
|
||||
'<leader>r',
|
||||
slimux.send_paragraph_text,
|
||||
desc = 'Send paragraph under cursor to configured tmux pane',
|
||||
}
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user