mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-30 17:43:42 +00:00
2a911454d3
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.
31 lines
937 B
Bash
31 lines
937 B
Bash
#!@bash@/bin/bash
|
|
|
|
# We use the -E option to load plugins. This only makes sense when we are
|
|
# starting a new session, so we detect that. Also, Kakoune can only handle
|
|
# one -E option, so we prepend loading plugins to an existing one.
|
|
args=( "$@" )
|
|
loadPlugins=true
|
|
EValueOffset=-1
|
|
pluginScript='@out@/share/kak/plugins.kak'
|
|
|
|
for (( i = 0; i < ${#args[@]}; i++ )); do
|
|
case "${args[i]}" in
|
|
-n|-c|-l|-p|-clear|-version) loadPlugins=false;;
|
|
-E) EValueOffset=$(( i + 1 ));;
|
|
--) break;;
|
|
esac
|
|
case "${args[i]}" in
|
|
-E|-c|-e|-s|-p|-f|-i|-ui|-debug) i=$(( i + 1 ));;
|
|
esac
|
|
done
|
|
|
|
if [[ $loadPlugins = true ]]; then
|
|
if (( EValueOffset >= 0 )); then
|
|
args[EValueOffset]="source '$pluginScript'"$'\n'"${args[EValueOffset]}"
|
|
else
|
|
args=( "-E" "source '$pluginScript'" "${args[@]}" )
|
|
fi
|
|
fi
|
|
|
|
exec @kakoune@/bin/kak "${args[@]}"
|