Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(keyboard shortcut): add more Vim-Style Keybind#3498

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
phucisstupid wants to merge3 commits intospicetify:main
base:main
Choose a base branch
Loading
fromphucisstupid:more-vim-keys

Conversation

@phucisstupid
Copy link
Contributor

@phucisstupidphucisstupid commentedAug 28, 2025
edited by coderabbitaibot
Loading

Added Vim Inspired Keys

  • shift+j,shift+k: Rotate through sidebar
  • d: Scroll down (half-page)
  • u: Scroll up (half-page)

Summary by CodeRabbit

  • New Features
    • Added keyboard shortcuts: Shift+J / Shift+K to cycle through the sidebar; D / U to scroll half a page down/up in the app view.
  • Bug Fixes
    • Improved temporary key-listener behavior so shortcuts are reliably removed after use and no longer linger or misfire.

@coderabbitai
Copy link

coderabbitaibot commentedAug 28, 2025
edited
Loading

Walkthrough

Adds Shift+J/Shift+K bindings to rotate the sidebar, adds D/U to scroll half a page via a new scrollHalfPage(direction) function, and refactors scroll keyup cleanup to a named clear function with the listener using { once: true }.

Changes

Cohort / File(s)Summary of changes
Keyboard shortcuts and scrolling
Extensions/keyboardShortcut.js
- Added bindings:shift+jrotateSidebar(1),shift+krotateSidebar(-1),dscrollHalfPage(1),uscrollHalfPage(-1)
- Implemented `scrollHalfPage(direction /* 1

Sequence Diagram(s)

sequenceDiagram  autonumber  participant U as User  participant KS as KeyboardShortcut  participant App as App View  participant SB as Sidebar  rect rgba(200,230,255,0.2)    U->>KS: Press Shift+J    KS->>SB: rotateSidebar(1)    U->>KS: Press Shift+K    KS->>SB: rotateSidebar(-1)  end  rect rgba(200,255,200,0.2)    U->>KS: Press D    KS->>App: scrollHalfPage(1)    KS->>App: focusOnApp() for bounds    U->>KS: Press U    KS->>App: scrollHalfPage(-1)    KS->>App: focusOnApp() for bounds  end  note over KS: Keyup cleanup uses named clear() and listener with { once: true }
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I tap-tap keys with whiskered glee,
Shift+J, Shift+K—sidebar spins for me!
D hops down, U bounds back, neat,
Half-page leaps on fluffy feet.
One clear hop, cleanup done—my shortcuts fleet! 🐇⌨️

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from theIntegrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • 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 betweenea64a9c and1dd4f07.

📒 Files selected for processing (1)
  • Extensions/keyboardShortcut.js (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Extensions/keyboardShortcut.js
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat withCodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag@coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag@coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on oursupport page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type@coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add@coderabbit ignore or@coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add@coderabbit summary or@coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add@coderabbit or@coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a.coderabbit.yaml file to the root of your repository.
  • Please see theconfiguration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit ourStatus Page to check the current availability of CodeRabbit.
  • Visit ourDocumentation for detailed information on how to use CodeRabbit.
  • Join ourDiscord Community to get help, request features, and share feedback.
  • Follow us onX/Twitter for updates and announcements.

Copy link

@coderabbitaicoderabbitaibot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
Extensions/keyboardShortcut.js (3)

47-50:Reconsider ‘d/u’ semantics; prefer Ctrl+D/Ctrl+U for Vim parity or ignore inputs to avoid hijacking typing

In Vim, half-page is Ctrl+D/Ctrl+U; plain ‘d’/‘u’ are delete/undo. Also, binding plain letters risks capturing typing outside inputs if Mousetrap’s input-ignoring behavior changes.

Option A (Vim-consistent):

-    d: { callback: () => scrollHalfPage(1) },-    u: { callback: () => scrollHalfPage(-1) },+    "ctrl+d": { callback: () => scrollHalfPage(1) },+    "ctrl+u": { callback: () => scrollHalfPage(-1) },

Option B (keep ‘d/u’, but don’t fire while user is typing):

-    d: { callback: () => scrollHalfPage(1) },-    u: { callback: () => scrollHalfPage(-1) },+    d: { callback: (event) => { if (shouldIgnoreKey(event)) return; scrollHalfPage(1); } },+    u: { callback: (event) => { if (shouldIgnoreKey(event)) return; scrollHalfPage(-1); } },

Add once (outside this hunk):

functionshouldIgnoreKey(event){constt=event.target;return!!t&&((tinstanceofHTMLInputElement)||(tinstanceofHTMLTextAreaElement)||t.isContentEditable===true);}

128-130:Good cleanup with once; fix indentation to satisfy Biome

The namedclear +{ once: true } is solid. However, current indentation deviates from file style and triggers the formatter.

Apply formatting (tabs, aligned with surrounding code):

-      const clear = () => clearInterval(scrollInterval);-      document.addEventListener("keyup", clear, { once: true });+const clear = () => clearInterval(scrollInterval);+document.addEventListener("keyup", clear, { once: true });

126-145:Biome CI is failing; run formatter or fix indentation in this range

GitHub Actions reports a Biome formatting failure for 126–145. Run:biome format Extensions/keyboardShortcut.js or apply the indentation fix above to clear CI.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • 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 betweena549ca0 andea64a9c.

📒 Files selected for processing (1)
  • Extensions/keyboardShortcut.js (4 hunks)
🧰 Additional context used
🪛 GitHub Actions: Code quality
Extensions/keyboardShortcut.js

[error] 126-145: Biome formatting check failed. File 'Extensions/keyboardShortcut.js' content differs from formatting output. Command 'biome ci . --files-ignore-unknown=true --diagnostic-level=error' reported the issue. Run 'biome format Extensions/keyboardShortcut.js' to fix.

🔇 Additional comments (1)
Extensions/keyboardShortcut.js (1)

138-146:scrollHalfPage implementation is correct

Bounds clamping and half-page delta are handled correctly.

Comment on lines +35 to +38
// Rotate through sidebar items using Shift+J/Shift+K (Vim-style).
"shift+j":{callback:()=>rotateSidebar(1)},
"shift+k":{callback:()=>rotateSidebar(-1)},

Choose a reason for hiding this comment

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

⚠️ Potential issue

Shift+J/K bindings look good; safeguard rotateSidebar index to avoid NaN crash

IffindActiveIndex can’t find a match whileactiveLink oractivePage exists, it returnsundefined, makingfindActiveIndex(...) + direction becomeNaN andallItems[index] will throw. Add a fallback return at the end offindActiveIndex or coerce inrotateSidebar.

Add a fallback infindActiveIndex (outside this hunk):

functionfindActiveIndex(allItems){// ...existing logic...return-1;// ensure a number is always returned}

Optionally harden inrotateSidebar:

constactiveIdx=findActiveIndex(allItems);letindex=(typeofactiveIdx==="number" ?activeIdx :-1)+direction;
🤖 Prompt for AI Agents
In Extensions/keyboardShortcut.js around lines 35 to 38, the Shift+J/K handlerscall rotateSidebar which relies on findActiveIndex returning a number; iffindActiveIndex returns undefined the index math becomes NaN and accessingallItems[index] will throw. Modify findActiveIndex (elsewhere in the file) toalways return a number (e.g., return -1 at the end) and additionally hardenrotateSidebar by coercing the result to a numeric fallback before addingdirection (e.g., treat non-number as -1) so index math cannot produce NaN.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@coderabbitaicoderabbitai[bot]coderabbitai[bot] left review comments

At least 2 approving reviews are required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@phucisstupid

[8]ページ先頭

©2009-2025 Movatter.jp