Skip to content

About

Completion framework for Vim/Neovim based on goda.vim

Topics

Resources

Stars

8 stars

Watchers

1 watching

Forks

Latest commit

 

History

97 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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 0.11 or newer. 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; e2e/config, which the tests build, 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/e2e/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 e2e/ddc (the tests build it).

With goda-pm.vim

With goda-pm.vim, the build uses the plugins installed (g:goda#workspace of goda.vim): after an update, build again, with no go get -u. To build after every update:

[[plugins]]
repo = 'Shougo/goda.vim'

[[plugins]]
repo = 'Shougo/goda-cmp.vim'
depends = 'goda.vim'
lazy = true
hook_post_update = 'call goda_cmp#build()'

[[plugins]]
repo = 'Shougo/goda-cmp-ui-native.vim'
depends = 'goda-cmp.vim'
lazy = true
hook_post_update = 'call goda_cmp#build()'

# The UI pum uses pum.vim.
[[plugins]]
repo = 'Shougo/pum.vim'
lazy = true

[[plugins]]
repo = 'Shougo/goda-cmp-ui-pum.vim'
depends = 'goda-cmp.vim'
lazy = true
hook_post_update = 'call goda_cmp#build()'

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-ui-*.vim/ext/ui/...     the UIs: native, pum, inline
 goda-cmp-ext/ext/...             ports of ddc.vim extensions:
                                  source/around, source/lsp, source/file, ...,
                                  ui/none (`: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
cd e2e && GODA_CMP_PUM=/path/to/pum.vim go test ./...   # the extensions together

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 configurations (e2e/config, e2e/ddc) are in e2e, a module of its own that requires them (the lsp source has its own in goda-cmp-ext, with gopls if it is installed). The harness is the package cmp/cmptest/e2e, which extensions in other modules use too. CI (.github/workflows/ci.yml) installs all of them. They build against goda.vim checked out next to goda-cmp.vim (../goda.vim, its latest version) when there is one, otherwise against the goda.vim of go.mod.

License

MIT, see LICENSE.

About

Completion framework for Vim/Neovim based on goda.vim

Topics

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages