Closed ficoos closed 4 years ago
Can you place the copyright waiver as the first commit and squash the two commits into a single one?
Can you place the copyright waiver as the first commit and squash the two commits into a single one?
done
@alexherbo2, Is there anything you are waiting for me to change?
Are you sure the positional arguments are correct?
I’m not sure I want the abstraction here. See #11.
The positional arguments remain the same as the only change is the added prepended arguemnt when passing arg{@} but there is no way to slice the argument without going to sh and I don't think the performance hit is worth it.
With regard to #11 it will be too limited for me as I actually have specialized commands that I use (like suspend-and-resume or float-terminal).
If kakoune had proper scripting the actual API should be just decorating a command.
build_connect_command [cmd]
that gets a command and returns it decorated with all the connect stuff.
That way you could just:
terminal ( build_connect_command %arg{@} )
But, AFAIK there is no way to return a value from a command in kakoune.
You can just implement #11 using connect-command
.
terminal
is an alias to the right windowing. How about changing that alias to control it?
My concern with implementing in connect.kak is that it defeats the purpose of terminal
as a building block user scripts can rely on. It could be nice to have a solution upstream, rather than making each plugin implementing their own solution to control the windowing.
This is why you need to not care about the windowing, connect-command
just builds the command and passes it to whatever command you want to use it.
As stated, a user can have multiple commands that operate on shell commands (e.g. terminal, repl, suspend-and-resume).
If you want to go minimal and leave windowing to someone else, only implement connect-command
.
You can also try and implement some shell function so that we can run
terminal %sh{$KAK_CONNECT "$@"}
repl %sh{$KAK_CONNECT "$@"}
where KAK_CONNECT is a shell function that builds the command and prints it.
declare-user-mode terminal
map global terminal v ': alias global terminal terminal-vertical<ret>' -docstring 'Vertical'
map global terminal h ': alias global terminal terminal-horizontal<ret>' -docstring 'Horizontal'
map global terminal f ': alias global terminal terminal-floating<ret>' -docstring 'Floating'
map global normal <c-b> ': enter-user-mode terminal<ret>' -docstring 'Terminal'
@ficoos terminal-mode.kak
Most editor commands accept
--
as a flag to denote that no further flags should be processed. This allows opening files named like flags (e.g.-wait
).A user might have specialized terminal-like commands to open terminals with certain properties (e.g. terminal-on-left, floating-terminal). This allows a user to use those alternative commands instead of only supporting the terminal command.
This patch also changes to docstrings to document the arguments similar to other kakoune commands.