-
Notifications
You must be signed in to change notification settings - Fork 715
Shell scripting
Bruno Heridet edited this page Oct 30, 2020
·
6 revisions
if you run this in the kakoune command line:
echo %sh{ echo $$ }
You'll get a random number, corresponding to the PID of the temp subshell used to run the command. You need the PID of the parent, which translates to :
echo %sh{ echo $PPID }
https://unix.stackexchange.com/questions/65803/why-is-printf-better-than-echo
In kakoune's shell expansion, any $kak_
variable will be expanded before the execution of the shell script.
For example:
evaluate-commands %sh{
echo "echo -debug $kak_selection"
echo "execute-keys x"
echo "echo -debug $kak_selection"
}
Will do the same as:
evaluate-commands %sh{
echo "echo -debug $kak_selection"
echo "echo -debug $kak_selection"
}
execute-keys x
To print the whole line selected by execute-keys x you must do
evaluate-commands %sh{
echo "echo -debug $kak_selection"
echo "execute-keys x"
}
evaluate-commands %sh{
echo "echo -debug $kak_selection"
}
- https://github.com/dylanaraps/pure-sh-bible - lots of snippets to deal with strings, lists…
- https://en.wikipedia.org/wiki/Delimiter - about quoting and escape characters
- Normal mode commands
- Avoid the escape key
- Implementing user mode (Leader key)
- Kakoune explain
- Kakoune TV