mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-13 17:40:25 +00:00
refactor(cleanup): cleaned up some code in term and tmux modules
Also styled init.lua.
This commit is contained in:
parent
51d68e2ec6
commit
02e91845bb
@ -160,13 +160,7 @@ M.setup = function(config)
|
||||
["tmux_autoclose_windows"] = false,
|
||||
["excluded_filetypes"] = { "harpoon" },
|
||||
},
|
||||
}, expand_dir(
|
||||
c_config
|
||||
), expand_dir(
|
||||
u_config
|
||||
), expand_dir(
|
||||
config
|
||||
))
|
||||
}, expand_dir(c_config), expand_dir(u_config), expand_dir(config))
|
||||
|
||||
-- There was this issue where the vim.loop.cwd() didn't have marks or term, but had
|
||||
-- an object for vim.loop.cwd()
|
||||
|
@ -40,6 +40,7 @@ local function find_terminal(args)
|
||||
if not term_handle or not vim.api.nvim_buf_is_valid(term_handle.buf_id) then
|
||||
local buf_id, term_id = create_terminal(args.create_with)
|
||||
if buf_id == nil then
|
||||
error("Failed to find and create terminal.")
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -51,6 +51,8 @@ local function terminal_exists(window_id)
|
||||
"list-windows",
|
||||
}, vim.loop.cwd())
|
||||
|
||||
-- This has to be done this way because tmux has-session does not give
|
||||
-- updated results
|
||||
for _, line in pairs(window_list) do
|
||||
local window_info = utils.split_string(line, "@")[1]
|
||||
|
||||
@ -80,6 +82,7 @@ local function find_terminal(args)
|
||||
local window_id = create_terminal()
|
||||
|
||||
if window_id == nil then
|
||||
error("Failed to find and create tmux window.")
|
||||
return
|
||||
end
|
||||
|
||||
@ -107,7 +110,7 @@ M.gotoTerminal = function(idx)
|
||||
log.trace("tmux: gotoTerminal(): Window:", idx)
|
||||
local window_handle = find_terminal(idx)
|
||||
|
||||
local _, _, _ = utils.get_os_command_output({
|
||||
utils.get_os_command_output({
|
||||
"tmux",
|
||||
"select-window",
|
||||
"-t",
|
||||
@ -146,7 +149,7 @@ M.clear_all = function()
|
||||
|
||||
for _, window in pairs(tmux_windows) do
|
||||
-- Delete the current tmux window
|
||||
local _, _, _ = utils.get_os_command_output({
|
||||
utils.get_os_command_output({
|
||||
"tmux",
|
||||
"kill-window",
|
||||
"-t",
|
||||
|
Loading…
x
Reference in New Issue
Block a user