Closed andreyorst closed 1 year ago
As I understand it, the current system is that scripts should only ever call terminal
, so that the user can decide whether they prefer panes or windows, if that distinction even makes sense in their environment. When would a script need to override the user's preference?
For example, in fzf.kak there is a way to open file in either vertical, horizontal split, or new window, if we're inside Tmux, and only window when we're inside X11. To do that I need to define three different wrapper commands around different terminal
commands to open splits or windows. And it still doesn't support iTerm in terms of creating new window, because to create a window I use x11-terminal
With terminal
command supporting those arguments I wouldn't need to define those commands, an I wouldn't need to handle tmux myself at all.
With terminal-window
or terminal -window
It would be much easier to me to support both X11 windows, and terminal windows like in iTerm.
The terminal
command is all over the place. The *-terminal-tab
is defined for kitty
and iterm
, but only kitty
has it aliased to terminal-tab
. tmux windows are just tabs, but it doesn't even have that definition. kitty
allows choosing window type for the terminal command, but that means even tho tabs are functionally like windows, you can use them without reimplementing every command that utilizes terminal
.
you probably should be able to pass the terminal type to the terminal
command (with option as a fallback) which would create new panes, tabs, windows, with fallbacks to whatever it supports.
I've never actually seen this stated explicitly, but my impression is that Kakoune generally prefers portability over polish. It's not that a polished, pleasant user experience is bad or undesirable, but that's very hard to be polished and portable. Sometimes Kakoune manages to be both, but when it really has to pick one or the other, it picks portability every time. For example:
The terminal
alias is a very Kakoune way to do things, since "open a new terminal" is a thing that can reasonably be done on any modern OS; even without a GUI on the bare Linux console if you have the right permissions set up. Because it's so generic, it can't provide the level of polish that fzf.kak
desires, but a plugin that uses terminal
will be equally clunky everywhere.
Something like terminal-tab
or terminal-pane
or terminal-window
would not be a very Kakoune way to do things, since there are environments that only provide one or two of those options. Even if the missing functionality falls back to some other method, you could still wind up with scripts that are lovely in one environment and terrible elsewhere. For example, I can imagine a script that opens a new window for each project, and tabs in that window for the files in that project. That would be really nice for Kitty, which supports both tabs and windows, but in tmux tabs and windows are kind of the same thing, so that script would just create a disorganised mess.
Maybe over time Kakoune will change course from portability to polish; heck, maybe it should. I just wanted to point out that this is a bigger deal than just adding some more standard aliases.
Because it's so generic, it can't provide the level of polish
I suppose that's just because it wasn't a goal, not because it is generic. From my point of view I see no problems with supporting everything with single of two different terminal
commands.
After https://github.com/mawww/kakoune/pull/2617 PR
terminal
command was made the one true way to support different terminals from scripts without relying ontermcmd
explicitly. Whileterminal
is great, it doesn't support creating new windows. I would like to haveterminal-window
command too.It will complete the
terminal
command set and make it easier to use in scripting. Currently we havetmux-terminal-window
,screen-terminal-window
, anditerm-terminal-window
aliases to use to create new windows. This allows creating new windows in multiplexers and iterm, but there's no command to do so in X11, except there actually isx11-terminal
, which is essentiallyx11-terminal-window
.My proposal is to throw away
thing-terminal-window
and have only oneterminal-window
alias for the same task, that will be set accordingly to environment in the same way how currentterminal
alias does this.It will be even better if,
terminal
command would support-window
switch along with switches proposed in https://github.com/mawww/kakoune/issues/1363.