mirror of
https://github.com/mawww/kakoune.git
synced 2026-11-04 14:06:36 +01:00
Page:
Shell scripting
Pages
Ambiguous Keys
Annotated examples of "Kakoune script"
Avoid the escape key
Bar
Bc
Building
Clang
Community
Ctags
Distinguish between focused and unfocused clients in Tmux
Documenting Plugins
Dynamic Window Title
EditorConfig
Eval Exec
Fuzzy finder
Git integration via Tig
Grep
HTML editing
Hacking
Header files
Highlighters
Home
IDE
Implementing user mode
Increment and Decrement
Indentation and Tabulation
Info boxes
Installing Plugins
Integrating Other CLI apps
JSON RPC
Jumplist
Kak daemon helper : 1 session per project
Languages
Line flags
Manipulating dates with Chronic
Migrating from Vim popular plugins
Migrating from Vim
Normal mode commands
OpenBSD
Plugin Managers
Qalculate
Ranger
Readline
Regex
Registers & Clipboard
Registers Clipboard
Reverse search
Running commands at startup
Rust
Selections combinations
Selections
Setting Plugin Options
Shell scripting
Status line
String syntax
TUI
The window scope
Tips for building from source
Undo tree
Wc
Windows tips
Wrapping
Writing Plugins
kak ‐p
macOS tips
zsh zle
No results
6
Shell scripting
Bruno Heridet edited this page 2020-10-30 16:13:25 +01:00
How to get the process id of the current kakoune client?
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 }
Why should printf be favored over echo?
https://unix.stackexchange.com/questions/65803/why-is-printf-better-than-echo
Passing options and values to an expansion
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"
}
See also
- 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
AWK
Wiki Home Page
Onboarding
Keys
- Normal mode commands
- Avoid the escape key
- Implementing user mode (Leader key)
- Kakoune explain
- Kakoune TV
Editing
User Interface
Integration with OS and other tools
- Languages
- IDE
- Bar
- Dynamic Window Title
- Kak daemon helper : 1 session per project
- Registers & Clipboard
- macOS tips
- Windows tips
- Fuzzy finders
- JSON-RPC UI
- bc
- Qalculate!
- wc
- Shell Scripting
- Manipulating dates with Chronic
- Integrating Other CLI apps
