Skip to content

feat: add custom key bindings for exiting vim insert mode in fish shell - #284

Merged
shunkakinoki merged 2 commits into
mainfrom
fix/key-bindings
Oct 12, 2025
Merged

feat: add custom key bindings for exiting vim insert mode in fish shell#284
shunkakinoki merged 2 commits into
mainfrom
fix/key-bindings

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Oct 12, 2025

Copy link
Copy Markdown
Owner

Summary by cubic

Adds a custom fish key binding to exit vi insert mode with "jj", plus a small alias and improved Docker image tagging logic for matrix builds.

  • New Features

    • Add fish key binding: "jj" exits insert mode (vi mode).
    • Add alias g = git.
  • Bug Fixes

    • Docker workflow: apply matrix suffix to images/tags and control latest publishing.
    • Enable appropriate sha/semver/latest tags based on main vs non-main pushes.

Copilot AI review requested due to automatic review settings October 12, 2025 09:50
@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 integrating a custom key binding for exiting Vim insert mode, making the shell's command line editing more consistent with a Vim workflow. Additionally, it introduces a new alias for the git command, aiming to improve efficiency for common development tasks.

Highlights

  • Custom Key Binding for Fish Shell: Introduced a new key binding in the Fish shell configuration, allowing users to exit Vim insert mode by pressing jj.
  • New Git Alias: Added a convenient alias g which expands to the git command, streamlining Git operations.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/docker.yml
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.

@coderabbitai

coderabbitai Bot commented Oct 12, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Fish shell: Added abbreviation g → git for faster commands.
    • Fish shell: Added insert-mode keybinding jj to quickly exit insert mode.
  • Chores

    • CI/Docker: Refined image tagging logic, including dynamic suffix handling, a clearer latest flag, and event-aware tag enabling to improve consistency across push and non-push builds.

Walkthrough

Updates CI Docker tagging logic in .github/workflows/docker.yml to derive suffix from matrix data, introduce a latest flag, and consolidate tag rules with conditional enablement for push-to-main vs. other events. Adds a Fish shell abbreviation g→git and a new fish_user_key_bindings function to map jj to exit insert mode.

Changes

Cohort / File(s) Summary
CI Docker tagging logic
.github/workflows/docker.yml
Metadata step now derives flavor suffix from matrix.build.suffix; introduces a computed latest flag. Tag definitions consolidated to include suffix and per-tag enable conditions. Adds/adjusts tags for push-to-main (short sha, raw latest) and non-push (short sha, selective semver/raw) flows.
Fish shell abbreviations
home-manager/programs/fish/default.nix
Adds shellAbbrs entry: ggit.
Fish key bindings
home-manager/programs/fish/functions/_fish_user_key_bindings.fish
Adds fish_user_key_bindings defining insert-mode mapping: jj exits insert mode via backward-char; force-repaint, bound in insert keymap.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant GH as GitHub Actions
  participant Meta as Set Metadata
  participant Build as Build & Tag

  Dev->>GH: Push / PR / Workflow dispatch
  GH->>Meta: Run metadata step
  Note over Meta: Derive suffix from matrix.build.suffix<br/>Compute "latest" flag (push-to-main?)
  Meta-->>Build: Tags + enable flags with suffix

  alt Push to main
    Build->>Build: Enable short sha tag with suffix
    Build->>Build: Enable raw "latest" tag with suffix
    Build-->>GH: Publish images with push-to-main tags
  else Non-push events
    Build->>Build: Enable short sha tag with suffix
    Build->>Build: Disable semver/raw patterns as specified
    Build->>Build: Optionally enable non-latest raw per flags
    Build-->>GH: Publish images with non-push tags
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

A hop and a tag in the CI night,
Suffixes lined, latest set right.
Tap jj—escape, so neat!
g turns to git—swift on my feet.
Carrots pushed, images ship—delight! 🥕🐇

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/key-bindings

📜 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 7946e98 and be836f5.

📒 Files selected for processing (3)
  • .github/workflows/docker.yml (1 hunks)
  • home-manager/programs/fish/default.nix (1 hunks)
  • home-manager/programs/fish/functions/_fish_user_key_bindings.fish (1 hunks)

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.

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 adds custom vim-style key bindings to the fish shell configuration, specifically implementing a "jj" key sequence to exit vim insert mode. The changes also include unrelated modifications to shell aliases and Docker workflow configuration.

  • Added fish shell function for custom key bindings with "jj" sequence for vim mode navigation
  • Added "g" alias for git command in shell configuration
  • Updated Docker workflow tagging strategy to handle suffixes and latest tag logic differently

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
home-manager/programs/fish/functions/fish_user_key_bindings.fish New function implementing "jj" key binding to exit vim insert mode
home-manager/programs/fish/default.nix Added git alias "g" to shell aliases configuration
.github/workflows/docker.yml Updated Docker image tagging logic with suffix handling and conditional latest tag behavior

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

flavor: |
suffix=${{ github.ref == 'refs/heads/main' && github.event_name == 'push' && matrix.build.suffix || '' }}
suffix=${{ matrix.build.suffix }}
latest=${{ github.ref == 'refs/heads/main' && github.event_name == 'push' && 'false' || 'auto' }}

Copilot AI Oct 12, 2025

Copy link

Choose a reason for hiding this comment

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

The latest tag logic is inverted. When on main branch with push event, it sets latest='false', but the following tags suggest it should be 'true' or 'auto'. This will prevent the latest tag from being applied when expected.

Suggested change
latest=${{ github.ref == 'refs/heads/main' && github.event_name == 'push' && 'false' || 'auto' }}
latest=${{ github.ref == 'refs/heads/main' && github.event_name == 'push' && 'true' || 'false' }}

Copilot uses AI. Check for mistakes.
type=sha,format=short,enable=${{ !(github.ref == 'refs/heads/main' && github.event_name == 'push') }}
type=semver,pattern={{version}},enable=${{ !(github.ref == 'refs/heads/main' && github.event_name == 'push') }}
type=semver,pattern={{raw}},enable=${{ !(github.ref == 'refs/heads/main' && github.event_name == 'push') }}
type=raw,value=latest,enable=${{ !(github.ref == 'refs/heads/main' && github.event_name == 'push') }}

Copilot AI Oct 12, 2025

Copy link

Choose a reason for hiding this comment

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

This condition enables the 'latest' tag when NOT on main branch with push event, which contradicts typical Docker tagging conventions where 'latest' should only be applied to main branch releases.

Suggested change
type=raw,value=latest,enable=${{ !(github.ref == 'refs/heads/main' && github.event_name == 'push') }}

Copilot uses AI. Check for mistakes.
@shunkakinoki
shunkakinoki merged commit 389a298 into main Oct 12, 2025
3 checks passed
@shunkakinoki
shunkakinoki deleted the fix/key-bindings branch October 12, 2025 09:51

@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 adds a 'g' alias for 'git' and a custom keybinding 'jj' to exit insert mode in the fish shell's vi mode. While the alias is a reasonable personal preference, the implementation of the 'jj' keybinding is incorrect and doesn't function as described in the comment. I've provided a critical review comment with a code suggestion to fix the keybinding, ensuring it correctly exits insert mode and clears the typed characters from the command line.

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

1 issue found across 3 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name=".github/workflows/docker.yml">

<violation number="1" location=".github/workflows/docker.yml:49">
The new `enable=${{ !(github.ref == &#39;refs/heads/main&#39; &amp;&amp; github.event_name == &#39;push&#39;) }}` on the semver tag entries disables semver tags during main pushes, so release builds never publish `vX.Y.Z-&lt;arch&gt;` images. The manifest job still expects those tags and will fail to assemble multi-arch semver manifests, leaving release tags missing from GHCR.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

type=sha,format=short,suffix=${{ matrix.build.suffix }},enable=${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
type=raw,value=latest,suffix=${{ matrix.build.suffix }},enable=${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
type=sha,format=short,enable=${{ !(github.ref == 'refs/heads/main' && github.event_name == 'push') }}
type=semver,pattern={{version}},enable=${{ !(github.ref == 'refs/heads/main' && github.event_name == 'push') }}

@cubic-dev-ai cubic-dev-ai Bot Oct 12, 2025

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.

The new enable=${{ !(github.ref == 'refs/heads/main' && github.event_name == 'push') }} on the semver tag entries disables semver tags during main pushes, so release builds never publish vX.Y.Z-<arch> images. The manifest job still expects those tags and will fail to assemble multi-arch semver manifests, leaving release tags missing from GHCR.

Prompt for AI agents
Address the following comment on .github/workflows/docker.yml at line 49:

<comment>The new `enable=${{ !(github.ref == &#39;refs/heads/main&#39; &amp;&amp; github.event_name == &#39;push&#39;) }}` on the semver tag entries disables semver tags during main pushes, so release builds never publish `vX.Y.Z-&lt;arch&gt;` images. The manifest job still expects those tags and will fail to assemble multi-arch semver manifests, leaving release tags missing from GHCR.</comment>

<file context>
@@ -40,12 +40,15 @@ jobs:
+            type=sha,format=short,suffix=${{ matrix.build.suffix }},enable=${{ github.ref == &#39;refs/heads/main&#39; &amp;&amp; github.event_name == &#39;push&#39; }}
+            type=raw,value=latest,suffix=${{ matrix.build.suffix }},enable=${{ github.ref == &#39;refs/heads/main&#39; &amp;&amp; github.event_name == &#39;push&#39; }}
+            type=sha,format=short,enable=${{ !(github.ref == &#39;refs/heads/main&#39; &amp;&amp; github.event_name == &#39;push&#39;) }}
+            type=semver,pattern={{version}},enable=${{ !(github.ref == &#39;refs/heads/main&#39; &amp;&amp; github.event_name == &#39;push&#39;) }}
+            type=semver,pattern={{raw}},enable=${{ !(github.ref == &#39;refs/heads/main&#39; &amp;&amp; github.event_name == &#39;push&#39;) }}
+            type=raw,value=latest,enable=${{ !(github.ref == &#39;refs/heads/main&#39; &amp;&amp; github.event_name == &#39;push&#39;) }}
</file context>
Fix with Cubic

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