Skip to content

Commit 8bf9566

Browse files
committed
custom new pane action
+ added config option to control if new pane should be created when one already exists in the same place. default is set to false, i.e. panes will be reused.
1 parent df65c21 commit 8bf9566

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ allowing customisation of build and run commands.
77
Also supports running [lazygit](https://github.com/jesseduffield/lazygit) from
88
within current Neovim session on an overlay terminal.
99

10-
⚠️ [Version 2 Backward Compatibility Broken](#important-notice-backward-compatibility) ⚠️
11-
1210
![preview](.media/screenshot.gif)
1311

1412
## Install & Setup
@@ -21,14 +19,17 @@ Install using your favorite plugin manager. For example, using
2119
And setup it with:
2220
```lua
2321
require('tmux-compile').setup({
24-
-- Overriding default configurations. [OPTIONAL]
25-
save_session = false, -- Save file before action
26-
overlay_sleep = 1, -- Pause before overlay autoclose; seconds
27-
overlay_width_percent = 80, -- Overlay width percentage
28-
overlay_height_percent = 80, -- Overlay height percentage
22+
-- Overriding Default Configurations. [OPTIONAL]
23+
save_session = false, -- Save file before action (:wall)
2924
build_run_window_title = "build", -- Tmux window name for Build/Run
25+
---- same window pane
26+
new_pane_everytime = false, -- Use existing side panes for action, when false
3027
side_width_percent = 50, -- Side pane width percentage
3128
bottom_height_percent = 30, -- Bottom pane height percentage
29+
---- overlay window
30+
overlay_sleep = 1, -- Pause before overlay autoclose; seconds
31+
overlay_width_percent = 80, -- Overlay width percentage
32+
overlay_height_percent = 80, -- Overlay height percentage
3233

3334
-- Languages' Run and Build actions. [REQUIRED]
3435
build_run_config = {

lua/tmux-compile/init.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
local M = {}
77
M.config = {
88
save_session = false,
9-
overlay_sleep = 1,
10-
overlay_width_percent = 80,
11-
overlay_height_percent = 80,
129
build_run_window_title = "build",
10+
new_pane_everytime = false,
1311
side_width_percent = 50,
1412
bottom_height_percent = 30,
13+
overlay_sleep = 1,
14+
overlay_width_percent = 80,
15+
overlay_height_percent = 80,
1516
build_run_config = {}
1617
}
1718

@@ -134,7 +135,7 @@ local function split_window(cmd, side, error_name)
134135
vim.fn.system("tmux selectp " .. direction_lookup[side])
135136
local moved_pane = vim.fn.system("tmux display -p '#{pane_id}'")
136137

137-
if (vim.trim(current_pane) == vim.trim(moved_pane)) then
138+
if (vim.trim(current_pane) == vim.trim(moved_pane) or M.config.new_pane_everytime) then
138139
local parameters = side .. " -l " .. length_percentage[side] .. "%"
139140
vim.fn.system("tmux splitw -" .. parameters .. " '" .. cmd .. "; zsh'")
140141
else

0 commit comments

Comments
 (0)