mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 01:50:27 +00:00
Added harpoon_wrap option to default config as true. Reference this option in list:prev and list:next. When true allows prev and next to wrap the harpoon list, when false it will not wrap the harpoon list.
This commit is contained in:
parent
05edc3ee82
commit
c82d3d5e3d
@ -74,6 +74,7 @@ function M.get_default_config()
|
||||
},
|
||||
|
||||
default = {
|
||||
harpoon_wrap = true,
|
||||
--- select_with_nill allows for a list to call select even if the provided item is nil
|
||||
select_with_nil = false,
|
||||
|
||||
|
@ -171,8 +171,11 @@ end
|
||||
|
||||
function HarpoonList:next()
|
||||
self._index = self._index + 1
|
||||
if self._index > #self.items then
|
||||
print(self._index)
|
||||
if self._index > #self.items and self.config.harpoon_wrap then
|
||||
self._index = 1
|
||||
elseif self._index > #self.items and not self.config.harpoon_wrap then
|
||||
self._index = #self.items
|
||||
end
|
||||
|
||||
self:select(self._index)
|
||||
@ -180,8 +183,11 @@ end
|
||||
|
||||
function HarpoonList:prev()
|
||||
self._index = self._index - 1
|
||||
if self._index < 1 then
|
||||
print(self._index)
|
||||
if self._index < 1 and self.config.harpoon_wrap then
|
||||
self._index = #self.items
|
||||
elseif self._index < 1 and not self.config.harpoon_wrap then
|
||||
self._index = 1
|
||||
end
|
||||
|
||||
self:select(self._index)
|
||||
|
Loading…
x
Reference in New Issue
Block a user