diff --git a/Makefile b/Makefile index bf722f0..93fa3b3 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,7 @@ deps: git clone --depth 1 https://github.com/antoinemadec/FixCursorHold.nvim deps/fixcursorhold git clone --depth 1 https://github.com/mfussenegger/nvim-dap deps/nvimdap git clone --depth 1 https://github.com/rcarriga/nvim-dap-ui deps/nvimdapui + git clone --depth 1 https://github.com/hedyhli/outline.nvim deps/outline test-ci: deps test diff --git a/README.md b/README.md index 9244637..53021f6 100644 --- a/README.md +++ b/README.md @@ -262,6 +262,7 @@ require("no-neck-pain").setup({ -- When `true`, if the tree was opened before enabling the plugin, we will reopen it. reopen = true, }, + -- @link https://github.com/rcarriga/nvim-dap-ui NvimDAPUI = { -- The position of the tree. --- @type "none" @@ -269,6 +270,14 @@ require("no-neck-pain").setup({ -- When `true`, if the tree was opened before enabling the plugin, we will reopen it. reopen = true, }, + -- @link https://github.com/hedyhli/outline.nvim + outline = { + -- The position of the tree. + --- @type "left"|"right" + position = "right", + -- When `true`, if the tree was opened before enabling the plugin, we will reopen it. + reopen = true, + }, }, }) diff --git a/doc/no-neck-pain.txt b/doc/no-neck-pain.txt index f5e8620..041296f 100644 --- a/doc/no-neck-pain.txt +++ b/doc/no-neck-pain.txt @@ -364,6 +364,14 @@ values: -- When `true`, if the tree was opened before enabling the plugin, we will reopen it. reopen = true, }, + -- @link https://github.com/hedyhli/outline.nvim + outline = { + -- The position of the tree. + --- @type "left"|"right" + position = "right", + -- When `true`, if the tree was opened before enabling the plugin, we will reopen it. + reopen = true, + }, }, } diff --git a/lua/no-neck-pain/config.lua b/lua/no-neck-pain/config.lua index bdc526d..1d77211 100644 --- a/lua/no-neck-pain/config.lua +++ b/lua/no-neck-pain/config.lua @@ -300,6 +300,14 @@ NoNeckPain.options = { -- When `true`, if the tree was opened before enabling the plugin, we will reopen it. reopen = true, }, + -- @link https://github.com/hedyhli/outline.nvim + outline = { + -- The position of the tree. + --- @type "left"|"right" + position = "right", + -- When `true`, if the tree was opened before enabling the plugin, we will reopen it. + reopen = true, + }, }, } diff --git a/lua/no-neck-pain/util/constants.lua b/lua/no-neck-pain/util/constants.lua index 78f8156..034b5c6 100644 --- a/lua/no-neck-pain/util/constants.lua +++ b/lua/no-neck-pain/util/constants.lua @@ -67,6 +67,11 @@ Co.INTEGRATIONS = { close = "lua require('dapui').close()", open = "lua require('dapui').open()", }, + outline = { + fileTypePattern = "outline", + close = "Outline", + open = "Outline", + }, } ---Dashboards filetypes that delays the plugin enable step until next buffer entered. diff --git a/scripts/init_with_outline.lua b/scripts/init_with_outline.lua new file mode 100644 index 0000000..4d74bd8 --- /dev/null +++ b/scripts/init_with_outline.lua @@ -0,0 +1,12 @@ +vim.cmd([[let &rtp.=','.getcwd()]]) + +vim.cmd("set rtp+=deps/mini.nvim") +vim.cmd("set rtp+=deps/outline") + +require("mini.test").setup() +require("outline").setup() +require("no-neck-pain").setup({ + width = 1, + minSideBufferWidth = 0, + integrations = { outline = { reopen = true } }, +}) diff --git a/tests/test_API.lua b/tests/test_API.lua index 8c5dac7..fbfbb69 100644 --- a/tests/test_API.lua +++ b/tests/test_API.lua @@ -146,6 +146,10 @@ T["setup"]["sets exposed methods and default options value"] = function() undotree = { position = "left", }, + outline = { + position = "right", + reopen = true, + }, }) end diff --git a/tests/test_integrations.lua b/tests/test_integrations.lua index 4868c19..c019ad2 100644 --- a/tests/test_integrations.lua +++ b/tests/test_integrations.lua @@ -67,6 +67,10 @@ T["setup"]["overrides default values"] = function() position = "left", reopen = false, }, + outline = { + position = "right", + reopen = true, + } }) end @@ -173,6 +177,35 @@ T["neotest"]["keeps sides open"] = function() }) end +T["outline"] = MiniTest.new_set() + +T["outline"]["keeps sides open"] = function() + child.restart({ "-u", "scripts/init_with_outline.lua", "lua/no-neck-pain/main.lua" }) + child.set_size(20, 100) + + Helpers.toggle(child) + + Helpers.expect.equality(Helpers.winsInTab(child), { 1001, 1000, 1002 }) + Helpers.expect.state(child, "tabs[1].wins.main", { + curr = 1000, + left = 1001, + right = 1002, + }) + + child.cmd("Outline") + vim.loop.sleep(50) + + Helpers.expect.state(child, "tabs[1].wins.splits", vim.NIL) + + Helpers.expect.state(child, "tabs[1].wins.integrations.outline", { + close = "Outline", + fileTypePattern = "outline", + id = 1004, + open = "Outline", + width = 40, + }) +end + T["NvimTree"] = MiniTest.new_set() T["NvimTree"]["keeps sides open"] = function() diff --git a/tests/test_tabs.lua b/tests/test_tabs.lua index b7865b1..8c2e6cb 100644 --- a/tests/test_tabs.lua +++ b/tests/test_tabs.lua @@ -505,6 +505,11 @@ T["tabnew/tabclose"]["does not pick tab 1 for the first active tab"] = function( fileTypePattern = "undotree", open = "UndotreeToggle", }, + outline = { + close = "Outline", + fileTypePattern = "outline", + open = "Outline", + }, }, main = { curr = 1000,