sponsor Vim development Vim logo Vim Book Ad

VIntSearch : "One should be able to jump between all kinds of search results".

 script karma  Rating 0/0, Downloaded by 3424  Comments, bugs, improvements  Vim wiki

created by
Yoonsang Lee
script type
More information : https://github.com/yssl/VIntSearch


- Symbol search

- Text search

- File search

- Search stack

1. Introduction                                             *VIntSearch-intro*

|VIntSearch| is a vim plugin providing an integrated interface across various
types of searches. It currently supports symbol search, text search, and file search.
Search results are given in the quickfix window and a user can conviniently
move forward / backward through the integrated search history.
VIntSearch means Vim Integrated Search.

## Features

- Quickfix-listed search results for all types of searches

- Integrated search stack containing search history for all types of searches
  (similar to vim's tag stack, but more general one)

- Unified search path for all search types

- Stacking not only search keywords and their position, but also search results
  in the quickfix

- Search keyword can be from a word under the cursor, visually selected text,
  or any string you type.

2. Getting Started                                 *VIntSearch-gettingstarted*

1. You need Exuberant Ctags to fully use this plugin. If you don't have it,
   please install it first: `sudo apt-get install exuberant-ctags`.

2. Install this plugin.

3. Open one of your source files with vim.

4. Build a tag file by typing |:VIntSearchBuildSymbolDB|. The tag file will be
   created in the nearest ancestor dir of the source file that contains
   a repository dir such as `.git`,
   or in the current working dir if the source file is not managed by any
   version control system.
   (You can change this behavior via `g:vintsearch_searchpathmode`)

5. Note that your `set tags=...` setting should have `./tags;,tags;` to use
   the generated tag file.
   (The name of the tag file can be changed by setting |g:vintsearch_tagfilename|)

6. Move the cursor to one of the functions or variables.
   Typing |:VIntSearchCursor| symbol n l or |:VIntSearchCursor| text n l will
   give search results in the quickfix window.
   Typing |:VIntSearchPrintStack| will show the search stack.

3. Search Types / Commands                            *VIntSearch-searchtypes*

VIntSearch supports symbol search, text search, and file search.
Currently, available search commands for each type of search are as follows:

- Symbol search
- ctags
- Text search
- grep
- File search
- find

You can set the default commands for search types via `g:vintsearch_symbol_defaultcmd`,
`g:vintsearch_text_defaultcmd`, and `g:vintsearch_file_defaultcmd`.

4. Search Path / Tag Commands               *VIntSearch-searchpathtagcommands*

The search path is a directory 1) that is recursively searched by grep,
2) that is the root of the entire source directory tree for which a tag file is generated,
and 3) where the tag file is located.
It is determined by |g:vintsearch_searchpathmode|.

*:VIntSearchPrintPath*, *:VSpath*    
Print current search path.

*:VIntSearchBuildSymbolDB*, *:VSbuild*  
Build a symbol db file for the search path.

5. Search Commands                                 *VIntSearch-searchcommands*

*:VSsymbol* [keyword]  
Search symbol for [keyword] (by default using ctags).

*:VStext* [keyword] [options]  
Search text for [keyword] with [options] (by default using grep, [option] is grep option).
[keyword] can be double-quoted and the argument order can be changed.  

For example:
:VStext tags
:VStext "let tags"
:VStext tags -i
:VStext -i tags
:VStext "let tags" -i
(See ```man grep``` for more details about [options])

*:VSfile* [keyword] [options]  
Search file for [keyword] with [options] (by default using find).
Curently only works with -path options of find command.  

For example,
:VSfind *test-class.cpp

*:VScftext* [keyword] [options]  
Search text for [keyword] with [options] in the current file.

*:VIntSearch* [search type] [keyword] [options]  
A search command taking a search type as an argument.

[search type] can be one of:
- symbol
- text
- file
- cftext

For example,
`:VIntSearch text "this is"` is same to `:VStext "this is"`.

*:VIntSearchCmd* [search type] [search command] [keyword] [options]  
A search command taking a search type and a search command as arguments.
For example,
`:VIntSearchCmd text grep "this is"` is same to `:VStext "this is"`
with `grep` as the default text search command.

*:VIntSearchCursor* [search type] [vimmode] [action]  
Search for keyword under the cursor with a specified [search type].

[vimmode] can be one of:  
- 'n' : Use this if vim is in normal mode. Then keyword is the word under the cursor.  
- 'v' : Use this if vim is in visual mode. Then keyword is the visually selected text.

[action] can be one of:  
- 'l' : List search result in the quickfix window and open the quickfix window.
- 'j' : Jump to the first search result. The quickfix window is also updated but not opened.

*:VIntSearchCursorCmd* [search type] [search command] [vimmode] [action]  
Search for keyword under the cursor with a specified [search type] and a
[search command].

6. Stack Commands                                   *VIntSearch-stackcommands*

Search stack contains your search history - search keywords you jumped to,
from which file, and search results in the quickfix also.
You can browse your source code more easily by moving forward and backward
in the search stack.

*:VIntSearchPrintStack*, *:VSstack*  
Print current search stack.

*:VIntSearchMoveBackward*, *:VSbwd*  
Move backward in the search stack.

*:VIntSearchMoveForward*, *:VSfwd*  
Move forward in the search stack.

*:VIntSearchClearStack*, *:VSclear*  
Clear the search stack.

Replacement of vim's |:cc|, |:cnext|, and |:cprev| commands.
Jumping to a new quickFix item should be done ONLY using these commands.
If not, the jump will not be reflected in VIntSearch's search stack .
- If you're using any key mapings for |:cnext| or |:cprev|, you can just replace them
with |:VScnext| and |:VScprev|.
- When you `Enter` or `Double-click on a quickfix item, VIntSearch will automatically
call |:VScc| instead of vim's |:cc| command.

You can disable this VIntSearch's default `Enter` behavior
using |g:vintsearch_enable_default_quickfix_enter|.

|:VScc| also can be used in other plugins that override vim's |:cc| command,
such as [QFEnter](http://www.vim.org/scripts/script.php?script_id=4778).
(For example, you can register |:VScc| as QFEnter's "cc" command by adding
`let g:qfenter_cc_cmd = 'VScc ##'` in your .vimrc.)
install details
- Using plugin managers (recommended)
    - [Vundle] : Add `Bundle 'yssl/VIntSearch'` to .vimrc & `:BundleInstall`
    - [NeoBundle] : Add `NeoBundle 'yssl/VIntSearch'` to .vimrc & `:NeoBundleInstall`
    - [vim-plug] : Add `Plug 'yssl/VIntSearch'` to .vimrc & `:PlugInstall`
- Using [Pathogen]
    - `cd ~/.vim/bundle; git clone https://github.com/yssl/VIntSearch.git`
- Manual install (not recommended)
    - Download this plugin and extract it in `~/.vim/`

This plugin requires a version of vim with python support. You can check your vim with :echo has('python'). If your vim doesn't support python, one of the easiest solutions would be installing a more featured version of vim by:
sudo apt-get install vim-nox

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
VIntSearch.zip 1.4.2 2019-03-24 7.0 Yoonsang Lee Support both Python 2 & Python 3
VIntSearch.zip 1.4.1 2016-07-05 7.0 Yoonsang Lee - Add cyclic version of cprev & cnext : VScnextc and VScprevc
VIntSearch.zip 1.4.0 2016-04-28 7.0 Yoonsang Lee - Support MS Windows
- Improve handling exceptional cases
- Add VIntSearch#SearchCursorWithCmd()
- Delete deprecated features from 1.3.0
VIntSearch.zip 1.3.1 2015-10-30 7.0 Yoonsang Lee - Bug fix for find option used by VSfile & VSbuild
VIntSearch.zip 1.3.0 2015-08-01 7.0 Yoonsang Lee - Bug fix related to :vintsearch_search_exclude_patterns
- Change names of include/exclude pattern options
- Refactor all search commands to be more extensible
- Rename VIntSearchBuildTag to VIntSearchBuildSymbolDB
- Following deprecated commands & options will be removed in version 1.4.0
    - :VIntSearchBuildTag, :VSbtag  
    - :VIntSearchCtags, :VSctags  
    - :VIntSearchGrep, :VSgrep
    - :VIntSearchCFGrep, :VScfgrep
    - :VIntSearchFind, :VSfind  
    - :VIntSearchCtagsCursor
    - :VIntSearchGrepCursor
    - :VIntSearchCFGrepCursor
    - :VIntSearchFindCursor
    - g:vintsearch_search_include_patterns
    - g:vintsearch_search_exclude_patterns
VIntSearch.zip 1.2.2 2015-07-08 7.0 Yoonsang Lee - Add hightlight option for search result (g:vintsearch_highlight_group)
VIntSearch.zip 1.2.1 2015-06-10 7.0 Yoonsang Lee - Add file find commands. :VIntSearchFind & VintSearchFindCursor
- Fix script errors
VIntSearch.zip 1.2.0 2015-06-07 7.0 Yoonsang Lee - Fix find option bug related to grep search.
- Rename & refactor all commands and whole code. The old commands (e.g. :VIntSearchListCursorGrep) are deprecated and will be removed in 1.3.0 version.
VIntSearch.zip 1.1.3 2015-06-04 7.0 Yoonsang Lee - Update key mapping example
- Update documents for Search Path / Tag Commands
- Add VSbtag command
- Fix :helptag build error
VIntSearch.zip 1.1.2 2015-05-25 7.0 Yoonsang Lee - Add local search commands (search in current file)
- Escaping double quotation mark in search keyword
- Handle vim pattern character (%, #) in search keyword
- Change grep option a bit internally
VIntSearch.zip 1.1.1 2015-02-11 7.0 Yoonsang Lee Fix the infinite loop bug when there is no vcs directory
VIntSearch.zip 1.1.0 2015-01-31 7.0 Yoonsang Lee - Add DefaultQuickFixEnter behavior - doesn't need external plugins like QFEnter any more
- New file pattern options to specify input source files for both ctags and grep commands
- Exception handling: Catch E553 error of VScnext & VScprev  
VIntSearch.zip 1.0.1 2015-01-25 7.0 Yoonsang Lee Change repository directories finding behavior.
VIntSearch.zip 1.0.0 2014-11-02 7.0 Yoonsang Lee Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Vim at Github