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

:set ignorecase の作用がコマンドラインの補完時に効いているのは仕様か #1030

Open
ryunix opened this issue Feb 18, 2017 · 8 comments

Comments

@ryunix
Copy link
Member

ryunix commented Feb 18, 2017

質問・報告の内容

:help 'ignorecase' の内容から、検索時に大文字小文字が無視される設定だと分かります。
しかし、コマンドラインの補完時に大文字小文字が無視されることが分かりました。

これは仕様でしょうか?
仕様だとしたら :help 'ignorecase' が不親切ではないでしょうか?

再現方法は以下の通りです。

$ vim -Nu NONE +"set ignorecase" +'command! Foo echo "foo"'
:f<Tab>  # -> :Foo が補完される

Vimのバージョン

8.0.0314 (MacVim)

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

  • macOS Sierra

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

なし

その他

なし

@ryunix
Copy link
Member Author

ryunix commented Feb 18, 2017

そもそも比較時にも使用されたりするので、そういうもの(動きに関して)ですねと言う話をしました。
このような挙動も :help 'ignorecase':help /ignorecase には書かれていないと思います。
意見をお聞きしたいです。

@h-east
Copy link
Member

h-east commented Feb 19, 2017

コマンドライン補完が'ignorecase'を参照していることに関しては、「今そうなっているならそれでいいです」という意見です。

'ignorecase'は適用される範囲が広いですよね。
現状では各コマンドのhelpで言及されていますね。
今回の件に関してのhelpは :help cmdline-completionに書く感じかな。

:help 'ignorecase'にも以下のような感じで追記したほうがいいかもしれませんね。
(全部細かく書くと大変なので :helpgrep させて気付かせる作戦)

このオプションは様々なコマンドの結果に影響を与える。
詳細は `helpg 'ignorecase'` の結果を参照の事。

@ryunix
Copy link
Member Author

ryunix commented Feb 19, 2017

「今そうなっているならそれでいいです」という意見です。

私もそう思います。

今回の件に関してのhelpは :help cmdline-completion に書く感じかな。

そうですね、:help c_CTRL-I のところに書いてあればよいのかなと思います。
現状だと :help c_CTRL-L に検索と補完について言及されているので、'ignorecase' が効いてくるのだなと言うことは(一応)分かりますねと言う話もしました。

:helpgrep 'ignorecase' 案いいですね 👍

@h-east
Copy link
Member

h-east commented Feb 19, 2017

ひとまず、:help 'ignorecase'のpatch

diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 80fe222..0613200 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -4188,7 +4188,10 @@ A jump table for the options with a short description can be found at |Q_op|.
 	Also see 'smartcase' and 'tagcase'.
 	Can be overruled by using "\c" or "\C" in the pattern, see
 	|/ignorecase|.
-
+	NOTE: This option affects the results of various commands.  See the
+	result of the following command for details. >
+		:helpg 'ignorecase'
+<
 						*'imactivatefunc'* *'imaf'*
 'imactivatefunc' 'imaf'	string (default "")
 			global

@ryunix 他の部分は任せました:+1:

@ryunix
Copy link
Member Author

ryunix commented Feb 19, 2017

:helpg ではなく、:helpgrep としたほうがよいのではないでしょうか?
例えば、:help help-context には Or use ":helpgrep word". と記載されています。

他の部分はやれそうか見てみます 🤔

@ryunix
Copy link
Member Author

ryunix commented Feb 19, 2017

とりあえず最低限の文章だけ追加してみました 🤔

diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
index aab2a3e..c726224 100644
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -410,6 +410,7 @@ CTRL-D		List names that match the pattern in front of the cursor.
 		match is inserted.  After the last match, the first is used
 		again (wrap around).
 		The behavior can be changed with the 'wildmode' option.
+		'ignorecase' and 'smartcase' options are used.
 							*c_CTRL-N*
 CTRL-N		After using 'wildchar' which got multiple matches, go to next
 		match.  Otherwise recall more recent command-line from history.

唐突に出てきた 'smartcase' は以下で確認してあります。

$ vim -Nu NONE +"set ignorecase smartcase"
:print<C-D>  # -> Print print が補完候補になる
:Print<C-D>  # -> Print が補完候補になる
$ vim -Nu NONE +"set ignorecase nosmartcase"
:print<C-D>  # -> Print print が補完候補になる
:Print<C-D>  # -> Print print が補完候補になる

@ryunix
Copy link
Member Author

ryunix commented Feb 19, 2017

<Tab> だと説明しづらかったので <C-D> にしちゃいましたが、:help c_CTRL-D にも同じ文章を足したほうがいいのかな?
補完の確認自体は <Tab> でもやっています。

@tsuyoshicho
Copy link
Contributor

ちなみにですが、あわせてsmartcaseも効くようです。

# それでさらに微妙な現象がありますが別Issueにしてみようかと思います。

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

3 participants