Santiago
Santiago

Reputation: 452

Perfom a Tmux key combination from Neovim

I'm using a Tmux extension called Floax, and need to activate it from Neovim (only if Neovim is running inside Tmux, otherwise it should perform another action).

So far I manage to create my lua script for the binkdkey, but I'm finding problem for the last part: how do I tell neovim to perform a key combination inside Tmux?

In this case it should trigger Alt+p, I'm trying using tmux send-keys but it's not working:

local function open_floating_window()
  if vim.fn.getenv('TMUX') ~= vim.NIL then
        open_nvim_floating_window()
    else
        vim.fn.system('tmux send-keys -t ! M-p')
    end
end
vim.keymap.set('n','<leader>ft', open_floating_window, { desc = 'Open floating terminal'})

Thank you very much for any insight you could give me.

Upvotes: 0

Views: 35

Answers (0)

Related Questions