Skip to content

Commit df65c21

Browse files
committed
set custom pane length
+ added configs to set custom lengths for the panes
1 parent e12ddf7 commit df65c21

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ And setup it with:
2222
```lua
2323
require('tmux-compile').setup({
2424
-- Overriding default configurations. [OPTIONAL]
25-
save_session = false, -- Save file before action
25+
save_session = false, -- Save file before action
2626
overlay_sleep = 1, -- Pause before overlay autoclose; seconds
2727
overlay_width_percent = 80, -- Overlay width percentage
2828
overlay_height_percent = 80, -- Overlay height percentage
2929
build_run_window_title = "build", -- Tmux window name for Build/Run
30+
side_width_percent = 50, -- Side pane width percentage
31+
bottom_height_percent = 30, -- Bottom pane height percentage
3032

3133
-- Languages' Run and Build actions. [REQUIRED]
3234
build_run_config = {

lua/tmux-compile/init.lua

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ M.config = {
1010
overlay_width_percent = 80,
1111
overlay_height_percent = 80,
1212
build_run_window_title = "build",
13+
side_width_percent = 50,
14+
bottom_height_percent = 30,
1315
build_run_config = {}
1416
}
1517

@@ -123,12 +125,18 @@ local function split_window(cmd, side, error_name)
123125
h = "-R"
124126
}
125127

128+
local length_percentage = {
129+
v = M.config.bottom_height_percent,
130+
h = M.config.side_width_percent
131+
}
132+
126133
local current_pane = vim.fn.system("tmux display -p '#{pane_id}'")
127134
vim.fn.system("tmux selectp " .. direction_lookup[side])
128135
local moved_pane = vim.fn.system("tmux display -p '#{pane_id}'")
129136

130137
if (vim.trim(current_pane) == vim.trim(moved_pane)) then
131-
vim.fn.system("tmux splitw -" .. side .. " '" .. cmd .. "; zsh'")
138+
local parameters = side .. " -l " .. length_percentage[side] .. "%"
139+
vim.fn.system("tmux splitw -" .. parameters .. " '" .. cmd .. "; zsh'")
132140
else
133141
cmd = change_dir(vim.trim(moved_pane)) .. cmd
134142
vim.fn.system("tmux send -t " .. vim.trim(moved_pane) .. " '" .. cmd .. "' C-m")
@@ -205,4 +213,3 @@ end, {
205213

206214
return M
207215

208-

0 commit comments

Comments
 (0)