-
Notifications
You must be signed in to change notification settings - Fork 26
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
Flow direction in performance GIF #2
Comments
Run this command to get cursor at the bottom of an empty screen: clear; repeat $LINES print Done :-) Now you have the "flow" from the gif. Did I misunderstand the question? |
This gif is used here: https://github.com/romkatv/powerlevel10k#uncompromising-performance Transient prompt is explain here: https://github.com/romkatv/powerlevel10k#transient-prompt. This section uses a similar "flow" (meaning that the cursor starts at the bottom of an empty screen rather than at the top). |
So I put this just somewhere in my |
I think you are confused. Try holding Enter for a while and then run
How can you get history go down? Doesn't it always go up and disappear above the top boundary of the terminal window? |
Okay I totally misunderstood the GIF.
Exactly. But it would be more healthy. Consider that it is likely that the terminal is full most of the time. So you always have to stare at the bottom of the screen. Usually you set up your monitor so that the top edge is at a horizontal line with your eyes. And most other applications put the important/interesting stuff at the top or are better distributed over the center of the screen and usually are adjustable (e.g. scrolling, bottom margin, ...). So after all each of them is more convenient to work with than the console where you always stare at the bottom all the time. Also it does not make sense to push the monitor up, since this would affect all other applications. Anyways this is not related to this "issue"/thread. I just thought this was a hint to an approach how to achieve that goal. Thank you very much for helping me so fast and kind. 🙏 |
FWIW, almostontop keeps the prompt on top of the screen, although the history still goes up. To change it to go down, my only guess would be to fork and change zsh's code, as I believe that this is built-in to zsh, so you likely couldn't change it with a plugin or anything like that. |
This is because in English (and most other languages) text flows left-to-right and top-to-bottom. If you execute the command 1
2
3
4 If you execute % print -l 1 2
1
2
% print -l 3 4
3
4 This and only this presentation allows you to read history sequentially in the natural order of the English language: left-to-right and top-to-bottom. The fact that prompt is displayed below the output of the last command is a good thing. The two most important pieces information are located close to each other, thus minimizing eye movement. The only problem I see in the traditional shell UI is that the location of prompt is not constant. When you open a new terminal or clear the screen, prompt is at the top. With each command it moves closer and closer to the bottom. Once it reaches the bottom it stays there for awhile, until something (perhaps zsh completion menu) pushes it back up. This non-constant prompt position means you cannot set up your terminal window in such a way that it's always convenient to look at the most important information in it -- the prompt and the output of the last command. This issue has been bothering me enough that I've configured my own shell to always have prompt at the bottom. When I open a new terminal, or clear the screen, prompt is at the bottom. Completion menu opens as an overlay window above the prompt line, so prompt doesn't get pushed up. I've positioned my terminal window(s) in such a way that looking at the bottom is most comfortable. Looking at the top can be straining but I only need to do that occasionally and never for a long period of time. You can see how it works in this cast: This looks similar to the transient prompt demo with one major difference: Prompt doesn't get pushed up on Ctrl+L, Tab or Ctrl+R (the latter is not shown in the cast). |
@romkatv wow that is pretty cool. Thanks for sharing it with us! 🙏 |
I'm using this: https://github.com/romkatv/zsh4humans/tree/v5. Note that this is a bleeding edge unstable dev branch, so I cannot recommend that you use this code. The latest stable version (documented at https://github.com/romkatv/zsh4humans) doesn't have the "overlay" or "stay at bottom" features. If you have The code is at https://github.com/romkatv/zsh4humans/tree/v5. It's very complex. |
I hope that is not too unkind, but can't you point to more detailed parts? As I remember |
I would if I could.
It is a complete setup, yes. I'm not trying to convince you to switch. You've asked how my shell is configured and I've given an honest answer. You are welcome to copy over some parts of it or use the ideas.
Yes. You can find some info in romkatv/zsh4humans#35 (comment) and all comments that follow it. Also here and the following comments: romkatv/zsh4humans#57 (comment). You can also look at commits in zsh4humans v5 after it was branched off from v4. The vast majority of them are for this feature. All commits in https://github.com/romkatv/tmux and https://github.com/romkatv/tmux-bin are also for this feature. If you are already using tmux, you can do something much simpler to achieve a similar effect. See https://github.com/Aloxaf/fzf-tab/wiki/Configuration#fzf-command and https://github.com/Aloxaf/fzf-tab/blob/master/lib/ftb-tmux-popup. Most of the complexity in my code stems from the fact that I don't want to use tmux. I like native terminal scrollback and tabs. |
Cool thanks for all these hints. I'll try to follow them and see what I can achieve. |
tmux 3.3 is adding a new command called I've linked to fzf-tab to show an example of code that puts zsh completion candidates in a tmux popup. |
Yes, exactly. My thoughts were different, but you answered my question anyway. Thanks. Would be cool do develop a plugin that is doing it in more general manner. So kinda split it: one that does the fzf stuff independent of the floating feature and then a second one that does the pop-up. Let's see what is possible. |
Don't these two parts already exist? The first is fzf-tab (allows using fzf instead of menu in zsh completions) and the second is Or did you have something else in mind? Going back a bit:
Can you elaborate on your approach? FWIW, I've experimented with an extension of my current setup that keeps prompt at the bottom visible at all times as if the terminal window was split in two, with the bottom (small) part always showing prompt, and the top (larger) part showing output of commands and command history. My experiments have shown that this is doable. |
A plugin that brings zsh its completion menu to a pop-up. Since I don't trigger the menu manually, but
So I try to follow your example and do it visually: $ # active prompt at top, history below empty as usual
$ # the '>' identifies an history command, plain lines are just command output in the history
> echo foo
foo
$ # we are still on top, the history reads bottom to top
> echo bar
bar
> echo foo
foo
Interesting approach. Would love to see how this looks like, especially in combination with the completion pop-up. |
This might be possible but I'm not sure.
Do you have some specific ideas for the more general thing?
Thanks, I think I understand. In one of my previous comments I mentioned that this is not a good UX because you cannot read history linearly. Compare regular history, which you can read linearly from left-to-right and top-to-bottom:
And here's the same history in your setup:
In order to read this history you need to read from Another downside of this approach is that it puts prompt far away from the bottom of the last command's output. Here's what I mean. Suppose I run just one command --
I can see the error close to prompt. This is true even if Here's how the same output would look with prompt on top:
The error is far away from the point to which the user is looking (the prompt). If there was a lot of output, the error may not even be visible on the screen. Even if you had complete control over the terminal and shell code, "prompt on top" doesn't seem like a good idea.
Completions look exactly the same as in the demo I've posted earlier. More generally, everything looks exactly the same when zle is active. The different is only when zle is not active. In other words, when a command is running. Here's how the terminal looks like when running a command in a normal shell:
Note that there is no current prompt. And here's how it looks in my experimental shell, in which prompt is always visible:
This works better with a ruler above prompt because it makes it clear that the window is split into two panes and that the top pane is used by commands and the bottom pane is used by prompt:
If the command outputs something, the window above the prompt scrolls but prompt stays frozen. This is similar to tmux status bar. |
I have way too less knowledge about the internals of Zsh. And if even someone like you who is really into the details don't know, I'm afraid its not possible at all.
Well, I'm not sure how your question is meant. So let me phrase what the goal is. Floating windows are for me always (NeoVim, i3, ...) the chance to keep the current layout clean and open/show something temporally without disturbing the more stable underlying structure. That said I would wish that the completion menu in Zsh does not affect the current prompt location, nor the whole history as it is displayed without completion. So for example when you have a terminal fully filled with history content and your prompt is at the very bottom, the completion menu would push the prompt and the history upwards. I would rather have it like in an text editor with completion functionality. There I get a hovering window on top of the text without affecting the editors buffer at all.
Thank you very much for your good argumentation. I think you have a really good point, especially with your long arguments. For some reason I was more in the thinking of short/clear structured commands like |
Good luck. Please post an update if you implement something you like. |
Sorry to abuse this issue, but I have no communication channel to contact him else. Please unsubscribe it getting annoyed and possible. Maybe we can switch to Gitter chat if there is some interest for further discussions. @marlonrichert do you have some knowledge/ideas to share how to achieve the completion pop-up feature of this issue? (it started as a sub-thread here) |
@weilbith Sorry, no idea. I don't use Tmux. 🙂 |
That's sad. ^^ |
You can have a look at how |
I don't think this answer's @weilbith's question. You cannot just put zsh completion menu in a tmux popup the same way fzf-tab does it with fzf. |
No, you cannot put the completion menu there, but you can still list the actual completions there, using some other tech, such as |
Well I still want to you use your autocomplete plugin. That is a must for me. The feature discussed here would be amazing if possible as described. But not at the costs/trade off. |
It feels like this is getting off-topic. This was a question about a gif in a repo about a zsh theme about how if a piece of zsh code could provide a feature. Now were talking about tmux popup tab completion, which sounds cool, but is off topic. If you two could get on maybe Gitter like how @weilbith suggestied, that might be nice. I'm still interested, don't get me wrong, but this isn't what Github issues were designed for, so I think switching wouldn't be an awful idea. If you would prefer talking on this, thats fine, just a suggestion, but it feels that this getting off-topic isn't what issues are for. |
Serendipitous discussions have sparked many an improvement. I don't mind exploration of ideas in this issue. Anyone who's bothered is free to unsubscribe. |
Ok. Like I said, just a suggestion. And by the way, dang that was fast! |
@weilbith Feel free to experiment and build something. It's all open source, after all. 🙂 |
Hey,
sorry for opening an issue here. But this is not related to P10K itself, but I just saw it in its docs.
So how do you achieve the upwards flow direction in this GIF? I fail to find instructions how to manipulate the flow direction and get a fixed prompt. I don't want to have exactly the same setup, but pretty similar. Would be cool if you could simply point to me to some sources how to achieve that.
Thank your very much in advanced!
The text was updated successfully, but these errors were encountered: