mawww / kakoune

mawww's experiment for a better code editor
http://kakoune.org
The Unlicense
9.88k stars 712 forks source link

[REQUEST] Support terminal command on WSL? #4573

Open tom-huntington opened 2 years ago

tom-huntington commented 2 years ago

Feature

Currently on WSL

:terminal

fails with termcmd option is not set https://github.com/mawww/kakoune/blob/13b16815939edde8e151b2c141942f2771bd1b39/rc/windowing/wayland.kak#L39

I'm not sure what the correct command should be, perhaps something like cmd.exe ubuntu.

A work around is to just use tmux.

Feel free to close, just thought this might be easy enough to implement if you know what you're doing.

Screwtapello commented 2 years ago

I'm not familiar with WSL, but the fact that you wound up in wayland.kak suggests that your WSL includes support for the Wayland graphics API. Kakoune assumes that if you have Wayland graphics, you must be using a Wayland-based terminal, and if you don't explicitly set which terminal to use yourself, it looks for some commonly-available ones:

https://github.com/mawww/kakoune/blob/13b16815939edde8e151b2c141942f2771bd1b39/rc/windowing/wayland.kak#L15-L22

If you install one of those, :terminal will at least do something even if it's not exactly the terminal you're currently using.

What terminal are you actually using?

mawww commented 2 years ago

This exact same 'termcmd option is not set' strings appears in x11.kak as well, which is a more likely candidate for WSL.

There is two ways to support the terminal command for WSL, either do what @Screwtapello suggested and install a terminal that Kakoune can recognize through either the x11.kak or wayland.kak support script, or we need to add a wsl.kak script that is able to detect and use WSL specific terminals, assuming this is possible from inside WSL.

tom-huntington commented 2 years ago

I came across this trying to install kaktree which works well with tmux. However after reading the following,

Nothing crazy, right? The thing is that a lot of new users, me included, look for an option to vertically split Kakoune’s window. That’s usually how we use Vim - two panes, side by side. Kakoune is not a window manager. It’s a text editor - it allows the user to efficiently edit text. You want multiple windows? Open another terminal window and start Kakoune client instance.

That’s where the i3 comes in. Any tiling windows manager for that matter would do. Those work very well in situations when you open a lot of terminal windows because it handles the windows' layout. https://ciesie.com/post/i3_kakoune_nnn/

I'm imagining that, without tmux, you would have to position the secondary window manually, and windows' window manager is a bit to basic to make this feature worth it. I think this should be closed.

If you want vim like splits, you should use tmux. If you want Kakoune in a secondary terminal just open up a new wsl terminal and connect a new client with kak -c <server-name>.

mawww commented 2 years ago

I would not expect WSL support to help much with window placement as Windows does not provide fancy window management, but it would still be good if we could open a new terminal window from within WSL without requiring tmux, x11 or wayland.

I do not have any windows box available but I would merge an eventual wsl.kak windowing support script.

Screwtapello commented 2 years ago

As I understand it, WSL doesn't necessarily include any particular terminal or GUI, so there may be no good way to make a generic WSL windowing module.

However, Windows Terminal was designed to support WSL, it has native support for windows, tabs, and splits, and (if I understand correctly) even though it's a Windows app it can be run from inside WSL. As a result, it should be possible to make a Windows Terminal windowing plugin.

Assuming you can open new Windows Terminal windows/splits/tabs from inside WSL, anyone who's interested should probably start with the Kitty plugin (since that's another standalone terminal that supports windows, tabs, and splits) and try hacking it up until it works.