-
-
Notifications
You must be signed in to change notification settings - Fork 565
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
Replace native up arrow more seamlessly #798
Comments
Do you mean disabling the up arrow behavior? You can do this as described here: https://atuin.sh/docs/config/key-binding |
No, disabling disables the usage of the atuin history, I just want traditional up arrow behavior but using the atuin history db. The TUI is pretty disruptive to fast usage of the terminal history, and is more suited to replace |
We have a WIP to add an 'inline view' #648 but it's currently blocked on a few things. This UI is not final, but it would work a little like this Might flip the list vertically and have the search at the top, closer to the prompt |
So drop-in replacing the normal up arrow behavior with the atuin db is not planned, or not possible? I don't want to see my history or search my history I just want up arrow and down arrow to scrub the history in-place in my prompt. Exactly the same UI/UX as how it works in bash/fish/zsh/etc by default. The notable improvement would be using the atuin db. |
Ah I see what you mean now. I'll see if that can easily be achieved already |
Interesting, I'm using zsh (with oh-my-zsh) with this config:
My @endigma Which shell are you using? Edit: Or do you mean that the history should work across multiple terminals? So if you have open two terminals and run |
Up arrow does still work normally, it uses fish_history, not the atuin db. |
I am fairly sure that you can now add this to the scripts using the |
Yep, that looks like about all that would be required to get this done, I'd still like to see it built in. I think the most challenging bit will be tracking what index the user is currently on, for example fish uses |
I whipped up a version of this for fish, since I've wanted this myself and that's the shell I use: main...arcuru:atuin:replace-bind-up. Here's a link to the full file, that you can use in place of It's not totally trivial but it does seem to work. Though there may be some rough edges compared to using the inbuilt I haven't opened a PR since it's unclear if @ellie and @conradludgate would want this integrated as this is a decent sized change to the UX, and it looks like the inline view above might be a better fit for atuin. It may just be best to put this in the documentation somewhere as an example of "How to Customize". I'd be happy to help integrate but I am not up for writing the scripts for all the other shells. |
Perhaps under a switch like bind-r and bind-up, but off by default if this is not the intended pattern. Does your replacement take into account what's currently in the buffer as a search? |
No, but that is a short change (add The issue, as you've just pointed out, is that there are a lot of different options here, and atuin has for a while bound What would make the most sense to me, and for how I am used to using the terminal, is to use something like my change above, but pass in the So, a user would choose if they wanted to bind the up-arrow key or not, and in the config file customize the filter-mode, search-mode, and whether to use the current cmd string as the initial query. We could then customize Basically, the up-arrow would be used for cycling through the most recent results in the history, starting with a given search string (or not) and using its own custom filter-/search-modes. That's how I think it should work, but if you want to use it like that today you already can by customizing the script I shared above. |
This would be really good! I think @takac had something like this for zsh going in #826 I think a "custom shell integrations" page or something similar in the docs would go really well. It might be nice to integrate fully in the future, but we can start there |
If negative offsets are already supported ( If negative offsets aren't already supported, this is probably good evidence that it's worth doing - seems more elegant and simple to just support negative indexes inside the Atuin CLI than to have every shell integration reimplement the same boilerplate of getting the last offset outside of it. |
In case anyone is curious, I hacked together my own implementation of the original up/down arrow functionality that still makes use of https://gist.github.com/Nezteb/81e8f6b78036894a28a4a40772bdda54 |
|
I actually really like this idea. I have often found the up/down more disruptive, especially since I can't immediately start editing the command if I need to. @Nezteb nice hack, but would be nice to get this native into atuin and have a config switch perhaps to control the behavior. |
I've hacked together a custom bash implementation inspired by @Nezteb's zsh implementation https://gist.github.com/alextremblay/316d2beede9acd1a29d45d9d32dd310f notable features: if the current command line is empty, it cycles up and down through atuin's history db just like @Nexteb's implementation, but if you type out a partial command and then hit the up arrow, it launches atuins regular interactive up-arrow behaviou, filtering on that existing prefix |
This is just terrible UX if you want to quickly fire up the previous command again. Only bind atuin to Ctrl+r instead. refs: atuinsh/atuin#798 refs: atuinsh/atuin#358 refs: atuinsh/atuin#51
@Nezteb Hey. I've looked at your script and compared it with e.g. zsh-history-substring-seach and found a few improvements. I've uploaded the updated script here. It essentially resolves your issue around not being able to catch https://gist.github.com/tyalie/7e13cfe2ec62d99fa341a07ed12ef7c0 |
I've been thinking and it would be cool to get this included, gated behind config. Or perhaps a new default? It's unlikely to make it into v17, but maybe a v18 thing. Personally I prefer the interactive search, but I understand that it can be too much to get used to and muscle memory is hard to change. Reading through the issue, looks like we have implementations for:
That leaves Nu. I'm not familiar with it so am unlikely to write the integration, but I don't think missing Nu should be a blocker to getting this out. We could then add a config option to the client like (name pending)
or even just catch if I'm happy with writing the Rust if you'd all like to contribute your individual scripts/integrations? It would probably make sense to either modify the current shell integrations to have additional functions (and then we can switch on which is bound, eg by adding Please do feel free to ping me if you'd like input |
Nu shouldn't/can't do this yet, the up arrow can't work correctly at all without a change to Nushell - #1025 To be honest, the
I'd vote for adding it the same script file under a new function and switching on which one is bound. It's less surprising to people who want to customize the shell invocation if they get all the options when they dump the script with |
I would prefer to have the "Classic history" mode triggered on a specific config like |
One significant use case for this feature that hasn't been discussed yet is when With this configuration, there's a mismatch between what So being able to access it quickly via the up arrow would be a major quality of life improvement. |
This is intentional
We have a separate setting for the up arrow, to enable the user to quickly use a different sort of filtering
https://docs.atuin.sh/configuration/config/#filter_mode_shell_up_key_binding |
That setting only applies when the up arrow opens the
I am referring to the alternate case, where Is that not what this thread is about, retaining the up arrow's native shell history scrolling behavior except pulling commands from the It would be awesome if that could be implemented, but to have it respect a certain filter mode. |
Sorry, I was replying to a bunch of issues and misread your message
Is written in the present tense, so I took it as the present behaviour of Atuin. |
I was thinking about this issue a bit. The arrow-up event issue in nushell seems to be solved, but I believe we would at least also need the issue in nushell to be solved that the I've also been wondering if this is the right approach for nushell, at least long-term. Note that I have not asked anyone about this and might be totally wrong about it, but I was thinking about creating an issue in nushell, if an API like this would make sense to them. |
This issue has been mentioned on Atuin Community. There might be relevant details there: https://forum.atuin.sh/t/dont-bring-up-ui-for-up-arrow/383/3 |
I would like this to be added too, not because I don't like the search UI, but because I really want to be able to arrow across the current command and then up arrow to repeat the history search with what is to left of the cursor as the prefix. If that was possible through the full search UI (maybe it is?) I think that would be good too. Though, it might be nice if up arrow and Ctrl+R could use different inline heights this case. |
I would love this functionality as well. The TUI is great for some usecases, but I find the native one line search much better on a faster workflow. There is less information overload and you still have the context of the previous commands. |
I have also added this for the Fish Shell. Certainly not yet optimal but works for now... I will optimise it further in the coming weeks: |
Is it possible to replace the native up arrow in the shell not with the full screen TUI but with normal up arrow behavior, albeit with the atuin db?
The text was updated successfully, but these errors were encountered: