Skip to content
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

Support bindkeys #537

Open
juliogarciag opened this issue Dec 17, 2021 · 49 comments
Open

Support bindkeys #537

juliogarciag opened this issue Dec 17, 2021 · 49 comments
Labels
Feature requests Feature Requests

Comments

@juliogarciag
Copy link

juliogarciag commented Dec 17, 2021

Describe the bug

Right now, Warp just ignores the user's bindkeys and they don't do anything.

Please upvote if you want us to honor them

@juliogarciag
Copy link
Author

After taking a deeper look, it seems bindkey doesn't work yet. Is that something scheduled to be tackled soon?

@elviskahoro
Copy link
Contributor

@juliogarciag CC'ing @charlespierce as he's working on custom keybindings and this falls under that umbrella!

@elviskahoro elviskahoro changed the title Support zsh abbreviations Support zsh abbreviations and bindkeys Dec 21, 2021
@elviskahoro
Copy link
Contributor

are there plans to do left option as ESC+ instead of Meta? I use ESC+. which is insert-last-word on zsh all the time and I just get ≥ regardless of whether Left Option Key is Meta is enabled
$_ is my current workaround. Also might be for bugs but using actual ESC+. doesn't seem to work, so I'm guessing it's just a feature of Zsh Line Editor that isn't implemented at all

@linux-china
Copy link

Same problem to me, and bindkey does not work for zsh autosuggestions.

# zsh auto suggestions
source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
bindkey '^k' autosuggest-accept
bindkey '^j' autosuggest-execute

@elviskahoro elviskahoro removed the Bug label Jan 8, 2022
@elviskahoro
Copy link
Contributor

From:

Describe the bug

Try putting the below in the ~/.zshrc

bindkey "^j" history-search-forward

To Reproduce

No response

Expected behaviour

No response

Screenshots

https://share.getcloudapp.com/7KuE7w6K

Operating System

No response

OS Version

No response

Additional context

No other bindkey seems to present an issue

@elviskahoro
Copy link
Contributor

From @hardselius via:

Describe the bug

I have the following snippet in my .zshrc

resume() {
  fg
  zle push-input
  BUFFER=""
  zle accept-line
}
zle -N resume
bindkey "^Z" resume

It serves as a "toggle" for programs running in the terminal, e.g vim.

To Reproduce

Steps to reproduce:

  1. Add the snippet to .zshrc
  2. Open vim
  3. Press ^Z to move vim to the background
  4. Press ^Z again and nothing happens.

Expected behaviour

In this case, I expect ^Z to bring my process back to the foreground, instead I have to manually run fg.

Screenshots

No response

Operating System

MacOS

OS Version

12.1

Additional context

No response

@psbanka
Copy link

psbanka commented Jan 24, 2022

It's very convenient to be able to use META-f or META-b to go forward and backward a word at a time in the terminal. Also, META-. to retrieve the last word used in the previous command. Would love to be able to have the option key bound to META rather than needing to use ESC.

@elviskahoro
Copy link
Contributor

@psbanka is "Left option key is meta" on for you?
Mac Menu > File
Screen Shot 2022-01-24 at 2 46 46 PM

@psbanka
Copy link

psbanka commented Jan 24, 2022

Oh, wow, that's great, @elviskahoro , thank you! The last place I expected to find that was under the File > menu.

@elviskahoro
Copy link
Contributor

@psbanka There's room to improve our discoverability. Where did you look for it? I'll see if we can get it added there, you're definitely not the first to ask!

@elviskahoro elviskahoro changed the title Support zsh abbreviations and bindkeys Support zsh abbreviations, bindkeys, and history expansion Feb 25, 2022
@elviskahoro
Copy link
Contributor

elviskahoro commented Feb 25, 2022

Zsh history expansion does not work

From @r-thomson

Describe the bug

Zsh's history expansion does not work in Warp (v0.2022.02.21.08.55.stable_00). It seems to work correctly in the stock Terminal app.

To Reproduce

  1. Type a history designator, e.g. !999
  2. Press tab

Expected behaviour

Element 999 (shown in history) should be inserted in-place.

Screenshots

No response

Operating System

MacOS

OS Version

12.2.1

Additional context

Here's my dotfiles, if it helps

@denisidoro
Copy link

Sorry for necrobumping this thread, but is there a plan / ETA for supporting bindkeys?

This is a deal-breaker to me, in particular.

@denisidoro
Copy link

I love the direction Warp is going (eg #625) but limiting the user to Warp-native solutions is too strict.

I myself have a plethora of fzf-based-autocompletions (cf #149) which, in my case, are much more evolved than what Warp currently offers.

I'd really like to use Warp as my daily driver because of its other features (eg blocks) but not being able to do what a vanilla Terminal + zsh shell can offer has prevented me from switching.

@varenc
Copy link

varenc commented Apr 8, 2022

Lack of support for any zsh keybindings is really a deal breaker for me using Warp. It's also just painfully inelegant. Zsh has a whole system for managing keybindings, which I've invested it, and Warp just throws that away. Even when there's a zsh keybinding defined that doesn't overlap with a Warp binding it still doesn't pass the event along. This also means that little tweaks on default zsh keybindings can't be changed.

To use an example, I redefine some basic keybindings like this so that things like Ctrl-K (kill-line) integrates with the system pasteboard. Warp just ignores my Ctrl-K keybinding and does the zsh default kill-line, but without my customization the killed line doesn't end up in the system pasteboard. This uncanny valley of support is quite frustrating.

edit: Also I think the lack of bindkey support could use a separate github issue clearly describing it. The main post of this issue doesn't mention keybindings, and I think that's a feature that can stand on its own. (It's also unlikely Warp would address all the missing features mentioned in this issue at the same time)

@varenc
Copy link

varenc commented Apr 9, 2022

I found a partial workaround: Once in Warp, just run zsh again, embedding a zsh session in the already existing zsh session. This results in you losing most all special Warp features, but then all of zsh's features will re-appear. It sort of just turns Warp into speedy standard terminal emulator like all the others. This doesn't make sense for me but someone who daily drives Warp and occasionally needs some unsupported zsh feature might find this hack useful.

My custom keybinding on Ctrl-K still doesn't work, but other custom bindings do, as well my own history searching method. Could make sense for occasional use. ¯_(ツ)_/¯

@elviskahoro
Copy link
Contributor

I use the zsh-autosuggestions plugin. It allows you to configure an autosuggest-execute hotkey, which I've configured to Ctrl-P. This works in iTerm2, but no Warp. This makes every auto-suggestion two key presses now, Ctrl-F to "accept autosuggestion" and then Enter to execute it. I'd like a shortcut to do both.

@robbienohra
Copy link

robbienohra commented Apr 21, 2022

I found a partial workaround: Once in Warp, just run zsh again, embedding a zsh session in the already existing zsh session. This results in you losing most all special Warp features, but then all of zsh's features will re-appear. It sort of just turns Warp into speedy standard terminal emulator like all the others. This doesn't make sense for me but someone who daily drives Warp and occasionally needs some unsupported zsh feature might find this hack useful.

My custom keybinding on Ctrl-K still doesn't work, but other custom bindings do, as well my own history searching method. Could make sense for occasional use. ¯_(ツ)_/¯

Well played, sir, lol.

Yeah this is annoying eh, seems like a big miss. I can see how the embedded fuzzy search on command history would reduce my need to use fzf for that specific use case. But as you said there is so much more than just fuzzy searching your command history (directories, files, etc.)

Hopefully they can find a solution for this, the terminal is a phenomenal piece of tech otherwise.

@zheng
Copy link
Contributor

zheng commented Jun 16, 2022

Most of the comments are about bindkeys, so I'm going to change this title + description to be about bindkeys.

I made #1514 to keep the original issue description

I'm really surprised there aren't more upvotes on this, because I hear a lot of anecdotal feedback about bindkeys, so changing the name in case it's confusion

@zheng zheng changed the title Support zsh abbreviations, bindkeys, and history expansion Support bindkeys Jun 16, 2022
@elviskahoro elviskahoro changed the title Support bindkeys Support bindkeys and alias expansion Jul 19, 2022
@Divide-By-0
Copy link

Divide-By-0 commented Jul 8, 2023

Hey Folks thanks for commenting. As for right now although Warp doesn't support ~/.inputrc or bindkey, it does have ~./.warp/keybindings.yaml which you can use to bind keyboard shortcuts to existing Warp features/actions. Learn more about it here: https://docs.warp.dev/features/keyboard-shortcuts#custom-keyboard-shortcuts

I want to set realistic expectations that for this feature, we'd have to revamp significantly the way Warp's input editor works so it may be a while before we have any traction. Any updates to this we'll post here!

Can there be some sort of helper script that converts my .zshrc to a slimmed down .zshrc and auto-populates the .keybindings file and whatever else warp uses? Or at the least, ignores unsupported things instead of refusing to work entirely?

@Dentrax
Copy link

Dentrax commented Aug 11, 2023

As fresh user of Warp, I hit this issue. I cleared default key binding of ^r and put the bindkey '^f' fzf in my .zshrc. But it does not work. Any ideas how to tackle with this? Otherwise, I'll think about to change my default terminal app...

My use case is to combine: Warp + Atuin: https://github.com/atuinsh/atuin (Currently impossible, I think)

@elviskahoro
Copy link
Contributor

elviskahoro commented Aug 16, 2023

@Dentrax You are correct that it isn't possible to bind a key to an app like fzf. We'd have to explicitly build support for this into Warp's Input Editor, since it's native

@hyperfocus1337
Copy link

hyperfocus1337 commented Sep 7, 2023

This is a shame, I was about to adopt Warp but this is making me reconsider.

I have the following functionality defined in my fish config, which allows me to easily switch directories.

function cd_with_fzf
  cd $HOME && cd (fd -t d | fzf --preview="tree -L 1 {}" --bind="space:toggle-preview" --preview-window=:hidden) && echo $PWD && tree -L 2
end

bind \co cd_with_fzf

As bind doesn't work, I cannot use it. And there doesn't seem to be way to invoke custom functions with the Warp keybindings (only native keybinds).

Would be happy to see this implemented, I don't necessarily care about bind perse, but I just need a way to invoke custom functions using keybindings.

Although it feels like the optimal design should simply support native features that are provided by the underlying shell. In this case, first simply support the features of the underlying shell, before adding gimmicky stuff on top.

Edit: Actually I do care about bind, as I would prefer my fish shell configuration to remain cross compatible amongst different terminal emulators. Although adding another custom keybind to execute custom functions inside of Warps configuration would solve the issue usability wise. But best case scenario would be if bind simply works out of the box, with the potential of overlapping keybinds amongst bind and Warp. Which a user would then simply have to figure out himself. I'm okay with clearing a Warp keybinding to allow for 'room' to use the bind configured keybind.

@fulmicoton
Copy link

fulmicoton commented Nov 20, 2023

I did not manage to use atuin with Warp either

@dannyneira
Copy link
Member

atuin isn't compatible with Warp's input, but we've recently added rich history information which should help some.

CleanShot 2023-08-31 at 14 51 27

Warp also has Command Search which you can use to filter through the history as well.

I hope this helps some with your use cases @fulmicoton

@ellie
Copy link

ellie commented Nov 20, 2023

atuin isn't compatible with Warp's input

(hi, Atuin maintainer here)

We're more than happy to hook into Warp to make sure keybindings work, do you have any guidance? If supporting standards is off the table, anyways.

@tkolleh
Copy link

tkolleh commented Dec 14, 2023

atuin isn't compatible with Warp's input, but we've recently added rich history information which should help some.

CleanShot 2023-08-31 at 14 51 27

Warp also has Command Search which you can use to filter through the history as well.

I hope this helps some with your use cases @fulmicoton

Does warp support keyboard shortcut for history search. I prefer it over the default show history. Adding a up arrow shortcut doesn't work.

Screenshot 2023-12-14

@cowboygneox
Copy link

+1 to having bindkey working.

@Divide-By-0
Copy link

As a temporary fix, can you just parse such files and manually ignore all bindkey lines?

@AugustDev
Copy link

This needs to be implemented ASAP as the user experience now is not good. It's pretty embarrassing this issue is open for 2 years.

@temp4422
Copy link

temp4422 commented Jan 8, 2024

+1

@nikitavoloboev
Copy link

I want to bind a key to a Fish function, currently it fails..

@nikitavoloboev
Copy link

image

i.e. if I put above in fish config, reload shell and trigger control+g nothing happens, but it should

@nikitavoloboev
Copy link

This is a shame, I was about to adopt Warp but this is making me reconsider.

I have the following functionality defined in my fish config, which allows me to easily switch directories.

function cd_with_fzf
  cd $HOME && cd (fd -t d | fzf --preview="tree -L 1 {}" --bind="space:toggle-preview" --preview-window=:hidden) && echo $PWD && tree -L 2
end

bind \co cd_with_fzf

As bind doesn't work, I cannot use it. And there doesn't seem to be way to invoke custom functions with the Warp keybindings (only native keybinds).

Would be happy to see this implemented, I don't necessarily care about bind perse, but I just need a way to invoke custom functions using keybindings.

Although it feels like the optimal design should simply support native features that are provided by the underlying shell. In this case, first simply support the features of the underlying shell, before adding gimmicky stuff on top.

Edit: Actually I do care about bind, as I would prefer my fish shell configuration to remain cross compatible amongst different terminal emulators. Although adding another custom keybind to execute custom functions inside of Warps configuration would solve the issue usability wise. But best case scenario would be if bind simply works out of the box, with the potential of overlapping keybinds amongst bind and Warp. Which a user would then simply have to figure out himself. I'm okay with clearing a Warp keybinding to allow for 'room' to use the bind configured keybind.

Everything that is said here is spot on.

I hope Warp team actually looks into the issue and supports the underlying shell functionality. 🙏

@rspears74
Copy link

Just chiming in to say that I would also like to see support for this. I use the zsh sudo plugin (double ESC inserts sudo at the beginning of the line), and it doesn't work in Warp.

@IVIJL
Copy link

IVIJL commented Feb 26, 2024

This is only thing which blocks me to switch to warp, unable to use my keybinding in .zshrc :(

@gggiovanny
Copy link

gggiovanny commented Mar 2, 2024

I'm also trying to use fzf shortcuts that work with "bind", and it's working flawlessly in item2, but not in warp :( a shame, I love warp!

@DomenicWalther
Copy link

Well, was just configuring my Warp Installation but hit this roadblock, back to iTerm we go

@dabstractor
Copy link

Total deal-breaker for me. All the cool features amount to nothing if they won't integrate with other tools that have earned their place in the ecosystem. Hopefully you guys can find a resolution.

@jasek5
Copy link

jasek5 commented May 1, 2024

Is there any ETA ?

@ellie
Copy link

ellie commented Jun 13, 2024

Thanks to @sheldonhull over on the Atuin warp issue:

FYI I just reload my profile in with exec zsh -l and then the nested version of that works fine. It's a work around but unblocked me.

if I exec zsh all my bindkeys work as expected - including Atuin. You could also just run a subshell and ignore the "warpify subshell" popup

Edit: saw this mentioned earlier, sorry for the noise

@aviloff
Copy link

aviloff commented Jul 19, 2024

the exec zsh solution blocks all the warp features, but unblocked, for example, the ^j key combination that for me is vital when accepting lines. But this turned Warp into a simple terminal. I really wish this get handled soon! 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature requests Feature Requests
Projects
None yet
Development

No branches or pull requests