helix
helix copied to clipboard
[Proposal] Buitin support for `Integrated Terminal`
Nowadays, I switch to helix + Zellij (a modern tmux alternative) + Alacritty, the combo are very powerful.
But sometimes, I miss the time when I was using vscode (with vim extension).
The Integrated Terminal feature is very useful.
What if we got an Integrated Terminal feature inside helix?
- Unconflicted key combo (think about this:
ctrl-r/ctrl-nboth used in zellij & helix - Unified pane/tab resize & other management functions
- Share same clipboard
- Easy history management of command line
- Persistentable pane layout (via $workspace/.helix/layout-config)
Seems like a lot of effort for little gain. Surely it is the job of your terminal to be your terminal? Adding another terminal inside Helix seems a bit much. If your terminal software has Window management and tabs (like kitty) then you can do what you want? In kitty I just write little bash scripts to open workspaces setup how I want them.
I think I am the wrong audience for this, I tried tmux for a while and hated it, seems like a pointless idea. Remembering SSH sessions was cool, but why not just use a better terminal that does what you want? The author of Kitty has some good points on tmux and clones https://github.com/kovidgoyal/kitty/issues/391#issuecomment-638320745
Sorry to sound negative, if people want it then go for it! I just thought I would chime in with my personal opinion, people will have different views I am sure.
Neovim has integrated terminal and it is super useful to me both in toggle and float modes. It seems to me a good approach is not depend on some GUI terminal application (like kitty) and have everything you got used to have and do in any terminal emulator.
Neovim has integrated terminal and it is super useful to me both in toggle and float modes. It seems to me a good approach is not depend on some GUI terminal application (like kitty) and have everything you got used to have and do in any terminal emulator.
Yes, I do agree. I want integrated terminal too.
and @David-Else somehow, I agree with you about terminal multiplexer is hacky, so I don't want a tmux, nor zellij, I need an integrated terminal to play a role to support multi-pane/tab inside helix.
This was discussed in the past on Matrix and there seems to be a desire to implement it, but it's pretty complicated and would take a lot of work.
A fully functioning xterm environment is a lot of work and slightly inefficient as pointed out by the comment above, we need to re-parse all possible terminal escape sequences and reinterpret them (https://github.com/alacritty/vte can help but that's just the parsing bits).
You're essentially building a virtual terminal that renders to a part of the application. It would be about as much work as rebuilding tmux/zellij in helix.
I'd be interested in a proposal/experiment that implements this but I don't intend to work on this feature any time soon: personally I just always use tmux so I don't have a lot of motivation to focus on this.
There is implemented terminal which can be included (with some code reduction, like vi mode etc.) - https://github.com/alacritty/alacritty/tree/master/alacritty_terminal
This would probably be quick to be made as a plugin, whenever plugin support is complete. It'd be a reasonable compromise; keeping the core from bloat whilst the people that really want it can just install it.
maybe look in to guake (linux) and conemu (win), those are configurable as drop down (quake style) consoles, hidden and only a shortcut away. following you to the active workspace and your cursor with multiple displays. even working well with i3 quite awesome dev tools in my opinion :> Edit: forgot to mention split views and tabs..
I have to say that what made me happy about helix was it's non-bloated build. Maybe adding a built-in terminal it's a bit too much. I understand that this feature is useful, but I agree with @David-Else
Surely it is the job of your terminal to be your terminal? Adding another terminal inside Helix seems a bit much.
I just wanted to leave my comment here for you guys think about
If helix could work in client-server mode, each win/pane (include terminal) is a standalone client/process, share same server instance, same lsp server, same clipboard, and can communicate/cooperate with window manager(eg. wezterm) to provide interaction functions (eg. jumping to file, switching pane/tab). That would make sense, and no need for built-in terminals.
I would really like this feature. This is the only thing that is keeping me from switching from neovim to helix.
I understand the argument that there are other tools that can be used to get helix and a terminal in the same window, but in different panes. This is very "Unix philosophy" thinking, and generally I'm a fan of it.
However, I want a setup that I can take to any OS, including config files, without having to worry about other tooling (as much as possible, since obviously LSP servers etc need to be installed separately). Recently I have had to do some dev work on Windows, and it has been impossible to bring the tmux + nvim setup I usually use on Linux to this environment. I have ended up setting neovim up with a toggle-able integrated terminal to fit this use case.
Also, an integrated terminal would be helpful once helix has a graphical mode. Without this, the user is left switching windows in order to get to a terminal - that seems like a bad user experience to me.
I just want to quote a comment from the plugin discussion
I don't want to use anymore a text editor which relies for 95% on plugins to do the work. I think plugins, when overused like they are in Neovim world, are a total mess for the following reasons: * UI/UX inconsistencies (between themselves and/or the editor) * conflicting/overlapping features (between themselves and/or the editor) * distribution and versioning problems (some plugins require the nightly version, some don't) * a lot of copy/paste configuration that you see one time in your life and forget or don't understand anymore * often are unreliable and become unmaintained or broken over time To give plugins total freedom it's the easy path at first because you avoid the problem of designing a good set of APIs, but it's a road to hell.
One of my favorite things about Helix is that it includes quite a lot of functionality out of the box. One might see this as bloat, but honestly, something like vim feels way more bloated once you've added all plugins to achieve the same functionality. To have a terminal, fuzzy finder, file tree, lsp, snippets etc in vim it feels like something breaks every month.
I would guess around 80% of people want to have a integrated terminal (even if they dont use it all of the time). Also it is a standard feature in every modern editor, so I think it would be missed heavily by many people who use it daily.
Is there anyone working on this? I would like to help if possible
Could I configure fish to fg on ^Z? :think:
Since adding a built-in terminal would be an overkill, resolving binding conflicts by looking at common applications would be a much better solution.
Zellij is obviously doing things right. Easier to press shortcuts instead of something like "Ctrl+Shift+
Looking at all your points @hh9527:
- These conflicts can be resolved by helix. I think any editor should have the full privilege of using the very common "Ctrl" key. Helix should go easy on "Alt". This could be done by nesting bindings under leader like keys(match mode, space mode, etc.) Some people don't seem to like this idea tho.
- Zellij already seems to be a great option for that
- This doesn't seem like a problem to me. Copying to and from anything to anywhere seems easy.
- For things like this there could be scripts or plugins for integrations with terminals and external applications.
- This could be requested at zellij. Rusty applications like nushell, helix, zellij, alacritty, wezterm, etc. could have plugins and scripts to integrate with each other to do fancy stuff.
Adding support for Windows to zellij might be a more straightforward path.
Could I configure
fishtofgon ^Z? :think:
I have the same binding
Personally I don't think this belongs in core. The Unix philosophy is not hard and fast, as I think many people who use helix agree, but an entire terminal emulator and a text editor are about as orthogonal in functionality as it gets. This is the definition of bloat.
I don't use helix because it has no integrated terminal. I'm very attached to the vscode workflow where I press a hotkey to create a terminal in the directory I'm working in. I could possibly replicate this workflow using other tools but I'm not aware of them and it would be convenient if it was built in. I would be fine if it was plugin feature but that seems like it is a far ways off.
I would be fine prefixing all my commands with a :sh but that doesn't work for programs needing input. The videos presented in the documentation are also unfriendly, regarding on how to debug, which seemed to require the use of tmux as well.
If even vim has this feature, it's probably not much of a bloat IMO.
Sorry for spamming this thread, but I see tmux being suggested here as an alternative so I just wanna add my two cents as a heavy tmux user. I do everything inside tmux. I just attach to the tmux session right after SSH-ing into the machine, as this allows me to pick up my work anytime from another device very easily.
Personally, using tmux just for getting a terminal doesn't really work for me, as I already use <PREFIX> l for quickly switching between workspaces. Using tmux for simulating an integrated terminal would mean much more effort when switching between the 2 workspaces I'm working on at the same time, cuz I'll now have to actually look up that workspace window (instead of reflexively hitting <PREFIX> l), and actually also attach to the other workspace's "terminal window" first, just to set that terminal window as the "last window" so that I can use <PREFIX> l for getting into the terminal of that target workspace later on.
(A possible workaround for this is to put each workspace inside a tmux session instead of window, and use <PREFIX> L to switch between workspaces instead. However, this just throws the issue one level up and heavy users of tmux sessions are still screwed...)
That said, the neovim integrated terminal is far from perfect, and I actually indeed use tmux "just" for getting a terminal when I need to use it seriously. However, sometimes I just want to run a quick command (e.g. cargo clippy), and a quick and dirty terminal inside of the editor is very helpful without messing up my tmux window history.
Is there any idea on how this could be implemented? I was thinking it might be possible to use a pseudo terminal crate like portable-pty, turn it into a Document and use helix-veiw to display it.
I would like to +1 @hh9527 comment - a client-server architecture would allow users seamlessly switch between helix and terminal windows. I think Kakoune has done this right:
With Kakoune, you can collaboratively edit the same file: all new windows created by the editor are clients, and can simultaneously modify the content of a file. As such, windows are fully under the control of your X11 window manager or can be managed in a single terminal through Kakoune's tmux support. - https://kakoune.org/
Because of this, they don't have to implement a full blown terminal emulator or even a window manager. All while users can move between their editor and terminal (and, of course, any other application like a web browser) with a single set of shortcuts.
+1 for that feature cuz it can be speed up my workflow out of the box.
I use neovim as terminal multiplexer in alacritty and it's very convenient. Why do I need tmux?
Also, integrated terminal could be reused to make text editor work as pager. Why do i need less?
I don't think we should have an integrated terminal in Helix. There are too many good multiplexers out there. I see no point in adding the complexity to core.
There are too many good multiplexers out there.
I use tmux and zellij a lot but I still want the integrated terminal.
IMO the point of an integrated terminal is that it's, well, integrated. It's not meant to be just another terminal.
For example, I can run a linter, get some warnings with file paths and line numbers. Then focus on the path, press gf and I get a buffer opened for that file (and even exactly at that line). This is not something a multiplexer can do. And this is just one example.
:sh
There are too many good multiplexers out there.
I use
tmuxandzellija lot but I still want the integrated terminal.IMO the point of an integrated terminal is that it's, well, integrated. It's not meant to be just another terminal.
For example, I can run a linter, get some warnings with file paths and line numbers. Then focus on the path, press
gfand I get a buffer opened for that file (and even exactly at that line). This is not something a multiplexer can do. And this is just one example.
Having trouble understanding your point. To me this feels like a use case for copying a linter warning file path and line number to system clipboard so it can be used outside Helix. But if there's a specific flow you can share to help me understand I would appreciate it.