Skip to content

About

Plugin Manager framework for Vim/Neovim based on goda.vim

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

34 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goda-pm.vim

A plugin manager for Vim and Neovim on goda.vim: the successor of dpp.vim, with the configuration in Go instead of TypeScript, and no Deno.

  • The startup does not use the binary: as dpp.vim, goda-pm writes a state (a startup script and the plugins) once, and goda_pm#min#load_state() sources it.
  • The protocols and the exts are in repositories of their own: goda-pm-ext (Go packages): the protocols git and http (dpp-protocol-git, dpp-protocol-http; http needs no curl, unzip nor tar), the ext installer (dpp-ext-installer), the TOML files of dpp-ext-toml (they work as they are), the local plugins (dpp-ext-local) and the source goda_pm of goda-fi.vim (ddu-source-dpp); goda-pm-ext-lazy.vim: the lazy loading (dpp-ext-lazy).
  • A Lua entry: require('goda_pm').
  • The binaries of the goda.vim plugins are built with the plugins installed (g:goda#workspace of goda.vim): after an update, build them again, with no go get -u.

Requirements

  • Vim 9.1 or Neovim 0.11
  • Go 1.26
  • git
  • goda.vim 0.7 or later (to make the state and to install the plugins)

Usage

The configuration is a Go module in ~/.vim/goda-pm (Neovim: stdpath('config') .. '/goda-pm'): it adds the protocols and the exts, and gives the plugins (a whole one, which loads TOML files and the plugins of ~/work: the author's).

import (
	"github.com/Shougo/goda-pm-ext-lazy.vim/ext/lazy"
	"github.com/Shougo/goda-pm-ext/ext/installer"
	"github.com/Shougo/goda-pm-ext/ext/protocol/git"
	"github.com/Shougo/goda-pm-ext/ext/toml"
	"github.com/Shougo/goda-pm.vim/pm"
)

func main() {
	b := pm.New()
	b.AddProtocol(git.New())
	b.AddExt(installer.New())
	b.SetConfig(func(ctx context.Context, c *pm.ConfigArgs) (*pm.ConfigReturn, error) {
		t, err := toml.Load(ctx, c.Host, "$BASE_DIR/dpp.toml", nil)
		if err != nil {
			return nil, err
		}
		r, err := lazy.MakeState(ctx, c.Host, t.Plugins)
		if err != nil {
			return nil, err
		}
		return &pm.ConfigReturn{Plugins: r.Plugins, StateLines: r.StateLines}, nil
	})
	b.Main()
}

Clone goda-pm.vim, goda.vim and goda-pm-ext-lazy.vim where the protocol git puts them (list them in your TOML files too, not lazy, and they are updated as the others):

git clone https://github.com/Shougo/goda-pm.vim ~/.cache/goda-pm/repos/github.com/Shougo/goda-pm.vim
git clone https://github.com/Shougo/goda.vim ~/.cache/goda-pm/repos/github.com/Shougo/goda.vim
git clone https://github.com/Shougo/goda-pm-ext-lazy.vim ~/.cache/goda-pm/repos/github.com/Shougo/goda-pm-ext-lazy.vim

In your vimrc:

" goda-pm.vim must be in 'runtimepath'.
set runtimepath^=~/.cache/goda-pm/repos/github.com/Shougo/goda-pm.vim

const s:base = '~/.cache/goda-pm'
let $BASE_DIR = '<script>:h'->expand()

if s:base->goda_pm#min#load_state()
  " No state: goda.vim and goda-pm-ext-lazy.vim are needed to make it.
  set runtimepath^=~/.cache/goda-pm/repos/github.com/Shougo/goda.vim
  set runtimepath^=~/.cache/goda-pm/repos/github.com/Shougo/goda-pm-ext-lazy.vim
  autocmd VimEnter * ++once call goda_pm#make_state(s:base)
endif

filetype plugin indent on
syntax on

goda_pm#make_state() builds the configuration when it is newer than the binary, and makes the state in the background. Restart Vim, and install the plugins:

call goda_pm#async_ext_action('installer', 'install')

See :help goda-pm for everything else, and :help goda-pm-dpp for the differences from dpp.vim.

About

Plugin Manager framework for Vim/Neovim based on goda.vim

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages