-
Notifications
You must be signed in to change notification settings - Fork 100
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
feat: add support of accept-line #148
Conversation
Thanks for your PR. But I think this is not very useful. Because you can't bind it to enter, which is already binded to And if we bind it to something like ctrl+enter, users will still need two keystroke. |
I can see how it wouldn't be useful if someone bound it to something other than a single keystroke. Instead of creating a configurable keybind, like in this pr, would you consider being able to alternate the |
I've been testing creating a boolean option that changes the default accept behavior to accept or accept and run. However, I found that by doing so, when the option is set, you lose the ability to accept without running. This draws me back to this pr, which preserves the original behavior of accept and allows a keybind to accept and run. In my case, I have the following set: zstyle ':fzf-tab:*' fzf-bindings 'space:accept'
zstyle ':fzf-tab:*' accept-line enter This works very well for me and allows me to choose between accept or accept and run. |
i applied all changes and it works like a charm, my setup:
@Aloxaf hope it can be merged to upstream branch |
@Aloxaf @NICHOLAS85 @up-to-you I want to set shift + enter to accept and excute, how can can configure it? For zsh-autosuggestions, I just need to config: bindkey '^[SE' autosuggest-execute |
You will use the following substituting zstyle ':fzf-tab:*' accept-line $keybind Another thing to note, most terminals I've used don't differentiate between enter, ctrl+enter, and shift+enter by default. You may need to look into setting that up properly before you can use it as a bind: https://unix.stackexchange.com/questions/536352/ctrl-enter-shift-enter-and-enter-are-interpreted-as-the-same-key |
I using the VSCode to send escaped code to shell, so the zsh-autosuggestion works. |
@NICHOLAS85 zstyle ':fzf-tab:*' accept-line '^[SE' 2022-10-16.03.32.06.mov |
I haven't messed with fzf in awhile but I believe it's due to there being hard coded supported keys: https://www.mankier.com/1/fzf#Key/Event_Bindings-Available_Keys:_(Synonyms) You could try remapping the sent code to an unused binding in that list |
@NICHOLAS85 @Aloxaf |
@tjx666 Example for vscode: [
{
"key": "shift+enter",
"command": "workbench.action.terminal.sendSequence",
"when": "terminalFocus && terminalShellIntegrationEnabled && !accessibilityModeEnabled",
"args": {
"text": "\u001b[1;3C"
}
},
] Above lines remap |
设置 |
Oh sorry, it's |
For anyone find the solution to using In vscode, you first need to config shortcut: {
"key": "shift+enter",
"command": "workbench.action.terminal.sendSequence",
"when": "terminalFocus",
"args": { "text": "\u001b[1;3B" }
} Then set If you want your iterm2 work, follow the screenshot: |
Allows a user to accept and run a suggestion in one keystroke.
https://asciinema.org/a/dMcynTzjKZRC0nZbvSo4gmIla