# Plug.kak

**URL:** <https://discuss.kakoune.com/t/plug-kak/1295>\
**Category:** Plugins\
**Created:** [October 9, 2020, 5:43am UTC](https://discuss.kakoune.com/t/plug-kak/1295 "2020-10-09T05:43:48Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexherbo2](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/alexherbo2/32/1140_2.png) [@alexherbo2](https://discuss.kakoune.com/u/alexherbo2)\
**Post date:** [October 9, 2020, 5:43am UTC](https://discuss.kakoune.com/t/plug-kak/1295/1 "2020-10-09T05:43:48Z")

</div>

[https://github.com/alexherbo2/plug.kak](https://github.com/alexherbo2/plug.kak)

---

<div class="post-metadata">

**Author:** ![Delapouite](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/delapouite/32/10_2.png) [@Delapouite](https://discuss.kakoune.com/u/Delapouite)\
**Post date:** [October 9, 2020, 8:03am UTC](https://discuss.kakoune.com/t/plug-kak/1295/2 "2020-10-09T08:03:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![alexherbo2](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/alexherbo2/32/1140_2.png) [@alexherbo2](https://discuss.kakoune.com/u/alexherbo2)\
**Post date:** [October 9, 2020, 11:22am UTC](https://discuss.kakoune.com/t/plug-kak/1295/3 "2020-10-09T11:22:23Z")

</div>

Do you have a suggestion?

---

<div class="post-metadata">

**Author:** ![scr](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/scr/32/486_2.png) [@scr](https://discuss.kakoune.com/u/scr)\
**Post date:** [October 9, 2020, 11:55am UTC](https://discuss.kakoune.com/t/plug-kak/1295/4 "2020-10-09T11:55:59Z")

</div>

Agree with @Delapouite.

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

---

<div class="post-metadata">

**Author:** ![useredsa](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/useredsa/32/419_2.png) [@useredsa](https://discuss.kakoune.com/u/useredsa)\
**Post date:** [October 9, 2020, 4:44pm UTC](https://discuss.kakoune.com/t/plug-kak/1295/5 "2020-10-09T16:44:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![robertmeta](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/robertmeta/32/833_2.png) [@robertmeta](https://discuss.kakoune.com/u/robertmeta)\
**Post date:** [October 9, 2020, 4:58pm UTC](https://discuss.kakoune.com/t/plug-kak/1295/6 "2020-10-09T16:58:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![alexherbo2](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/alexherbo2/32/1140_2.png) [@alexherbo2](https://discuss.kakoune.com/u/alexherbo2)\
**Post date:** [October 9, 2020, 7:04pm UTC](https://discuss.kakoune.com/t/plug-kak/1295/7 "2020-10-09T19:04:06Z")

</div>

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

```auto
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`:

```auto
hook -group plug-kak-begin global KakBegin .* %{
  plug-require-modules
}

```

---

<div class="post-metadata">

**Author:** ![scr](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/scr/32/486_2.png) [@scr](https://discuss.kakoune.com/u/scr)\
**Post date:** [October 10, 2020, 1:30pm UTC](https://discuss.kakoune.com/t/plug-kak/1295/8 "2020-10-10T13:30:03Z")

</div>

> [@robertmeta](#):
>
> I like “plg” because this one is lighter, and fewer letters

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

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

```auto

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

```

---

<div class="post-metadata">

**Author:** ![alexherbo2](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/alexherbo2/32/1140_2.png) [@alexherbo2](https://discuss.kakoune.com/u/alexherbo2)\
**Post date:** [October 10, 2020, 2:27pm UTC](https://discuss.kakoune.com/t/plug-kak/1295/9 "2020-10-10T14:27:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![krobelus](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/krobelus/32/616_2.png) [@krobelus](https://discuss.kakoune.com/u/krobelus)\
**Post date:** [October 13, 2020, 5:34am UTC](https://discuss.kakoune.com/t/plug-kak/1295/10 "2020-10-13T05:34:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alexherbo2](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/alexherbo2/32/1140_2.png) [@alexherbo2](https://discuss.kakoune.com/u/alexherbo2)\
**Post date:** [October 13, 2020, 10:54am UTC](https://discuss.kakoune.com/t/plug-kak/1295/11 "2020-10-13T10:54:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![scr](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/scr/32/486_2.png) [@scr](https://discuss.kakoune.com/u/scr)\
**Post date:** [October 13, 2020, 11:00am UTC](https://discuss.kakoune.com/t/plug-kak/1295/12 "2020-10-13T11:00:51Z")

</div>

The plug are the connector at both ends of the wire

---

<div class="post-metadata">

**Author:** ![robertmeta](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/robertmeta/32/833_2.png) [@robertmeta](https://discuss.kakoune.com/u/robertmeta)\
**Post date:** [October 13, 2020, 3:44pm UTC](https://discuss.kakoune.com/t/plug-kak/1295/13 "2020-10-13T15:44:11Z")

</div>

Plug: ![](https://discuss.kakoune.com/uploads/default/original/1X/0493a846e39c861d302cf72027b5d4b2e0362af6.jpeg)

* * *

Wire: ![](https://discuss.kakoune.com/uploads/default/original/1X/49f054db3406e5f9b6610e7a4bdbd80d147849f9.jpeg)

---

<div class="post-metadata">

**Author:** ![scr](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/scr/32/486_2.png) [@scr](https://discuss.kakoune.com/u/scr)\
**Post date:** [October 13, 2020, 7:00pm UTC](https://discuss.kakoune.com/t/plug-kak/1295/14 "2020-10-13T19:00:54Z")

</div>

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

![](https://discuss.kakoune.com/uploads/default/original/1X/d49b6f7e76394059fc7062e13dfb9cf64e7060d2.jpeg)

---

<div class="post-metadata">

**Author:** ![scr](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/scr/32/486_2.png) [@scr](https://discuss.kakoune.com/u/scr)\
**Post date:** [October 13, 2020, 7:06pm UTC](https://discuss.kakoune.com/t/plug-kak/1295/15 "2020-10-13T19:06:58Z")

</div>

> [@alexherbo2](#):
>
> I do not know vim-plug. Can you give me a Kakoune example?

```auto
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`.

```auto
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.

---

<div class="post-metadata">

**Author:** ![alexherbo2](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/alexherbo2/32/1140_2.png) [@alexherbo2](https://discuss.kakoune.com/u/alexherbo2)\
**Post date:** [October 13, 2020, 8:10pm UTC](https://discuss.kakoune.com/t/plug-kak/1295/16 "2020-10-13T20:10:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![useredsa](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/useredsa/32/419_2.png) [@useredsa](https://discuss.kakoune.com/u/useredsa)\
**Post date:** [October 13, 2020, 9:08pm UTC](https://discuss.kakoune.com/t/plug-kak/1295/17 "2020-10-13T21:08:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![alexherbo2](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/alexherbo2/32/1140_2.png) [@alexherbo2](https://discuss.kakoune.com/u/alexherbo2)\
**Post date:** [October 14, 2020, 10:28am UTC](https://discuss.kakoune.com/t/plug-kak/1295/18 "2020-10-14T10:28:19Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![scr](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/scr/32/486_2.png) [@scr](https://discuss.kakoune.com/u/scr)\
**Post date:** [October 14, 2020, 10:47am UTC](https://discuss.kakoune.com/t/plug-kak/1295/19 "2020-10-14T10:47:19Z")

</div>

How about synonym of plug ?

seal  
pack  
clog  
bung

I like ‘pack’

---

<div class="post-metadata">

**Author:** ![jssee](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/jssee/32/108_2.png) [@jssee](https://discuss.kakoune.com/u/jssee)\
**Post date:** [October 14, 2020, 8:10pm UTC](https://discuss.kakoune.com/t/plug-kak/1295/20 "2020-10-14T20:10:12Z")

</div>

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

```auto
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
  }
}

```

[Next page](https://discuss.kakoune.com/t/plug-kak/1295.md?page=2)
