Skip to content

feat: set vi mode as default key bindings in fish shell - #283

Merged
shunkakinoki merged 1 commit into
mainfrom
feat/vi-keybindings-fish
Oct 12, 2025
Merged

feat: set vi mode as default key bindings in fish shell#283
shunkakinoki merged 1 commit into
mainfrom
feat/vi-keybindings-fish

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Oct 12, 2025

Copy link
Copy Markdown
Owner

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.

Copilot AI review requested due to automatic review settings October 12, 2025 05:19
@coderabbitai

coderabbitai Bot commented Oct 12, 2025

Copy link
Copy Markdown
📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Enabled vi-style key bindings in the interactive Fish shell, providing modal editing with familiar vi navigation and command editing shortcuts.
  • Chores

    • Removed the custom git abbreviation “gpn” from shell abbreviations and cleaned up related comments. Users who relied on this abbreviation may need to redefine it or adjust their workflow.

Walkthrough

Adds 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

Cohort / File(s) Summary
Fish config updates
home-manager/programs/fish/default.nix
Enable fish_vi_key_bindings during interactive init; remove gpn abbreviation from programs.fish.shellAbbrs and delete related comments.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

In the tide of the fish, I tap in vi,
Hops and hops, my cursor flies.
Goodbye gpn, a gentle wave,
New bindings set, so crisp and brave.
Thump-thump paws on keys—oh my!
Shell sings smooth beneath the sky. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly highlights the main feature of the change by specifying the switch to vi mode key bindings in the fish shell, is clear and closely aligned with the changeset without extraneous details.
Description Check ✅ Passed The pull request description clearly explains that the fish shell configuration is updated to use vi mode key bindings and also notes the removal of an unused git alias, directly reflecting the actual changeset.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/vi-keybindings-fish

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 95cf29f and fe9fa2d.

📒 Files selected for processing (1)
  • home-manager/programs/fish/default.nix (1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.nix

📄 CodeRabbit inference engine (CLAUDE.md)

Format all Nix files with nixfmt

**/*.nix: Nix: Use 2 spaces for indentation
Nix: Keep line length under 100 characters
Nix: Sort attribute sets alphabetically
Nix: Use consistent spacing around operators
Nix: Format lists and sets consistently

Follow the Nix expression language style guide

Files:

  • home-manager/programs/fish/default.nix
**/default.nix

📄 CodeRabbit inference engine (CLAUDE.md)

Use default.nix files for module exports

Files:

  • home-manager/programs/fish/default.nix
home-manager/**

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Keep home-manager configurations under home-manager/

Files:

  • home-manager/programs/fish/default.nix
home-manager/programs/*/default.nix

📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)

home-manager/programs/*/default.nix: Program configurations must be located in home-manager/programs// with configuration in default.nix
Program configurations should prefer Home Manager’s built-in modules when available
Program configurations should include all necessary dependencies
Program configurations should follow the provided template (programs..enable, package, and settings attrset)

Files:

  • home-manager/programs/fish/default.nix
home-manager/**/*.nix

📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)

Use proper indentation and formatting in Nix files

Files:

  • home-manager/programs/fish/default.nix
home-manager/programs/**/default.nix

📄 CodeRabbit inference engine (.cursor/rules/nix.mdc)

Program configurations in home-manager/programs should be organized by program name (one directory per program with a default.nix)

Files:

  • home-manager/programs/fish/default.nix
home-manager/programs/**/*.nix

📄 CodeRabbit inference engine (.cursor/rules/nix.mdc)

home-manager/programs/**/*.nix: Program configurations should include all necessary dependencies
Use home.packages for package installations in program configurations
Use programs. options provided by Home Manager when available

Files:

  • home-manager/programs/fish/default.nix
⏰ 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)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: nix-nixos
  • GitHub Check: nix-darwin
  • GitHub Check: nix-linux
  • GitHub Check: docker-build-push (linux/amd64, -amd64, amd64)
  • GitHub Check: e2e-run (NixOS, ubuntu-latest)
  • GitHub Check: e2e-run (MacOS, macos-latest)
  • GitHub Check: e2e-run (Ubuntu, ubuntu-latest)
🔇 Additional comments (1)
home-manager/programs/fish/default.nix (1)

30-30: LGTM! Consider verifying plugin compatibility.

The addition of fish_vi_key_bindings correctly enables vi mode for interactive shells. The placement in interactiveShellInit is appropriate.

Since the fzf-fish plugin (line 81-82) provides its own keybindings, you may want to verify that the plugin's keybindings work as expected in vi mode, particularly for features like Ctrl-R history search which changes to / in vi mode.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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

  • Fish Shell Configuration: The fish shell configuration has been updated to set vi mode as the default key bindings, providing a more efficient editing experience for users familiar with vi/vim.
  • Alias Cleanup: Commented-out Git abbreviation aliases and their associated comments have been removed from the fish shell configuration, streamlining the setup.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_bindings command 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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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;.

Comment on lines 49 to -51

# 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

@shunkakinoki
shunkakinoki enabled auto-merge (squash) October 12, 2025 05:23

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@shunkakinoki
shunkakinoki merged commit 7946e98 into main Oct 12, 2025
23 checks passed
@shunkakinoki
shunkakinoki deleted the feat/vi-keybindings-fish branch October 12, 2025 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants