Skip to content

Commit 6e250f1

Browse files
authored
Merge pull request #219 from Isrothy/split-layout
Split layout
2 parents bd0cab4 + 0af3fe6 commit 6e250f1

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,13 @@ vim.g.neominimap ={
242242
-- Always fix the width of the split window
243243
fix_width = false, ---@type boolean
244244

245-
---@alias Neominimap.Config.SplitDirection "left" | "right"
245+
-- split mode:
246+
-- left is an alias for topleft - leftmost vertical split, full height
247+
-- right is an alias for botright - rightmost vertical split, full height
248+
-- aboveleft - left split in current window
249+
-- rightbelow - right split in current window
250+
---@alias Neominimap.Config.SplitDirection "left" | "right" |
251+
--- "topleft" | "botright" | "aboveleft" | "rightbelow"
246252
direction = "right", ---@type Neominimap.Config.SplitDirection
247253

248254
---Automatically close the split window when it is the last window

lua/neominimap/config/internal.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ local M = {
6969
-- Always fix the width of the split window
7070
fix_width = false, ---@type boolean
7171

72-
---@alias Neominimap.Config.SplitDirection "left" | "right"
72+
---@alias Neominimap.Config.SplitDirection "left" | "right" | "topleft" | "botright" | "aboveleft" | "rightbelow"
7373
direction = "right", ---@type Neominimap.Config.SplitDirection
7474

7575
---Automatically close the split window when it is the last window

lua/neominimap/window/split/internal.lua

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,20 @@ M.create_minimap_window_in_current_tab = function()
123123

124124
---@type table<Neominimap.Config.SplitDirection, string>
125125
local dir_tbl = {
126-
["right"] = "botright",
127126
["left"] = "topleft",
127+
["right"] = "botright",
128+
["topleft"] = "topleft",
129+
["botright"] = "botright",
130+
["aboveleft"] = "aboveleft",
131+
["rightbelow"] = "rightbelow",
128132
}
129-
vim.cmd(string.format("noau vertical %s %dsplit", dir_tbl[config.split.direction], config:get_minimap_width()))
133+
vim.cmd(
134+
string.format(
135+
"noau vertical %s %dsplit",
136+
dir_tbl[config.split.direction] or "botright",
137+
config:get_minimap_width()
138+
)
139+
)
130140
local mwinid = vim.api.nvim_get_current_win()
131141
util.noautocmd(api.nvim_set_current_win)(winid)
132142

0 commit comments

Comments
 (0)