Provide better search functionality by capturing all matched line
VimL
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
plugin
README

README

This is a mirror of http://www.vim.org/scripts/script.php?script_id=4241

This script will now only updated @ github
You may get it from 
https://github.com/kenng/vim-bettersearch

** note: tested in Linux/MS window environment using GVIM **
** note: BetterSearchVisualSelect command is found working in Linux, but might not working in MS Window environment at the moment ** 

Problem: 
Having a large file and you need to search for a few keywords from it? 
And wish that you can at once glance all the search result? 
Best with highlight on the keyword? 
And you would wish to jump to that particular line when you see something interesting?
Here is a good news for you! : )
Solution approach: works somewhat similarly to notepad++ search function

Features offered by betterSearch: 
- This script is written to copy all the search result and put it to window above the content. 
- If the line number is switch on, the search result is 'jumpable' to the content window by just enter on that particular search line
- Search term highlight can be switched on and off
- Search keyword can be saved to clipboard

There are a few way to use the function of this script.
[ usage 1 ]  
User intended to type in the search words
:BetterSearchPromptOn
then <ENTER>. 
A window will pop up for user input. 
The user input can consists of more than one search term. For example: search_A|search_B|search_C...

[ usage 2 ] 
User intended to use the word under the cursor as the search term
:BetterSearchPromptOn    
then <ENTER>. and press <ENTER> again when the user input dialog box appear without type in any word

[ usage 3 ] 
User intended to use the word highlighted in visual mode
Hightlight the word, then type
:BetterSearchVisualSelect
then <ENTER>. 

[ jump to line ]
A search window will be open up on top of the current window. 
Press <ENTER> on that particular line to jump to the content window.

[ other commands ]
Other command available by the script. (or press F1 when the focus/cursor is at the search window)
':BetterSearchSwitchWin'        - to switch between the 'Search Window' and the 'Content Window'
':BetterSearchVisualSelect'     - to search based on the visually selected word
':BetterSearchHighlighToggle'   - to toggle keyword highlight on off (default is on)
':BetterSearchHighlightLimit'    - to toggle line limit to switch off keyword highlight, for efficiency purpose, 
                               - especially for large matched, default is 5000 line
':BetterSearchCopyToClipBoard' - to toggle whether to save to the search words to clipboard, default is off

[ mapping ]
Suggest to map following in .vimrc, e.g: 
nnoremap <A-S-F7> :BetterSearchPromptOn<CR>
vnoremap <A-S-F7> :BetterSearchVisualSelect<CR>
nnoremap <A-w>  :BetterSearchSwitchWin<CR>
nnoremap <A-S-q>  :BetterSearchCloseWin<CR>