

GitHub - girishji/autosuggest.vim: Async autocompletion plugin for Vim's cmdline...
source link: https://github.com/girishji/autosuggest.vim
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

girishji/autosuggest.vim
Autocomplete Plugin for Vim's Cmdline Mode (Needs Vim >= 9.0)
Wouldn't it be nice to have autocomplete during search and command execution?
This unobtrusive plugin simply opens a popup menu and shows
autocompletion options when you search (/
, ?
) or enter commands (:
) in
commandline-mode.
How it helps?
- Preview searchable words and commands (and their arguments).
- Search multiple words, even across line boundary; Fuzzy search.
- All Vim idioms work as before. No surprises.
- Fast, does not hang up when searching large files or expanding wildcards.
How to use it?
- Search using
/
or?
or enter commands using:
as usual. <Tab>
and<Shift-tab>
will select menu items.<Ctrl-E>
dismisses popup menu.<Enter>
accepts selection, and<Esc>
dismisses search.<Ctrl-C>
will force popup menu to close.
Multiword Search
- Type the character between words (like
<Space>
) 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. - Available only when fuzzy option is not selected.
For insert-mode autocompletion see Vimcomplete.
Search
Command
Popup Menu over Statusline
Features
- Does not interfere with
[c|d|y]/{pattern}
commands (copy/delete/yank). - Respects forward (
/
) and reverse (?
) search when displaying menu items. - Does not interfere with search-highlighting and incremental-search.
- Does not interfere with search-history recall (arrow keys,
<Ctrl-N/P>
are not mapped). - Fuzzy search option.
- Will not hang under any circumstance (including
**
wildcards) - Command names, arguments, Vimscript functions, variables, etc., are autocompleted.
- Switch between normal popup menu and flat menu.
- Written in Vim9script for readability and ease of maintenance (and speed).
Requirements
- Vim >= 9.0
Installation
Install using vim-plug
vim9script
plug#begin()
Plug 'girishji/autosuggest.vim'
plug#end()
Legacy script:
call plug#begin()
Plug 'girishji/autosuggest.vim'
call plug#end()
Or use Vim's builtin package manager.
Configuration
Options
Default options are as follows.
vim9script
var options = {
search: {
enable: true, # 'false' will disable search completion
maxheight: 12, # line count of stacked menu
pum: true, # 'false' for flat menu, 'true' for stacked menu
fuzzy: false, # fuzzy completion
alwayson: true, # when 'false' press <tab> to open popup menu
hidestatusline: false, # (experimental) hide statusline when 'pum' is 'false'
},
cmd: {
enable: true, # 'false' will disable command completion
pum: true, # 'false' for flat menu, 'true' for stacked menu
fuzzy: false, # fuzzy completion
hidestatusline: false, # (experimental) hide statusline when 'pum' is 'false'
}
}
Options can be modified using g:AutoSuggestSetup()
. If you are using
vim-plug use the VimEnter
event as
follows.
autocmd VimEnter * g:AutoSuggestSetup(options)
Commands
Enable and disable this plugin
:AutoSuggestEnable
:AutoSuggestDisable
Highlight Groups
Highlight group AS_SearchCompletePrefix
affects style of the fragment of menu item
that matches text being searched. By default it is linked to highlight group Special
.
Popup menu appearance is determined by Vim's highlight groups Pmenu
,
PmenuSel
, PmenuSbar
and PmenuThumb
. For command completion WildMenu
group (:h hl-WildMenu
) can be used.
Case Sensitive Search
Set ignorecase
and smartcase
using set
command. See :h 'ignorecase'
and
h 'smartcase'
.
Performance
Care is taken to ensure that responsiveness does not deteriorate when searching large files or expanding wildcards. Large files are searched in batches. Between each search attempt input keystrokes are allowed to be queued into Vim's main loop. Wildcard expansions are first executed in a separate job and aborted after a timeout.
Contributing
Pull requests are welcome.
Similar Plugins
Recommend
-
67
-
34
README.org esh-autosuggest
-
9
x-autosuggest Autosuggest results based on input. Features: Best accessibility practices baked in Flexible styling
-
8
Typeahead and autosuggest with pure Solr and Nginx A long time ago I was writing about a very simple technic which can be used to quickly provide auto-suggest for websites with the support of Solr:
-
15
Reading /proc/pid/cmdline can hang forever Back in August, I wrote that fork() can fail and it made a pretty big splash. Continuing with that general theme, I'll tell you...
-
6
Slogging #24: The Dentist Suicide Rate Myth and a Moment When Google Doesn't Autosuggest January 13th 2021 12
-
8
Best Practices: Designing autosuggest experiences8 design recommendations for search bar & autosuggest patterns
-
21
HopLa All the power of PayloadsAllTheThings, without the overhead. This extension adds autocompletion support and useful payloads in Burp S...
-
8
Async Autocompletion Plugin for Vim A lightweight async autocompletion plugin written entirely in vim9script. Features Code completion using LSP ...
-
14
Commit Permalink
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK