From c677a76ec66d0d4a5cbbc5815dbe8379d5f09954 Mon Sep 17 00:00:00 2001 From: Mat Jones Date: Wed, 19 Apr 2023 06:52:15 -0400 Subject: [PATCH] add wrap() utility function --- README.md | 1 + lua/smart-splits/api.lua | 3 +++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index c340cbd..2308e3b 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,7 @@ require('smart-splits').setup({ -- }, -- direction = 'left'|'right'|'up'|'down', -- split(), -- utility function to split current Neovim pane in the current direction + -- wrap(), -- utility function to wrap to opposite Neovim pane -- } -- NOTE: `at_edge = 'wrap'` is not supported on Kitty terminal -- multiplexer, as there is no way to determine layout via the CLI diff --git a/lua/smart-splits/api.lua b/lua/smart-splits/api.lua index bc4e846..b54ec99 100644 --- a/lua/smart-splits/api.lua +++ b/lua/smart-splits/api.lua @@ -348,6 +348,9 @@ local function move_cursor(direction, opts) split = function() split_edge(direction) end, + wrap = function() + next_win_or_wrap(will_wrap, DirectionKeysReverse[direction]) + end, } at_edge(ctx) return