# Know a plugin like this?

**URL:** <https://discuss.kakoune.com/t/know-a-plugin-like-this/2574>\
**Category:** Plugins\
**Created:** [November 16, 2024, 5:19am UTC](https://discuss.kakoune.com/t/know-a-plugin-like-this/2574 "2024-11-16T05:19:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![losnappas](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/losnappas/32/893_2.png) [@losnappas](https://discuss.kakoune.com/u/losnappas)\
**Post date:** [November 16, 2024, 5:19am UTC](https://discuss.kakoune.com/t/know-a-plugin-like-this/2574/1 "2024-11-16T05:19:50Z")

</div>

# `mv`/`mkdir`/`rm`/etc. plugin

I remember seeing a plugin that had these “basics” of unix commands implemented, but I can’t remember what it was called.

These are fairly trivial to implement myself but eh I rather install something that handles e.g. buffer moves, than reinvent.

# attach to server on cd into project dir

To replace `cd` in terminal → start kakoune, flow:

To handle `:cd <dir><ret>` into a directory with a running kakoune server and attaching to that automatically, or creating a server if a `.git` dir exists (i.e. it’s a project dir).

# mru buffers

I made a terrible most-recently-used files list for myself but I realize now that I only want to see open buffers in it. I can’t figure out how to use `arrange-buffers` myself, seems to do nothing? I want the list in order of most recent first.

---

<div class="post-metadata">

**Author:** ![Screwtapello](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/screwtapello/32/12_2.png) [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Post date:** [November 16, 2024, 6:08am UTC](https://discuss.kakoune.com/t/know-a-plugin-like-this/2574/2 "2024-11-16T06:08:08Z")

</div>

> [@losnappas](#):
>
> To handle `:cd <dir><ret>` into a directory with a running kakoune server and attaching to that automatically, or creating a server if a `.git` dir exists (i.e. it’s a project dir).

I don’t think this is possible. The `:cd` command is always executed by a Kakoune server, and a server can’t merge itself to a different server.

> [@losnappas](#):
>
> I can’t figure out how to use `arrange-buffers` myself, seems to do nothing?

`:arrange-buffers` affects the content of `%val{buflist}` and therefore the behaviour of `:buffer-next` and `:buffer-prev`. The completions for the `:buffer` command are always sorted alphabetically, `:arrange-buffers` doesn’t help with that.

If you start Kakoune with `kak a b c d e` then `%val{buflist}` will be:

```
*debug* a b c d e

```

`:arrange-buffers` takes the buffers you name and moves them to the front of the buffer list. If you do `:arrange-buffers d c`, then `%val{buflist}` becomes:

```
d c *debug* a b e

```

If you set up a hook to move the current buffer to the front of the list every time you switch buffers, like this:

```
hook global WinDisplay .* %{ arrange-buffers %val{hook_param} }

```

…then `%val{buflist}` will always list buffers in most-recently-used order.

Of course, `%val{buflist}` is a session-global value, so if you have multiple clients connected to the same session, switching buffers in one client will affect `%val{buflist}` in the others, which might not be what you want. Maintaining an MRU list of buffers per-client would be a lot more involved.

---

<div class="post-metadata">

**Author:** ![losnappas](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/losnappas/32/893_2.png) [@losnappas](https://discuss.kakoune.com/u/losnappas)\
**Post date:** [November 16, 2024, 6:41am UTC](https://discuss.kakoune.com/t/know-a-plugin-like-this/2574/3 "2024-11-16T06:41:52Z")

</div>

> hook global WinDisplay .\* %{ arrange-buffers %val{hook\_param} }

This combined with `peneira` ([GitHub - gustavo-hms/peneira: A fuzzy finder crafted for Kakoune](https://github.com/gustavo-hms/peneira)) works pretty well already, big thanks!

```kakscript
map global goto A '<esc>: peneira-mru-buffers<ret>' -docstring 'MRU buffers'
define-command -override peneira-mru-buffers %{
    peneira 'buffers: ' %{ printf '%s\n' $kak_quoted_buflist } %{
        buffer %arg{1}
    }
}
hook global WinDisplay .* %{ arrange-buffers %val{hook_param} }

```

Though as you mention, typically a per-client mru list comes handy but I’ll have to see.

---

<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:** [November 16, 2024, 12:20pm UTC](https://discuss.kakoune.com/t/know-a-plugin-like-this/2574/4 "2024-11-16T12:20:42Z")

</div>

`arrange-buffers %val{hook_param}` is genius

---

<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:** [November 16, 2024, 12:25pm UTC](https://discuss.kakoune.com/t/know-a-plugin-like-this/2574/5 "2024-11-16T12:25:07Z")

</div>

About unix tools, I have some of them implemented here: [dotfiles/.local/share/kak/autoload/tools at master · alexherbo2/dotfiles · GitHub](https://github.com/alexherbo2/dotfiles/tree/master/.local/share/kak/autoload/tools)

Currently, `:cp`, `:find`, `:grep`, `:ls`, `:make`, `:mkdir`, `:mv`, `:nohup`, `:pwd`, `:rm`, `:sh`, `:sort` and `:unlink`.

---

<div class="post-metadata">

**Author:** ![losnappas](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/losnappas/32/893_2.png) [@losnappas](https://discuss.kakoune.com/u/losnappas)\
**Post date:** [November 16, 2024, 12:41pm UTC](https://discuss.kakoune.com/t/know-a-plugin-like-this/2574/6 "2024-11-16T12:41:31Z")

</div>

Perfect, must’ve been where I saw them in the first place 🤩 Thanks!

---

<div class="post-metadata">

**Author:** ![losnappas](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/losnappas/32/893_2.png) [@losnappas](https://discuss.kakoune.com/u/losnappas)\
**Post date:** [November 18, 2024, 7:29am UTC](https://discuss.kakoune.com/t/know-a-plugin-like-this/2574/7 "2024-11-18T07:29:32Z")

</div>

Some more I’m looking for:

- `jj` (jujutsu) command, like the one kakoune builtin `git`
- `jupyter ascending` ([GitHub - imbue-ai/jupyter\_ascending: Ascend your Jupyter Notebook usage](https://github.com/imbue-ai/jupyter_ascending)) integration

---

<div class="post-metadata">

**Author:** ![losnappas](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/losnappas/32/893_2.png) [@losnappas](https://discuss.kakoune.com/u/losnappas)\
**Post date:** [December 17, 2024, 6:05am UTC](https://discuss.kakoune.com/t/know-a-plugin-like-this/2574/8 "2024-12-17T06:05:03Z")

</div>

jj plugin: [kakoune-boost/jj.kak at master · krobelus/kakoune-boost · GitHub](https://github.com/krobelus/kakoune-boost/blob/master/jj.kak)

jupyter\_ascending (wip, I’ll only rarely use it; it’s a start): [GitHub - losnappas/jupyter\_ascending.kak: Kakoune plugin to run [jupyter\_ascending](https://github.com/imbue-ai/jupyter\_ascending/)](https://github.com/losnappas/jupyter_ascending.kak)  
Although I’m considering figuring a way to run regular .py files in notebook, like vscode’s jupyter extension does, via `# %%` semantics (e.g. jupytext), because jupyter\_ascending is a pain for my uses.
