Skip to content

About

Completion framework for Vim/Neovim based on goda.vim

Resources

Stars

5 stars

Watchers

0 watching

Forks

Latest commit

 

History

54 Commits

Folders and files

Repository files navigation

goda-cmp.vim

Completion for Vim and Neovim, built on goda.vim. A successor in spirit to ddc.vim: sources and filters are separate extensions, the popup is either Vim's native one or pum.vim, and the configuration is code — a small Go program you own.

Status: early. See "Not implemented".

Try it

You need Go 1.26 or newer, and Vim 9.1 or newer (with +job +channel +timers) or Neovim. Install Shougo/goda.vim and Shougo/goda-cmp.vim (and Shougo/pum.vim for the pum popup) with your plugin manager, then create your configuration, a Go module of your own, outside this repository (keep it in your dotfiles; examples/config is only a template to copy):

mkdir -p ~/.vim/goda-cmp && cd ~/.vim/goda-cmp        # Neovim: ~/.config/nvim/goda-cmp
cp /path/to/goda-cmp.vim/examples/config/{main.go,config.go} .
go mod init goda-cmp-config
go get github.com/Shougo/goda-cmp.vim@latest
go mod tidy

Add to your vimrc / init.vim:

autocmd VimEnter * call goda_cmp#enable()

Then build and start:

:call goda_cmp#build()
:call goda_cmp#enable()

Open a file, go into insert mode and type: words of the buffer are offered. If nothing appears, :echo goda#log() shows what the plugin said.

Everything else is in :help goda_cmp (doc/goda_cmp.txt): where the files and the binary live, rebuilding and updating, the configuration, run-time patches, selecting candidates, the popup, writing extensions and partial results.

A configuration translated from a ddc.vim user's ddc.ts, with its Vim script, is in examples/ddc.

How it fits together

 ~/.vim/goda-cmp/                 your config module (Go)   <- you edit this
   go.mod  main.go  config.go
        │  imports
        ▼
 goda-cmp.vim/cmp                 engine and interfaces (no UI, no source)
 goda-cmp.vim/ext/...             bundled extensions: ui/native, ui/pum,
                                  ports of ddc.vim extensions:
                                  source/around, source/lsp, source/file, ...
                                  (`:help goda-cmp-bundled`)
 other extensions                 Go packages from other repositories
        │
        ▼  go build  →  one binary, started by goda.vim (Vim or Neovim)

There is no plugin loader and no manifest: an extension is a Go package that your main.go imports, so versions are pinned by your go.mod, and your editor type-checks and completes the configuration.

Tests

go test ./...                      # unit tests; also real Vim and Neovim if present
GODA_CMP_PUM=/path/to/pum.vim go test ./ext/e2e   # also the pum.vim scenarios

The end-to-end tests type into a real Vim and a real Neovim, whichever are installed, in a pseudo terminal (Python 3 needed), with a binary built from a configuration. Those of the core (cmp) use a test UI (cmptest.NewUI) and no extension's UI; those of the UIs, the extensions and the examples are in ext/e2e (and ext/source/lsp, with gopls if it is installed). The harness is the package cmp/cmptest/e2e, which extensions in other modules can use too. CI (.github/workflows/ci.yml) installs all of them. They build against goda.vim as a sibling directory (../goda.vim), and are skipped without it.

License

MIT, see LICENSE.

About

Completion framework for Vim/Neovim based on goda.vim

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages