feat: set vi mode as default key bindings in fish shell - #283
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds vi-style key bindings to interactive fish shells and removes a custom git abbreviation (gpn) and its surrounding comments from the fish configuration in home-manager/programs/fish/default.nix. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Fish as fish shell
participant Init as interactive init
participant Keymap as vi key bindings
participant Abbr as shell abbreviations
User->>Fish: Start interactive shell
Fish->>Init: Load configuration
Init->>Keymap: Apply fish_vi_key_bindings
Init->>Abbr: Register remaining shellAbbrs (gpn removed)
Note over Fish,User: Shell runs with vi-mode and updated abbreviations
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (7)**/*.nix📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/default.nix📄 CodeRabbit inference engine (CLAUDE.md)
Files:
home-manager/**📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Files:
home-manager/programs/*/default.nix📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)
Files:
home-manager/**/*.nix📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)
Files:
home-manager/programs/**/default.nix📄 CodeRabbit inference engine (.cursor/rules/nix.mdc)
Files:
home-manager/programs/**/*.nix📄 CodeRabbit inference engine (.cursor/rules/nix.mdc)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @shunkakinoki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the fish shell user experience by enabling vi-style key bindings by default, catering to users who prefer vi/vim navigation and editing paradigms. Additionally, it refines the shell's configuration by removing obsolete or commented-out alias definitions, contributing to a cleaner and more focused setup. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Pull Request Overview
This PR configures fish shell to use vi mode key bindings by default, enabling vim-style editing commands in the fish shell prompt. The change also includes some cleanup of commented Git alias documentation.
- Added
fish_vi_key_bindingscommand to the fish shell initialization - Removed outdated comments about Git abbreviations and GitAlias integration
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request aims to set vi mode as the default key binding for the fish shell. The implementation adds fish_vi_key_bindings to interactiveShellInit, which is a valid approach. However, I've suggested a more idiomatic, declarative way to achieve this using home-manager's built-in options, which will improve the configuration's maintainability. Additionally, I've noted the removal of a git alias that seems unrelated to the PR's main goal and recommended moving it to a separate change for better commit history clarity.
| fish_add_path -p /etc/profiles/per-user/${config.home.username}/bin | ||
| set -a fish_complete_path ~/.nix-profile/share/fish/completions/ ~/.nix-profile/share/fish/vendor_completions.d/ | ||
| set -x FISH_HISTFILE fish | ||
| fish_vi_key_bindings |
There was a problem hiding this comment.
While this works, a more idiomatic and declarative way to set key bindings in home-manager is to use the keyBindings option within the programs.fish block. This improves maintainability by keeping configuration declarative.
You should remove this line and instead add keyBindings = "vi"; to your programs.fish configuration, for example, after enable = true;.
|
|
||
| # Git abbreviations - provided by GitAlias (see shellInit) | ||
| # Only keeping custom ones that differ from GitAlias or have special behavior | ||
| gpn = "git push --no-verify"; # Custom: not in GitAlias |
There was a problem hiding this comment.
This removal of the gpn alias and its related comments seems unrelated to the main purpose of this pull request, which is to enable vi mode. To keep commits atomic and easy to review and revert, it's best to group related changes into a single PR. Please consider moving this change to a separate pull request.
This change updates the fish shell configuration to set vi mode as the default key bindings, providing a more efficient editing experience for users familiar with vi/vim key bindings.
Summary by cubic
Enable vi mode as default in fish by adding fish_vi_key_bindings for Vim-style editing in the shell. Also removes a redundant git alias and related comments to keep the config clean.