Enhanced searches, highlights and matches for Vim
Functions matching the pattern /AfterSearch_[0-9]/
will be called in
numeric order after a search operation: /
?
n
N
g
g
.
-
* Searches for the next occurrence of the currently selected visual text. <Plug>SearchPartyVisualFindNext
-
# Searches for the prior occurrence of the currently selected visual text. <Plug>SearchPartyVisualFindPrior
-
& Starts a :substitute using the currently selected visual text. <Plug>SearchPartyVisualFindSubstitute
-
<leader>/ Prompts for a literal string to search for. This does NOT use a regular expression, so the characters you type here will be searched for literally without any magic interpretation. The <Up> key scrolls through prior literal search history. <Plug>SearchPartyFindLiteral
7,12 RSearch foo
Searches for "foo" only within the range from lines 7 through 12, both inclusive. The default range is % (the whole buffer).
-
<leader>mp Prompts for a Search Term and then prompts for Replacement Terms (space separated). The current line is then duplicated as many times as there are replacements, minus one, and the Search Term is then replaced on each line with each successive Replacement.
-
<leader>mar Prompts for a Search Term and a Replace Term and whether you want to use global replacement. The currently highlighted search terms will then have Search Term replaced with Replace Term. This map works in normal mode on the current line and in visual mode on the range given. There is a corresponding command:
:[range] SearchHighlightReplace
Note
|
This feature is experimental and may not work properly or may have adverse side effects. Please contact the plugin developer if you experience any grief with this feature. |
-
<C-L> Temporarily clears search highlight. <Plug>SearchPartyHighlightClear
-
<C-BSlash> Toggles search highlighting. <Plug>SearchPartyHighlightToggle
-
<leader>* Highlights all occurrences of word under the cursor. <Plug>SearchPartyHighlightWord
-
<leader>mah Toggle automatic highlight of all occurrences of word under cursor. NOTE: Update delay determined by 'updatetime' <Plug>SearchPartyToggleAutoHighlightWord
-
<leader>g* Highlights all occurrences of WORD under the cursor. <Plug>SearchPartyHighlightWORD
E.g.:
:g/something/P
Will show the matching lines with all occurrences of something
on those
lines highlighted.
-
<leader>ms Prompts for a pattern and sets the current search to that pattern without moving the cursor to the next match of that pattern. <Plug>SearchPartySetSearch
-
<leader>mm Prompts for a pattern and uses matchadd() to highlight all occurrences of that pattern in the current window. <Plug>SearchPartySetMatch
There are six match patterns available, called SPM1-SPM6 respectively. Using more than six matches will recycle through the SPM set, losing the previous match assigned to that slot.
By default, the terminal palette colours #1-#6 are used for SPM1-SPM6. You can override these by providing lines like this in your ~/.vimrc file:
hi SPM1 ctermbg=123
NoteDo this after you have set your colorscheme.
The following functions and commands are available for Search Party matches:
-
SearchPartyMatchDelete(number) - clear match by number
-
SearchPartyMatchList - list all match patterns
-
SearchPartyMatchNumber(number) - reset match number (1-6)
Mash is a motion activated (lol - er, I mean, when you press n/N/\#/\*/g#/g*) current search match highlighter. Breaking that down for you, it highlights the match under the cursor differently to all the other matches (if you have :set hlsearch activated). If you don’t use hlsearch, then it will still highlight the current match.
SearchParty’s MASH now plays nice with vim-indexed-search