betterSearch.vim : Provide better search functionality by capturing all matched line
| script karma
Downloaded by 511
Comments, bugs, improvements
script versions (upload new version)
|This script will now only updated @ github
You may get it from
** 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 **
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
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
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
[ 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>
|### Using Pathogon
mkdir -p ~/.vim/bundle
git clone https://github.com/kenng/vim-bettersearch.git
### The OLD way
1. Paste the betterSearch.vim script into plugin folder.
2. Restart the Vim session
Click on the package to download.
ip used for rating: 184.108.40.206
||v0.0.9: highlight of result follows option ignorecase; custom highlight defined
v0.0.8: revert function gotoLine() as it is easy and accurate
|| [ version ] 0.0.7 ( 29 Mar 2014 )
- fixed bug not able to jump to line when line number is switched on
- fixed bug not able to jump to line which contains certain regexp
||enable [Enter] to jump to particular line without line number switched on
||- enhanced help description
||- showed the file path
- added function to close the bettersearch window from anywhere
- fixed visual select search
||- able to set highlight syntax for search term
- change default shortcut for syntax=c, help=F1
- improve help description