使用 "=" for c++ 进行 GVIM 格式化

GVIM formatting using "=" for c++

本文关键字:GVIM 格式化 进行 for 使用 c++      更新时间:2023-10-16

当在gvim中选择以下代码并点击"="时,它会移动构造函数上的括号。这是一个 gvim 错误还是我可能需要设置才能修复的设置?

输出:

class GameData
{
  public:
    enum Key { A=0, B, C, D, TOTAL_KEYS };
    GameData() : moves_() , numKeys_(TOTAL_KEYS) 
  {
    populateMoves();
  }
    inline const std::vector<Key>& getMoves ( int k ) const 
    { 
      return moves_[k];
    }

期望输出:

class GameData
{
  public:
    enum Key { A=0, B, C, D, TOTAL_KEYS };
    GameData(): moves_(), numKeys_(TOTAL_KEYS) 
    {
      populateMoves();
    }
    inline const std::vector<Key>& getMoves ( int k ) const 
    { 
      return moves_[k];
    }

设置cino=i0使语句与我的 vim 安装正确对齐。

从帮助

                        *cino-i*
iN    Indent C++ base class declarations and constructor
      initializations, if they start in a new line (otherwise they
      are aligned at the right side of the ':').
      (default 'shiftwidth').