feat: alt+enter fill-only - #40
Conversation
PR Review: feat: alt+enter fill-only🎯 SummaryThis PR adds a useful feature that allows ✅ Code Quality & Best PracticesStrengths:
Suggestions:
🐛 Potential IssuesLogic concerns:
Recommendations:
⚡ Performance ConsiderationsGood:
🔒 Security AssessmentStatus: ✅ Secure
🧪 Test CoverageCurrent state: No automated tests found in repository Recommendations:
🎯 Feature ImplementationExcellent work on:
📝 Minor Suggestions
🏆 Overall AssessmentRating: ⭐⭐⭐⭐ (4/5) This is a well-implemented feature that adds genuine value without breaking existing functionality. The code is clean, follows project conventions, and solves a real user need. The implementation is straightforward and maintainable. Recommendation: ✅ Approve with minor suggestions The PR is ready to merge. The suggested improvements are enhancement opportunities rather than blocking issues. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds a feature that allows users to fill the command line buffer without immediately executing the SSH connection. The addition of the --expect=alt-enter,enter flag to fzf enables two interaction modes: pressing Enter connects immediately (existing behavior), while pressing Alt+Enter only fills the buffer for further editing.
- Adds dual key binding support with
--expectflag in fzf - Implements conditional execution based on the key pressed (Enter vs Alt+Enter)
- Preserves existing immediate connection behavior while adding fill-only option
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if [[ "$key" == "$result" ]]; then | ||
| selection="$result" | ||
| key="" | ||
| else | ||
| selection=${result#*$'\n'} | ||
| fi |
There was a problem hiding this comment.
[nitpick] This logic for parsing the fzf result with expect keys is complex and could benefit from a comment explaining the format. When --expect is used, fzf returns the key on the first line and the selection on subsequent lines, but this isn't immediately clear from the code.
| fi | ||
| fi | ||
|
|
||
| zle reset-prompt |
There was a problem hiding this comment.
The zle reset-prompt call at line 261 is now redundant since it's already called at line 254 when alt-enter is pressed. This could lead to unnecessary prompt resets in the alt-enter case.
| zle reset-prompt | |
| # Only reset prompt if not already done for alt-enter | |
| if [[ "$key" != "alt-enter" ]]; then | |
| zle reset-prompt | |
| fi |
|
@kr-nn Thank you! |
Adds --expect and alt+enter will only fill the cli buffer instead of connecting immediately
useful when you're doing something besides just connecting to the server like:
ssh server -j otherserver
or
ssh server nixos-version