Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kakoune: support for adding plugins #61385

Merged
merged 1 commit into from Jun 26, 2019
Merged

Conversation

eraserhd
Copy link
Contributor

Motivation for this change

There is a thriving plugin ecosystem for Kakoune now, and it is nice
to add these in our Nix configurations. This was modeled after weechat's
plugins.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

No binary files to test
Closure size: Before: 41,022,312, After: 41,022,312

Notes

parinfer-rust is useable both standalone and as a Kakoune plugin,
so the plugin file inherits the same definition as pkgs.

I'll make PRs for other plugins if this gets accepted.
Here's a tested
branch for the kak-ansi plugin.


@eraserhd
Copy link
Contributor Author

rebased... bump

@teto
Copy link
Member

teto commented May 29, 2019

Does this rebuild kakoune when adding plugins (seems to change buildInputs) ? if that's the case maybe use a wrapper like neovim/neovim-unwrapped, if not ignore my comment.

when that's addressed ping kakune's maintainer.

@eraserhd
Copy link
Contributor Author

eraserhd commented Jun 7, 2019

OK, I've updated this with the unwrapped/wrapper method. It's kind of nice, and makes fewer changes.

@vrthra thoughts?

@eraserhd
Copy link
Contributor Author

Hey, no response from @vrthra for 19 days. I think this is a pretty nice solution now, so will someone else review?

Thanks.

@eraserhd eraserhd force-pushed the kakoune-plugins branch 2 times, most recently from ae35842 to dead214 Compare June 18, 2019 16:40
@infinisil
Copy link
Member

Ping @alyssais @utdemir

Copy link
Member

@alyssais alyssais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry it took me so long to look at this. Meant to ages ago.

Anyway, looks great from here, save from a doc tweak.

Motivation: There is a thriving plugin ecosystem for Kakoune now,
and it is nice to add these in our Nix configurations. This was modeled
on neovim's plugins.

parinfer-rust is useable both standalone and as a Kakoune plugin,
so the plugin file inherits the same definition as pkgs.

I'll make PRs for other plugins if this gets accepted.
[Here](https://github.com/eraserhd/nixpkgs/tree/kak-ansi)'s a tested
branch for the `kak-ansi` plugin.
@eraserhd
Copy link
Contributor Author

@alyssais I'm assuming you meant "space tweak" not "doc tweak" (or I'm missing something?), but this should be ready now.

Thanks

@alyssais
Copy link
Member

@alyssais I'm assuming you meant "space tweak" not "doc tweak"

Err… yes

@alyssais alyssais merged commit c9bd5b8 into NixOS:master Jun 26, 2019
@eraserhd
Copy link
Contributor Author

Thank you!

@eraserhd eraserhd deleted the kakoune-plugins branch June 27, 2019 13:59
@jcpetruzza
Copy link
Contributor

@eraserhd Thanks for adding support for kakoune plugins! I'm trying to use this feature but I'm running into an issue: plugins are sourced after one's kakrc. This is problematic imo since then one can't require/start/configure those plugins (e.g. the latest kak-powerline defines a powerline-start command that one needs to run explicitly to activate it).

The source of the problem seems to be the wrapper script, that runs kak -E "source ../share/kak/plugins.kak" ..., since the arguments of -E will get executed after all rc scripts were executed.

IIUC, the idea was to avoid rebuilding kakoune when the selected plugins change; could this be achieved in some other way? E.g. by using symlinks to the outputs of kakoune-unwrapped but changing $out/share/kak/autoload to contain both kakoune's rc scripts and the plugins?

@eraserhd
Copy link
Contributor Author

eraserhd commented Aug 3, 2020

@jcpetruzza Hi! Yeah, I've noticed this also, after several weeks (or months?) of using it.

The problem is that there isn't a way to tell Kakoune to use a different runtime directory. If there was, then the wrapper could easily symlink all the original runtime plus plugins into a new runtime, and wrap kak to use that runtime.

So, it could be done in two parts, I think: A PR to kakoune to use $KAK_RUNTIME, if it exists, instead of the normal mode of finding the runtime, and then a PR to Nix to use it. I think that's a pretty nice solution!

Want to try it? If not, I'll put it on my to-do list, but I'm quite backlogged, so no telling when I will get to it.

@jcpetruzza
Copy link
Contributor

I think I got it working in nixpkgs in #91792; the tldr is that we can let nixpkgs make symlinks to everything (kakoune and the plug-ins), and just copy the kak binary, needed for path resolution. The PR is still waiting for review, though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants