From c63ad1bfd45b794a3b6c7ad5e727578768c25909 Mon Sep 17 00:00:00 2001 From: Ali Shahid <41078534+shaeinst@users.noreply.github.com> Date: Wed, 14 Aug 2024 21:29:26 +0400 Subject: [PATCH] feat: add option to configure split direction (#134) * feat: add option to configure split direction * rename + docs + use config instead of globals * chore(version): bump --------- Co-authored-by: Ali Shahid Co-authored-by: Marco Kellershoff --- docs/docs/getting-started/setup-options.md | 22 ++++++++++++++++++++++ lua/kulala/config/init.lua | 3 +++ lua/kulala/globals/init.lua | 2 +- lua/kulala/ui/init.lua | 2 +- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/docs/docs/getting-started/setup-options.md b/docs/docs/getting-started/setup-options.md index 831267b..f878177 100644 --- a/docs/docs/getting-started/setup-options.md +++ b/docs/docs/getting-started/setup-options.md @@ -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 @@ -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. diff --git a/lua/kulala/config/init.lua b/lua/kulala/config/init.lua index 0bd5abd..6f5a6a4 100644 --- a/lua/kulala/config/init.lua +++ b/lua/kulala/config/init.lua @@ -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 diff --git a/lua/kulala/globals/init.lua b/lua/kulala/globals/init.lua index 768728b..45c5280 100644 --- a/lua/kulala/globals/init.lua +++ b/lua/kulala/globals/init.lua @@ -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" diff --git a/lua/kulala/ui/init.lua b/lua/kulala/ui/init.lua index 7a8f0d2..f85506b 100644 --- a/lua/kulala/ui/init.lua +++ b/lua/kulala/ui/init.lua @@ -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