Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【質問】vimgrep と ウィンドウ / タブ の pwd の関係 #1415

Open
KSR-Yasuda opened this issue May 23, 2023 · 3 comments
Open

【質問】vimgrep と ウィンドウ / タブ の pwd の関係 #1415

KSR-Yasuda opened this issue May 23, 2023 · 3 comments

Comments

@KSR-Yasuda
Copy link

質問の内容

vimgrep / lvimgrep で、検索対象ファイルを設定するとき の話です。
tcdlcd が一致していないとき、 うまくファイルが開けない気がします。

tcd = lcd が一致しているケース だと 大抵 意図通り 動作するので、
今のところ、意図的に そういう使い方をしています。

このあたりの挙動について、ご存じであれば ご教示いただきたいです。


自分でも あまり整理ができておらず、混乱していますが、
見たところ、以下のような感じです。

例えば、以下のようなディレクトリ構成で、
tcd = . ; lcd = ./d にいたとします。

./
`-- d/
    |-- fuga.txt
    `-- hoge.txt

このとき、:vimgrep /SEARCH_STRING/ PATHPATH の部分を 以下で試しても、
成功が まちまちです。

  • *.txt (lcd 的には 相対パスで 正しい)
  • d/*.txt (tcd 的には 相対パスで 正しい)
  • /absolute/path/d/*.txt (絶対パス で指定)

絶対パス を与えた場合でも、どうも ファイルをうまく開けていないようです。

fuga.txt
"fuga.txt" [新]
/absolute/path/d
ファイル "fuga.txt" を開けません


"hoge.txt" [新]
/absolute/path/d
ファイル "hoge.txt" を開けません
E480: 該当はありません: hoge

vimgrepコマンドの実行を、コマンドウィンドウを開いて実行したり などでも、挙動に影響を受けている気がします:

  • コマンドウィンドウを開く (q: または :Ctrl-F) ケースだと、大抵 失敗
  • コマンドウィンドウを開かずに (:) 実行するケースだと、場合により 成功?
    • 直前に pwd が別のウィンドウ に移動していると、失敗
    • その状態で 連続実行すると 成功

Vimのバージョン

9.0.1403
(以前から なので、8系でも 同様かと思います)

OSの種類/ディストリ/バージョン

  • Microsoft Windows 10 Pro 64bit 22H2 [Version 10.0.19045.2965]
  • Git for Windows v2.41.0.rc1.windows.1

使用している or 関係していそうなプラグイン

特になし

その他

@h-east
Copy link
Member

h-east commented May 23, 2023

Linux(Ubuntu 20.04)でも再現しました。

@h-east
Copy link
Member

h-east commented Jun 11, 2023

Reported.
vim/vim#12520

@h-east
Copy link
Member

h-east commented Jun 20, 2023

原因分かりました。今週末にはpatch書いてPR出せると思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants