mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 01:50:27 +00:00
Merge pull request #95 from EthanJWright/master
feat(term): configuration to run command automatically on send
This commit is contained in:
commit
c9a613b4e9
@ -137,6 +137,7 @@ require("harpoon").setup({
|
|||||||
global_settings = {
|
global_settings = {
|
||||||
save_on_toggle = false,
|
save_on_toggle = false,
|
||||||
save_on_change = true,
|
save_on_change = true,
|
||||||
|
enter_on_sendcmd = false,
|
||||||
},
|
},
|
||||||
... your other configs ...
|
... your other configs ...
|
||||||
})
|
})
|
||||||
@ -148,6 +149,8 @@ require("harpoon").setup({
|
|||||||
enable this option (on by default) harpoon will not save any changes to your
|
enable this option (on by default) harpoon will not save any changes to your
|
||||||
file. It is very unreliable to save your harpoon on exit (at least that is
|
file. It is very unreliable to save your harpoon on exit (at least that is
|
||||||
what I have found).
|
what I have found).
|
||||||
|
* `enter_on_sendcmd` will set harpoon to run the command immediately as it's
|
||||||
|
passed to the terminal when calling `sendCommand`.
|
||||||
|
|
||||||
#### Preconfigured Terminal Commands
|
#### Preconfigured Terminal Commands
|
||||||
These are project specific commands that you wish to execute on the regular.
|
These are project specific commands that you wish to execute on the regular.
|
||||||
|
@ -156,6 +156,7 @@ M.setup = function(config)
|
|||||||
global_settings = {
|
global_settings = {
|
||||||
["save_on_toggle"] = false,
|
["save_on_toggle"] = false,
|
||||||
["save_on_change"] = true,
|
["save_on_change"] = true,
|
||||||
|
["enter_on_sendcmd"] = false,
|
||||||
},
|
},
|
||||||
}, expand_dir(
|
}, expand_dir(
|
||||||
c_config
|
c_config
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
local harpoon = require("harpoon")
|
local harpoon = require("harpoon")
|
||||||
local log = require("harpoon.dev").log
|
local log = require("harpoon.dev").log
|
||||||
|
local global_config = harpoon.get_global_settings()
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
local terminals = {}
|
local terminals = {}
|
||||||
@ -76,6 +77,10 @@ M.sendCommand = function(idx, cmd, ...)
|
|||||||
cmd = harpoon.get_term_config().cmds[cmd]
|
cmd = harpoon.get_term_config().cmds[cmd]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if global_config.enter_on_sendcmd then
|
||||||
|
cmd = cmd .. "\n"
|
||||||
|
end
|
||||||
|
|
||||||
if cmd then
|
if cmd then
|
||||||
log.debug("sendCommand:", cmd)
|
log.debug("sendCommand:", cmd)
|
||||||
vim.api.nvim_chan_send(term_handle.term_id, string.format(cmd, ...))
|
vim.api.nvim_chan_send(term_handle.term_id, string.format(cmd, ...))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user