Plug.kak

https://github.com/alexherbo2/plug.kak

3 Likes

On one hand I understand why you decided to call this project plug.kak as this is a “simpler”/“more idiomatic” re-implementation of Andrey’s plugin with kakoune native module system.

But on the other hand, as the brand name “plug.kak” is already tightly related to Andrey’s project in the community’s members mind, I’m afraid it could introduce confusion in future discussions.

8 Likes

Do you have a suggestion?

Agree with @Delapouite.

A few suggestion:
plg
plugin
kplug, aplug, tplug …
pluk

I really needed this. I had a lot of startup time due to plugins (over half a second). Now it’s much faster.

2 Likes

I like “plg” because this one is lighter, and fewer letters. I also concur lets try to keep the namespaces in our tiny community clean.

@useredsa It is because the plug command does not call sh:

define-command plug -params 2..3 -docstring 'plug <module> <repository> [config]' %{
  set-option -add global plug_modules %arg{1}
  set-option -add global plug_module_to_repository_map %arg{1} %arg{2}
  hook -group plug-module-loaded global ModuleLoaded %arg{1} %arg{3}
}

We install the config to run in a hook, when the module is loaded, and load the modules in the option with plug-require-modules:

hook -group plug-kak-begin global KakBegin .* %{
  plug-require-modules
}
1 Like

If someone want’s to make an even lighter plugin manager they should hurry, their not much letter left :slight_smile:

@alexherbo2 Did you implemented ( or are you planning to ) something similar to vim-plug lazy loading feature ?
from vim-plug’s readme:


" On-demand loading
Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }

I do not know vim-plug. Can you give me a Kakoune example?

Maybe pluggy.kak, because it’s smaller than plug.kak.
Or wire.kak, a stripped down plug…

4 Likes

What is the difference between a “plug” and a “wire”?

The plug are the connector at both ends of the wire

Plug:


Wire:

1 Like

Since it’s a plugin that manage other plugin, maybe it should be called ‘powerstrip’

5 Likes
Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }

This would only load the plugin when 'NERDTreeToggle commands is called. In kak words, the first time NERDTreeToggle is called in a kak session, it will first call require-module nerdtree and then call NERDTreeToggle.

Plug 'tpope/vim-fireplace', { 'for': 'clojure' }

This is easily doable in kak, no need to handle that in your plugin. It just load the plugin for clojure filetype.

Not sure I’m fond to add switches to the plug commands. They always involve shelling, which I want to avoid. Also, vim-plug has no config block, which we have. How do you call NERDTreeToggle if the command is in the config parameter? The idea of plug is to isolate configs, if you put the command elsewhere you defeat its purpose.

If the command is defined inside the config block then a hook on RuntimeError could report that the command is not defined and you could then require the module and execute it again.

1 Like

@scr I’m not fond of the name “powerstrip” – I’d like a short name – but I like the smiley in the image. Not sure if we can do something with it.

How about synonym of plug ?

seal
pack
clog
bung

I like ‘pack’

since this is a thin layer around require-module why not mod?

mod connect https://github.com/alexherbo2/connect.kak %{
  # Modules
  require-module connect-fzf
  require-module connect-broot
  require-module connect-dolphin

  # Environment variables
  set-option global connect_environment %{
    export SHELL=dash
  }
}
2 Likes