vim - 如何覆盖 Vim 中的默认缩进
问题描述
这似乎很简单。只需在 /home 文件夹中创建自定义 .vimrc 文件,然后粘贴如下内容:
filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab
但是还是有问题。在括号后按 ENTER 键,我仍然有 8 个空格而不是所需的 4 个。同时制表键给了我 4 个空格。
我还在 /etc/vim 中找到了一个默认的 vimrc 文件。有一个脚本:
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
" filetype plugin indent on
"endif
据此,如果我取消注释这些行,我最终会得到所需的四个空格,但我无法保存它,因为它是“只读的”。
我使用“没有 GUI 的巨大版本”版本 8.0,它应该支持开箱即用的 python3。我真的不知道如何绕过这么小的障碍。我已经杀死了一整天试图修复它。也许我作为初学者选择了错误的文本编辑器?但我喜欢 Vim 是因为它的极简主义,我想在掌握我的技能后获得它的力量。同时我需要一个工作工具——现在。不正确的缩进在我的路上是一个小但非常烦人的障碍。
解决方案
推荐阅读
- android - 为什么在应用程序未运行时未调用 onMessageReceived 事件
- c# - 为什么“Environment.CurrentDirectory”设置为“C:\\Program Files\\IIS Express”?
- phantomjs - phantonjs 上的点击自动化不起作用
- c# - 我的角色不会爬升,只会倒在团结 2d 中
- python - xlsxwriter- 将列表写入列
- python - 如何临时断开 pyqt QSignalMapper
- c# - 如何将用户名和密码从 Windows 应用程序发布到网页以获取特定于用户的内容?
- reactjs - 缺少道具 reactjs proptypes 中的错误图
- kotlin - 如何将分机转为会员?
- javascript - 遇到两个孩子用同一个key Error