Skip to content

Commit

Permalink
feat: add option to configure split direction (#134)
Browse files Browse the repository at this point in the history
* feat: add option to configure split direction

* rename + docs + use config instead of globals

* chore(version): bump

---------

Co-authored-by: Ali Shahid <[email protected]>
Co-authored-by: Marco Kellershoff <[email protected]>
  • Loading branch information
3 people authored Aug 14, 2024
1 parent f35a1ef commit c63ad1b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
22 changes: 22 additions & 0 deletions docs/docs/getting-started/setup-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Here is a full example of setting up the Kulala plugin with the `setup` function

```lua title="setup.lua"
require("kulala").setup({
-- split direction
-- possible values: "vertical", "horizontal"
split_direction = "vertical",
-- default_view, body or headers or headers_body
default_view = "body",
-- dev, test, prod, can be anything
Expand Down Expand Up @@ -68,6 +71,25 @@ require("kulala").setup({
})
```

### split_direction

Split direction.

Possible values:

- `vertical`
- `horizontal`

Default: `vertical`

Example:

```lua
require("kulala").setup({
split_direction = "horizontal",
})
```

### default_view

Default view.
Expand Down
3 changes: 3 additions & 0 deletions lua/kulala/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ local FS = require("kulala.utils.fs")
local M = {}

M.defaults = {
-- split direction
-- possible values: "vertical", "horizontal"
split_direction = "vertical",
-- default_view, body or headers or headers_body
default_view = "body",
-- dev, test, prod, can be anything
Expand Down
2 changes: 1 addition & 1 deletion lua/kulala/globals/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local FS = require("kulala.utils.fs")

local M = {}

M.VERSION = "3.0.3"
M.VERSION = "3.1.0"
M.UI_ID = "kulala://ui"
M.SCRATCHPAD_ID = "kulala://scratchpad"
M.HEADERS_FILE = FS.get_plugin_tmp_dir() .. "/headers.txt"
Expand Down
2 changes: 1 addition & 1 deletion lua/kulala/ui/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ end

local open_buffer = function()
local prev_win = vim.api.nvim_get_current_win()
vim.cmd("vsplit " .. GLOBALS.UI_ID)
vim.cmd(CONFIG.get().split_direction .. " " .. GLOBALS.UI_ID)
if CONFIG.get().winbar then
WINBAR.create_winbar(get_win(), get_buffer())
end
Expand Down

0 comments on commit c63ad1b

Please sign in to comment.