An open API service indexing awesome lists of open source software.

https://github.com/tsuyoshicho/asyncomplete-anylist

Configurable list source for asyncomplete.vim plugin.
https://github.com/tsuyoshicho/asyncomplete-anylist

asyncomplete vim

Last synced: 8 months ago
JSON representation

Configurable list source for asyncomplete.vim plugin.

Awesome Lists containing this project

README

          

# asyncomplete-anylist

[![DeepWiki](https://img.shields.io/badge/DeepWiki-tsuyoshicho%2Fasyncomplete--anylist-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAyCAYAAAAnWDnqAAAAAXNSR0IArs4c6QAAA05JREFUaEPtmUtyEzEQhtWTQyQLHNak2AB7ZnyXZMEjXMGeK/AIi+QuHrMnbChYY7MIh8g01fJoopFb0uhhEqqcbWTp06/uv1saEDv4O3n3dV60RfP947Mm9/SQc0ICFQgzfc4CYZoTPAswgSJCCUJUnAAoRHOAUOcATwbmVLWdGoH//PB8mnKqScAhsD0kYP3j/Yt5LPQe2KvcXmGvRHcDnpxfL2zOYJ1mFwrryWTz0advv1Ut4CJgf5uhDuDj5eUcAUoahrdY/56ebRWeraTjMt/00Sh3UDtjgHtQNHwcRGOC98BJEAEymycmYcWwOprTgcB6VZ5JK5TAJ+fXGLBm3FDAmn6oPPjR4rKCAoJCal2eAiQp2x0vxTPB3ALO2CRkwmDy5WohzBDwSEFKRwPbknEggCPB/imwrycgxX2NzoMCHhPkDwqYMr9tRcP5qNrMZHkVnOjRMWwLCcr8ohBVb1OMjxLwGCvjTikrsBOiA6fNyCrm8V1rP93iVPpwaE+gO0SsWmPiXB+jikdf6SizrT5qKasx5j8ABbHpFTx+vFXp9EnYQmLx02h1QTTrl6eDqxLnGjporxl3NL3agEvXdT0WmEost648sQOYAeJS9Q7bfUVoMGnjo4AZdUMQku50McDcMWcBPvr0SzbTAFDfvJqwLzgxwATnCgnp4wDl6Aa+Ax283gghmj+vj7feE2KBBRMW3FzOpLOADl0Isb5587h/U4gGvkt5v60Z1VLG8BhYjbzRwyQZemwAd6cCR5/XFWLYZRIMpX39AR0tjaGGiGzLVyhse5C9RKC6ai42ppWPKiBagOvaYk8lO7DajerabOZP46Lby5wKjw1HCRx7p9sVMOWGzb/vA1hwiWc6jm3MvQDTogQkiqIhJV0nBQBTU+3okKCFDy9WwferkHjtxib7t3xIUQtHxnIwtx4mpg26/HfwVNVDb4oI9RHmx5WGelRVlrtiw43zboCLaxv46AZeB3IlTkwouebTr1y2NjSpHz68WNFjHvupy3q8TFn3Hos2IAk4Ju5dCo8B3wP7VPr/FGaKiG+T+v+TQqIrOqMTL1VdWV1DdmcbO8KXBz6esmYWYKPwDL5b5FA1a0hwapHiom0r/cKaoqr+27/XcrS5UwSMbQAAAABJRU5ErkJggg==)](https://deepwiki.com/tsuyoshicho/asyncomplete-anylist)

Configurable list source for [asyncomplete.vim](https://github.com/prabirshrestha/asyncomplete.vim) plugin.

## Settings

```vim
function! s:gen() abort
return ['tips', 'tomorrow']
endfunction

autocmd User asyncomplete_setup call
\ asyncomplete#register_source(
\ asyncomplete#sources#anylist#get_source_options({
\ 'name': 'anylist',
\ 'allowlist': ['*'],
\ 'completor': function('asyncomplete#sources#anylist#completor'),
\ 'config': {
\ 'matcher': '\(\w\|\f\)+$',
\ 'items': [
\ {'name': 'sign', 'list': ['tsuyoshicho']},
\ {'name': 'func', 'function': function('s:gen'), 'args': []},
\ ],
\ },
\ 'priority': 20,
\ }))
```

![sample result](https://github.com/tsuyoshicho/asyncomplete-anylist/blob/assets/images/asyncomplete-anylist-sample-1.png)

## Configuration description

anylist is need `config` entry in `get_source_options`'s arguments.

* config is a dictionary.
* config.matcher is string, that is "pattern" to use for completion matching.
* config.items is a list of dictionaries.

The item of config.items can define the following contents.

* item.name : A string, the name that will appear in the completion menu.
* item.list : A list of strings, used for completion. (High priority than item.function)
* item.function : A Funcref that returns a list of strings.
* item.args : A list, that is arguments passed when calling item.function.

## Useful examples

```vim
" https://www.conventionalcommits.org/en/v1.0.0/
function! s:git_conventional_commit() abort
if &filetype =~? 'git'
return [
\ 'build', 'ci', 'chore', 'docs', 'feat', 'fix',
\ 'perf', 'refactor', 'revert', 'style', 'test'
\]
endif
return []
endfunction

autocmd User asyncomplete_setup call
\ asyncomplete#register_source(
\ asyncomplete#sources#anylist#get_source_options({
\ 'name': 'anylist',
\ 'allowlist': ['*'],
\ 'completor': function('asyncomplete#sources#anylist#completor'),
\ 'config': {
\ 'matcher': '\(\w\|\f\)+$',
\ 'items': [
\ {'name': 'sign', 'list': ['tsuyoshicho', 'tsuyoshi_cho']},
\ {'name': 'git', 'function': function('s:git_conventional_commit'), 'args': []},
\ {'name': 'mrw', 'function': function('mr#mrw#list'), 'args': []},
\ ],
\ },
\ 'priority': 20,
\ }))
```

* sign: User account completion. Completion work always.
* git: Conventional Commits completion. Completion work under git related filetypes.
* mrw: [mr.vim](https://github.com/lambdalisue/mr.vim)'s most recently write file list completion. Completion work always.