-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposal] Buitin support for Integrated Terminal
#1976
Comments
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 kovidgoyal/kitty#391 (comment) 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. |
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. |
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
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
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 |
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+`, etc. And it is modal so lesser area for conflicts. IG the problem lies in helix using the alt key as well. Super is left out which would be used by WMs. Looking at all your points @hh9527:
|
Adding support for Windows to |
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. |
|
As a windows user, even I too think integrated terminal is not much worthy. Windows terminal will let you use tabs and splits. So for running code / REPL sort of things are easily addressed. Integrated terminal must be in the core if we ever get a GUI application in future. |
u mean core as in
|
I meant general core. |
It seems clear from the discussion here that there are different groups of users with different environments and needs. I'm in the But, I can understand how users who don't use For the record, I use a separate I simply can't see how So, I'm firmly in the anti-terminal emulator camp, because I already have a tool that does this for me. |
I changed my mind on the topic, coming into ZelliJ. Realizing terminal functionality is a lot trickier to implement, especially one comparable with zellij, I've come to the conclusion that Helix has better things to worry about. |
Although I like the Zellij's floating panes feature, I don't want to nest one more layer in my terminal. So, here's how I integrated WezTerm into Helix: Firstly, I created a script to split WezTerm:
#!/bin/sh
pane_id=$(wezterm cli get-pane-direction down)
if [ -z "${pane_id}" ]; then
pane_id=$(wezterm cli split-pane)
fi
wezterm cli activate-pane-direction --pane-id $pane_id down Secondly, to run code in the newly created pane:
#!/bin/sh
source wezterm-split-pane.sh
program=$(wezterm cli list | awk -v pane_id="$pane_id" '$3==pane_id { print $6 }')
if [ "$program" = "lazygit" ]; then
echo "q" | wezterm cli send-text --pane-id $pane_id --no-paste
fi
filename="$1"
basedir=$(dirname "$filename")
basename=$(basename "$filename")
basename_without_extension="${basename%.*}"
extension="${filename##*.}"
case "$extension" in
"c")
run_command="clang -lcmocka -lmpfr -Wall -O3 $filename -o $basedir/$basename_without_extension && $basedir/$basename_without_extension"
;;
"go")
run_command="go run $filename"
;;
"scm"|"rkt")
run_command="racket $filename"
;;
esac
echo "${run_command}" | wezterm cli send-text --pane-id $pane_id --no-paste
# wezterm cli activate-pane-direction up And finally, I just added the following into the Helix config file (need this PR to expand filename): [keys.normal.";"]
r = ":sh run.sh %val{filename} > /tmp/run.log 2>&1" Now, I only need to press
@xJonathanLEI WezTerm can do that:
config.hyperlink_rules = wezterm.default_hyperlink_rules()
table.insert(config.hyperlink_rules, {
regex = '^/[^/\r\n]+(?:/[^/\r\n]+)*:\\d+:\\d+',
format = "$0",
})
wezterm.on('open-uri', function(window, pane, uri)
local user = os.getenv('USER')
local start, _ = string.find(uri, '/Users/' .. user)
if start == 1 then
local direction = 'Up'
local hx_pane = pane:tab():get_pane_direction(direction)
if hx_pane == nil then
local action = wezterm.action{
SplitPane={
direction = direction,
command = { args = { 'hx', uri } }
};
};
window:perform_action(action, pane);
else
local action = wezterm.action.SendString(':open ' .. uri .. '\r\n')
window:perform_action(action, hx_pane);
end
-- prevent the default action from opening in a browser
return false
end
-- otherwise, by not specifying a return value, we allow later
-- handlers and ultimately the default action to caused the
-- URI to be opened in the browser
end) |
I think the real benefit of having a terminal in the editor is to be able to use all of the editor's actions & movements in the terminal. Writing a small bash script and tweaking Helix's config, we can cover most of the above use case. Here is the result: helix-term.mp4Bash script export TERM=xterm # disable color
export PAGER=""
if [ -e ~/.config/helix/exec.env ]; then
source ~/.config/helix/exec.env 2> /dev/null
fi
if [ -e "$PWD" ]; then
cd "$PWD"
else
PWD=$(pwd)
fi
stdin=$(cat)
echo "$stdin"
echo
eval "$stdin"
echo '['"$PWD"']$'
env > ~/.config/helix/exec.env 2>/dev/null Helix config: [keys.insert]
C-t = ["extend_to_line_bounds", ":pipe sh ~/.config/helix/exec.sh 2>&1", "normal_mode", "open_below"]
[keys.normal]
C-t = ["extend_to_line_bounds", ":pipe sh ~/.config/helix/exec.sh 2>&1"]
[keys.select]
C-t = [":pipe sh ~/.config/helix/exec.sh 2>&1"] This simple solution has issues, e.g. it isn't really interactive but just reports the output when the command ends, and it probably has a lot of other quirks (use at your own risk). However in practice I find most shell commands end quickly so it's not much of an issue and the workflow seems "good enough" to be useful. Reading through the thread it is not clear this proposition intends to enable Helix's movements & actions in the terminal, but I hope this is where it is headed. Also (I am new to the topic but) rather than embedding a terminal in Helix, isn't possible to reuse Helix's parent terminal to execute commands and plug on its inputs/outputs? PS: I couldn't map command execution on enter as I initially wanted (this would be annoying when typing text in insert mode in other buffers) which is slightly confusing. If anyone knows how to remap shortcuts on one buffer only I am interested. |
Like already said here a few times, I think the real benefit of an integrated shell in comparison to a terminal multiplexer is an understanding of the editor for shell concepts:
This way, a user can scroll much more comfortable within the terminal and is able to select (and copy) conceptually belonging parts really fast (into a new buffer for example). More interpretation is possible:
To prevent editorception, it would also be really handy, when a call of Edit: I forgot: Open something in a helix buffer does not only affect calling |
After reading this thread I am surprised to see no one mention the ability to have all of your normal text manipulation bindings from the editor while still in the terminal. Extremely nice feature in my opinion. And I also agree with the one commenter above that an integrated terminal avoids duplicated keybindings. Sure, you can rebind your multiplexer to not use the same keys for creating split windows as your editor, but you would still need to remember both keymaps and switch between them. It's vastly more efficient (from a keymap perspective) to have all of your keybindings inside the editor. |
hi, yazelix guy here yazelix is a glorified config (that wanted to be a plugin) and it stabs at
Helix is nearing a plugin system release and Yazelix will change to accommodate that.
I probably won´t be writing any plugins myself but Yazelix is happy to work with or as part of file-tree helix plugins or integrated terminal plugins that arise The important thing here is that everything works together nicely and integrated |
Combining zellij with helix pretty much solves any issues regarding the terminal. Multiple tabs and popup panes(especially that) does solve all my concerns. Floating panes also allows automatic commands to be run. |
I disagree, it's still fragmented, buffers are different, edits on one pane need to be reloaded in the other one and so on. It seems good at first but you realise that it falls short and create other kinds of annoyances. |
Have you tried This setup can be built with customized layout and run on every zellij/shell startup. |
I've that in my workflow with zellij included: You just need the |
This is a good starting point, but Helix is not able to understand the scrollback, isn't it? Does zellij opens the whole scrollback in Helix or just the last command output (so is zellij able to interpret the prompt)? For example for C++ compiler output, it is a good rule of thumb to just handle the first error message given by the compiler so one need to jump the last prompt and scroll down from there on. Helix shouldn't be able to interpret the prompt, so the whole scrollback is only partially helpful here. |
Yes.
No, but I don't mind. I just switch back to helix and open up the picker and go to the given line number. |
I'm not sure I follow, I tried |
Helix is supposed to be batteries included. So I can see why most would want the builtin terminal. Though, hx+tmux handles everything you need, even the floating terminal. Despite the batteries included, I would consider a builtin terminal for Helix as a low priority. I used NVChad + Tmux. Great for handling all kinds of setups. The terminal plugin with NVChad was great. When switching to Helix, I missed the builtin terminal at first. Then I realized Tmux has a first key binding is the floating terminal.
found here: tmux config |
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?ctrl-r/ctrl-n
both used in zellij & helixThe text was updated successfully, but these errors were encountered: