Skip to content

Commit

Permalink
add nullptr_t
Browse files Browse the repository at this point in the history
Close #34
  • Loading branch information
mattn committed Nov 3, 2015
1 parent 63d4e4c commit e0d2e4e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion syntax/cpp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ syn keyword cppConstant __cplusplus

" C++ 11 extensions
if !exists("cpp_no_cpp11")
syn keyword cppType override final
syn keyword cppType override final nullptr_t
syn keyword cppExceptions noexcept
syn keyword cppStorageClass constexpr decltype thread_local
syn keyword cppConstant nullptr
Expand Down

9 comments on commit e0d2e4e

@osyo-manga
Copy link

Choose a reason for hiding this comment

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

nullptr_t は言語レベルのキーワードではなくて標準ライブラリで定義されている『ただの型』でしかないので、ここで (C++ のシンタックスとして)設定するのはちょっと違和感があります。
個人的には『言語レベルのキーワード』か『そうでないもの』に分けて設定(できるように)したほうがいいと思うのですがどうでしょうか。

@mattn
Copy link
Member Author

@mattn mattn commented on e0d2e4e Nov 5, 2015

Choose a reason for hiding this comment

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

なるほど。override や final が Type って名付けられてるのもちょっとモニョるので、本来であれば override と final が modifier かなんかになってるといいのですけどね。

@mattn
Copy link
Member Author

@mattn mattn commented on e0d2e4e Nov 5, 2015

Choose a reason for hiding this comment

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

あー、これ言い出すと inline virtual explicit export bool wchar_t もモニョる。

@osyo-manga
Copy link

Choose a reason for hiding this comment

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

override や final が Type って名付けられてるのもちょっとモニョるので、

今回の件とは関係ないんですが、ちょっとコードみててわたしも思いました。

あー、これ言い出すと inline virtual explicit export bool wchar_t もモニョる。

こっちもそうですね。bool wchar_t はいいんですけど、それ以外がちょっと違う感じがしますね。

@osyo-manga
Copy link

Choose a reason for hiding this comment

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

個人的には『言語レベルのキーワードでないもの(標準ライブラリで定義されている型とかマクロとか)』はシンタックスハイライトしてほしくないので、そういうのは組み込まないようにするか、設定で有効(無効)できるようにした方がよいと思っています。
あと言語に慣れてない人が『ハイライトされているからこれは言語のキーワードなのか』と勘違いすることもあると思います。
実際わたしも Vim で Ruby を書いているときにそういうような勘違いをしていました。

@mattn
Copy link
Member Author

@mattn mattn commented on e0d2e4e Nov 6, 2015

Choose a reason for hiding this comment

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

事後になって申し訳ないのですが、vim-dev に型 cppType と別に cppModifier というのを追加して、final とか override をそっちにもっていくパッチを投げています。
https://groups.google.com/forum/#!topic/vim_dev/bT2u0V88_9A

おしょうさんの言っている部分が cppType になると思うので、そちらのハイライトを消すか別の物に設定する事で解決するかと思いましたが、どうでしょうか。
デフォルトでハイライトされるのが良くないという事であれば、いったんこのパッチのマージをまってその上でフラグを見ながらハイライトしない設定を追加しましょうか。

@osyo-manga
Copy link

Choose a reason for hiding this comment

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

事後になって申し訳ないのですが、vim-dev に型 cppType と別に cppModifier というのを追加して、final とか override をそっちにもっていくパッチを投げています。

いえ、こちらも後出しなのであまり気にしないでください。

cppType になると思うので、そちらのハイライトを消すか別の物に設定する事で解決するかと思いましたが、どうでしょうか。

いや、cppType を消してしまうと wchar_tbool などと言った他の組み込み型も消えてしまうので困るかと。
わたしのイメージだと全く別の CppTypeEx (名前は適当) みたいなやつを用意してやるか !exists("cpp_no_std_hl") みたいな感じで区分けするのがいいのではないかと思ってました(個人的には後者の方が実装や設定がスッキリしてていいかな?
なので方向性としては

デフォルトでハイライトされるのが良くないという事であれば、いったんこのパッチのマージをまってその上でフラグを見ながらハイライトしない設定を追加しましょうか。

こんな感じでよいかと思います。

@mattn
Copy link
Member Author

@mattn mattn commented on e0d2e4e Nov 7, 2015

Choose a reason for hiding this comment

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

了解です。 #35 todo という事で。

@osyo-manga
Copy link

Choose a reason for hiding this comment

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

ありがとうございます。

Please sign in to comment.