TaggedSearchPattern : Attach names to search patterns for easier recall.
| script karma |
Rating 1/3,
Downloaded by 74
|
Comments, bugs, improvements
|
Vim wiki
|
| created by |
| Ingo Karkat |
| |
| script type |
| utility |
| |
| description |
DESCRIPTION
You use text searches are the time in Vim. While it's simple to recall
previous patterns through the cmdline-history, quickly recognizing them can
be hard, especially if it's a long convoluted regular expression that you've
confidently built some hours ago, but now all variants stored in the history
look like nearly identical gibberish.
This plugin allows you to "tag" individual searches with a name, so that these
searches are documented and therefore become easier to recognize and recall.
You can also pre-seed your search history with frequently needed searches.
HOW IT WORKS
Tagged searches reside in the normal search history like all other searches.
The tagging works by prepending a special regular expression branch that never
matches any text.
RELATED WORKS
Inspired by
http://stackoverflow.com/questions/10174171/indicator-to-see-from-which-function-a-search-string-comes/
USAGE
Inside the search command-lines (:/, :?), tag (and un-tag) the current
search with CTRL-T, type the tag name, and store and activate the search with
<Enter> as usual.
Since tagged searches start with the tag, recall is as simple as entering the
search command-line via :/, typing the first letters of the tag and pressing
c_<Up> (repeatedly if there are many).
When you're in the|cmdline-window| via q/, just search for tags via /^{tag-name}.
Or open a filtered view of the search cmdline-window through q_CTRL-T.
CTRL-T Prepend the search-neutral tag expression and position
the cursor before it at the beginning of the
command-line, so that the tag can be entered.
For the tag, stick to alphanumeric characters
(whitespace is okay, too). Do not use characters like
\, &, |, etc. that have a special meaning in a regexp!
When the current search already has been tagged:
Remove the tag and the following search-neutral tag
expression.
You can use CTRL-T CTRL-T to re-tag a tagged search
pattern.
q CTRL-T Open the search command-line window as with q/ and
list only tagged searches. The tag names are
highlighted for easier recognition. As usual, <Enter>
uses the current search pattern under the cursor, or
press CTRL-C to continue editing in Command-line mode. |
| |
| install details |
INSTALLATION
This script is packaged as a vimball. If you have the "gunzip" decompressor
in your PATH, simply edit the *.vba.gz package in Vim; otherwise, decompress
the archive first, e.g. using WinZip. Inside Vim, install by sourcing the
vimball or via the :UseVimball command.
vim TaggedSearchPattern.vba.gz
:so %
To uninstall, use the :RmVimball command.
DEPENDENCIES
- Requires Vim 7.0 or higher.
CONFIGURATION
For a permanent configuration, put the following commands into your vimrc:
To turn off the highlighting of the tag name and search-neutral tag expression
in the search cmdline-window:
let g:TaggedSearchPattern_HighlightTags = 0
To change the highlighting colors, redefine or link the two highlight groups:
highlight link TaggedSearchTag Search
highlight TaggedSearchNeutral ctermfg=Black guifg=White |
| |
script versions (upload new version)
Click on the package to download.
ip used for rating: 54.224.79.93
|