mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-13 17:40:25 +00:00
Merge pull request #24 from polarmutex/fix-terminal-config
fix send command getting right terminal config
This commit is contained in:
commit
3aa8cd9d57
@ -1,11 +1,10 @@
|
|||||||
|
local harpoon = require('harpoon')
|
||||||
local Path = require("plenary.path")
|
local Path = require("plenary.path")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
terminal_config = terminal_config or { }
|
|
||||||
local terminals = {}
|
local terminals = {}
|
||||||
|
|
||||||
function create_terminal()
|
function create_terminal()
|
||||||
local current_id = vim.fn.bufnr()
|
local current_id = vim.fn.bufnr()
|
||||||
|
|
||||||
vim.cmd(":terminal")
|
vim.cmd(":terminal")
|
||||||
@ -22,8 +21,8 @@ function create_terminal()
|
|||||||
return buf_id, term_id
|
return buf_id, term_id
|
||||||
end
|
end
|
||||||
|
|
||||||
function getCmd(idx)
|
function getCmd(idx)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
function find_terminal(idx)
|
function find_terminal(idx)
|
||||||
@ -43,17 +42,17 @@ function find_terminal(idx)
|
|||||||
return term_handle
|
return term_handle
|
||||||
end
|
end
|
||||||
|
|
||||||
M.gotoTerminal = function(idx)
|
M.gotoTerminal = function(idx)
|
||||||
local term_handle = find_terminal(idx)
|
local term_handle = find_terminal(idx)
|
||||||
|
|
||||||
vim.api.nvim_set_current_buf(term_handle.buf_id)
|
vim.api.nvim_set_current_buf(term_handle.buf_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.sendCommand = function(idx, cmd)
|
M.sendCommand = function(idx, cmd)
|
||||||
local term_handle = find_terminal(idx)
|
local term_handle = find_terminal(idx)
|
||||||
|
|
||||||
if type(cmd) == "number" then
|
if type(cmd) == "number" then
|
||||||
cmd = terminal_config.cmds[cmd]
|
cmd = harpoon.get_term_config().cmds[cmd]
|
||||||
end
|
end
|
||||||
|
|
||||||
if cmd then
|
if cmd then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user