c++ - Vim 没有正确缩进我的 C/C++ 文件
问题描述
我真的对此感到困惑,并希望能得到快速帮助,因为我从昨天开始一直在尝试解决这个问题。我看过与 vim 中的缩进相关的视频,它适用于我的 Python 文件。但不知何故,当涉及到 .cpp 文件时,vim 会忽略我的 vimrc 文件的参数。
我在 Windows 下的 _vimrc 文件中以这种方式配置了它。
" Add proper C/C++ indentation
au BufNewFile,BufRead *.c, *.cpp, *.h
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix
" Add proper PEP8 indentation
au BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=79 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix
此配置适用于我的 Python 文件,但在我创建或打开 C/C++ 文件时会自动缩进 8 个字符。
知道这里有什么问题吗?
提前非常感谢。
解决方案
推荐阅读
- python - If 语句嵌套在 For 循环中 - 获取错误 = Series 的真值不明确。使用 a.empty、a.bool()、a.item()、a.any() 或 a.all()
- python - 使用PostgreSQL时如何将变量插入python
- path - PyCharm 远程解释器 [Errno 2] 没有这样的文件或目录:nvcc
- mule - 是否有 DataWeave 1.0“for”运算符?
- c# - 使用扩展授权的身份服务器 4 Windows 身份验证不起作用
- google-chrome - Chrome 未在网络推送通知中打开链接
- c# - .net:如何使用 C# 将用户添加到 Active Directory 安全组?
- function - 为什么模式匹配中不允许使用 [x, y, _]
- javascript - 无法使用 $(this) 定位元素
- apache - 无法访问 Solr 核心