feat: 変更ファイル間を移動するコマンドを追加#129
Merged
flexphere merged 4 commits intoApr 28, 2026
Merged
Conversation
Expose next_file/prev_file in fude.files plus :FudeReviewNextFile and :FudeReviewPrevFile commands so users can jump between PR-changed files with a single keymap. Wraps around at the edges and falls back to the first/last entry when the current buffer is not part of the PR. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
レビュー中に「差分のある次/前のファイル」へ素早く移動できるように、変更ファイル間ナビゲーション用のコマンドとLua APIを追加するPRです。
Changes:
:FudeReviewNextFile/:FudeReviewPrevFileユーザーコマンドを追加- Lua API として
require("fude.files").next_file()/prev_file()と、純関数ヘルパfind_adjacent_file_index()を追加 - README / helptags / 開発ドキュメント(CLAUDE.md)/ テストを更新
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/fude/files_spec.lua | 隣接ファイル計算と next/prev 移動のテストを追加 |
| plugin/fude.lua | Next/Prev ファイル移動コマンドを登録 |
| lua/fude/files.lua | 隣接ファイル計算ロジックと next/prev 移動APIを実装 |
| doc/fude.txt | 新コマンドのヘルプを追加 |
| README.md | lazy.nvim例・コマンド一覧に新コマンドを追記 |
| CLAUDE.md | files.lua の責務説明に next/prev 移動機能を追記 |
to_repo_relative re-runs git rev-parse internally; since goto_adjacent already has the repo root, use the pure make_relative helper to compute the buffer's repo-relative path without spawning git twice. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous integration tests called the real :edit command, leaking buffers that helpers.cleanup did not track. Mock vim.cmd to capture the edit command string and assert against it directly. Also assert the captured command is nil on the early-return paths so the defense checks actually verify nothing was opened. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add two lessons surfaced by Copilot's review on PR flexphere#129: avoiding helper chains that re-fetch already-cached values, and using a vim.cmd mock instead of letting tests open real buffers via :edit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
flexphere
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
なぜ
レビュー中、変更ファイル間を一発で移動したい場面が多い。
preview panel や file finder だと「開く → 戻る → また開く」のサイクルが要り、
レビューの流れが途切れる。
何を
:FudeReviewNextFile/:FudeReviewPrevFileを追加(最後のファイルで wrapして先頭に戻る)require("fude.files").next_file()/prev_file()を公開。キーマップは利用者の好みに委ねる
]fと[fキーマップを README の example config に追加。確認内容
問題なく次の差分のあるファイル・前のファイルを表示できること。
CleanShot2026-04-28at10.08.09.mp4
また、スコープがある場合は、そのスコープ内のファイルに限定されることも確認済み。