diff --git a/lib/search-model.js b/lib/search-model.js
index 396218928..bf25a16a8 100644
--- a/lib/search-model.js
+++ b/lib/search-model.js
@@ -130,11 +130,12 @@ module.exports = class SearchModel {
let currentMatch
const matches = this.matches.slice()
+ const wrap= this.vimState.getConfig("searchWrap")
if (relativeIndex >= 0) {
- currentMatch = matches.find(range => range.start.isGreaterThan(fromPoint)) || this.firstMatch
+ currentMatch = matches.find(range => range.start.isGreaterThan(fromPoint)) || (wrap?this.firstMatch:this.lastMatch)
relativeIndex--
} else {
- currentMatch = matches.reverse().find(range => range.start.isLessThan(fromPoint)) || this.lastMatch
+ currentMatch = matches.reverse().find(range => range.start.isLessThan(fromPoint)) || (wrap?this.lastMatch:this.firstMatch)
relativeIndex++
}
diff --git a/lib/settings.js b/lib/settings.js
index ba785bd08..351f3b1ae 100644
--- a/lib/settings.js
+++ b/lib/settings.js
@@ -290,6 +290,10 @@ module.exports = new Settings("vim-mode-plus", {
description:
"[Can]: `I p`, `A p` to insert at start or end of `preset-occurrence` in paragraph(`p`).
`I` and `A` is operator which take target, you can combine it with any target like `I f`(`a-function`), `A z`(`a-fold`).
[Caution]: `I` and `A` behaves as operator as long as editor has `preset-occurrence`, even if there is no VISIBLE `preset-occurrence` in screen. You might want to `escape` to clear preset-occurrences on editor to make `I` and `A` behave normaly gain.
[Conflicts]: You cannot use normal `I` and `A` when `preset-occurrence` marker is exists.",
},
+ searchWrap:{
+ default: true,
+ description: "Allow search to wrap to top and bottom",
+ },
setCursorToStartOfChangeOnUndoRedo: true,
setCursorToStartOfChangeOnUndoRedoStrategy: {
default: "smart",