Add a nop command to avoid accidental shell output evaluation
This commit is contained in:
parent
f84e46f805
commit
08fd946c07
|
@ -194,6 +194,12 @@ Commands are entered using +:+.
|
||||||
or *g*lobal scope.
|
or *g*lobal scope.
|
||||||
* +c[ol]a[lias] <name> <colspec>+: define a color alias, so that name can be
|
* +c[ol]a[lias] <name> <colspec>+: define a color alias, so that name can be
|
||||||
used instead of colspec in contexts where a color is needed.
|
used instead of colspec in contexts where a color is needed.
|
||||||
|
* +nop+: does nothing, but as with every other commands, arguments may be
|
||||||
|
evaluated. So nop can be used for example to execute a shell command
|
||||||
|
while being sure that it's output will not be interpreted by kak.
|
||||||
|
:%sh{ echo echo tchou } will echo tchou in kakoune, wherease
|
||||||
|
:nop %sh{ echo echo tchou } will not, but both will execute the
|
||||||
|
shell command.
|
||||||
|
|
||||||
String syntax
|
String syntax
|
||||||
-------------
|
-------------
|
||||||
|
|
|
@ -674,6 +674,8 @@ void register_commands()
|
||||||
{
|
{
|
||||||
CommandManager& cm = CommandManager::instance();
|
CommandManager& cm = CommandManager::instance();
|
||||||
|
|
||||||
|
cm.register_commands({"nop"}, [](const CommandParameters&, Context&){});
|
||||||
|
|
||||||
PerArgumentCommandCompleter filename_completer({ complete_filename });
|
PerArgumentCommandCompleter filename_completer({ complete_filename });
|
||||||
cm.register_commands({ "e", "edit" }, edit<false>, filename_completer);
|
cm.register_commands({ "e", "edit" }, edit<false>, filename_completer);
|
||||||
cm.register_commands({ "e!", "edit!" }, edit<true>, filename_completer);
|
cm.register_commands({ "e!", "edit!" }, edit<true>, filename_completer);
|
||||||
|
|
|
@ -12,7 +12,7 @@ def -shell-params -file-completion \
|
||||||
echo "try %{ db *grep* } catch %{}
|
echo "try %{ db *grep* } catch %{}
|
||||||
edit -fifo ${output} *grep*
|
edit -fifo ${output} *grep*
|
||||||
setb filetype grep
|
setb filetype grep
|
||||||
hook buffer BufClose .* %{ %sh{ rm -r $(dirname ${output}) } }"
|
hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }"
|
||||||
}}
|
}}
|
||||||
|
|
||||||
hook global WinSetOption filetype=grep %{
|
hook global WinSetOption filetype=grep %{
|
||||||
|
|
|
@ -5,7 +5,7 @@ def -shell-params make %{ %sh{
|
||||||
echo "try %{ db *make* } catch %{}
|
echo "try %{ db *make* } catch %{}
|
||||||
edit -fifo ${output} *make*
|
edit -fifo ${output} *make*
|
||||||
setb filetype make
|
setb filetype make
|
||||||
hook buffer BufClose .* %{ %sh{ rm -r $(dirname ${output}) } }"
|
hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }"
|
||||||
}}
|
}}
|
||||||
|
|
||||||
hook global WinSetOption filetype=make %{
|
hook global WinSetOption filetype=make %{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user