blob: 48a971a10c6e66e8f6685a5dd429ddbaf5cbf321 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!@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[@]}"
|