https://github.com/girishji/search-complete.vim
Async search mode completion with popup menu for Vim.
https://github.com/girishji/search-complete.vim
Last synced: 6 months ago
JSON representation
Async search mode completion with popup menu for Vim.
- Host: GitHub
- URL: https://github.com/girishji/search-complete.vim
- Owner: girishji
- License: mit
- Archived: true
- Created: 2023-06-08T11:57:37.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-24T19:30:41.000Z (almost 2 years ago)
- Last Synced: 2024-08-07T18:45:32.590Z (10 months ago)
- Language: Vim Script
- Homepage:
- Size: 45.9 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## This plugin is replaced by [AutoSuggest](https://github.com/girishji/autosuggest.vim). Please use it instead.
---
# search-complete
Async search mode auto-completion plugin for Vim. Once you start using it
you'll not want to go back!__How it helps?__
- Use fewer keystrokes to search words.
- Preview searchable words in a popup menu.
- Search multiple words even across line boundary.
- Unobtrusive and does not interfere with Vim's idioms.__How to use it?__
- Search using `/` or `?`.
- `` and `` will select menu items.
- `` dismisses popup menu.
- `` accepts selection, and `` dismisses search.
- `` will force popup menu to close.
- Type the character between words (like ``) after the first word to include the second word in search.
- Type `\n` at the end of the last word in a line to continue to next line.### Popup Menu
[](https://asciinema.org/a/dGNdbLbsTMSdaL8E4PonxQDKL)
### Flat Popup Menu
Main window remains fully visible since popup is positioned on the statusline.
This is the default option.[](https://asciinema.org/a/DrvlJnoumCA9jWuMH8WGBCVJz)
# Features
- Does not interfere with `c|d|y /pattern` commands (copy/delete/yank).
- Search command does not get bogged down when searching large files.
- Respects forward (`/`) and reverse (`?`) search when displaying menu items.
- Does not interfere with search-history recall (arrow keys, are not mapped).
- Does not interfere with search-highlighting and incremental-search.
- Switch between normal popup menu and flat menu.
- Fully customizable colors and popup menu options.
- Can search across space and newline characters (multi-line search).
- Written in Vim9script for speed.# Requirements
- Vim >= 9.0
# Installation
Install using [vim-plug](https://github.com/junegunn/vim-plug)
```
vim9script
plug#begin()
Plug 'girishji/search-complete.vim'
plug#end()
```Legacy script:
```
call plug#begin()
Plug 'girishji/search-complete.vim'
call plug#end()
```Or use Vim's builtin package manager.
# Configuration
### Case Sensitive Search
`ignorecase` and `smartcase` Vim variables are used to decide menu items. Set
them appropriately using `set` command.### Options
There are two types of options that can be configured: 1) options passed directly to Vim's
[popup_create()](https://vimhelp.org/popup.txt.html#popup_create-arguments)
function, and 2) options used internally by this plugin. Any option accepted by
popup_create() is allowed. This includes `borderchars`, `border`, `maxheight`,
etc. See `:h popup_create-arguments`.`g:SearchCompleteSetup()` function is used to set options. It takes a dictionary argument.
If you are using
[vim-plug](https://github.com/junegunn/vim-plug), use `autocmd` to set options
(after calling `Plug`).```
vim9script
augroup MySearchComplete | autocmd!
autocmd WinEnter,BufEnter * g:SearchCompleteSetup({
\ borderchars: ['─', '│', '─', '│', '┌', '┐', '┘', '└'],
\ flatMenu: false,
\ })
augroup END
```Legacy script:
```
augroup MySearchComplete | autocmd!
autocmd WinEnter,BufEnter * call SearchCompleteSetup(#{
\ borderchars: ['─', '│', '─', '│', '┌', '┐', '┘', '└'],
\ flatMenu: v:false,
\ })
augroup END
```Options of interest:
- `maxheight`: Line count of vertical menu, defaults to 12 lines.
- `border`: To disable border set this to `[0, 0, 0, 0]`.
- `searchRange`: Lines per search iteration, defaults to 1000 lines.
- `flatMenu` : 'true' for flat menu, 'false' for normal popup menu. Defaults to true.### Commands to Enable and Disable Search Completion
- `:SearchCompleteEnable`
- `:SearchCompleteDisable`### Highlight Groups
Customize the colors to your liking using highlight groups.
- `SearchCompleteMenu`: Menu items in popup menu, linked to `Pmenu`.
- `SearchCompleteSelect`: Selected item, linked to `PmenuSel`.
- `SearchCompletePrefix`: Fragment of menu item that matches text being searched, linked to `Statement`.
- `SearchCompleteSbar`: Vertical menu scroll bar, linked to `PmenuSbar`.
- `SearchCompleteThumb`: Vertical menu scroll bar thumb, linked to `PmenuThumb`.# Performance
Great care is taken to ensure that responsiveness does not deteriorate when
searching large files. Large files are searched in batches. Each search
attempt is limited to 1000 lines (configurable). Reduce this number if you prefer
faster response. Between each search attempt input keystrokes are allowed to be
queued into Vim's main loop.# Contributing
Pull requests are welcome.
# Similar Plugins
- [cmp-cmdline](https://github.com/hrsh7th/cmp-cmdline)
- [wilder.nvim](https://github.com/gelguy/wilder.nvim)
- [sherlock](https://github.com/vim-scripts/sherlock.vim)