为什么即使文件类型未设置,Vim也会使用Bash缩进规则?
发布时间:2020-12-15 21:21:19 所属栏目:安全 来源:网络整理
导读:我有一个令人困惑的Vim问题.如果我开始编辑一个新文件,比如使用 vim test.txt,我输入单词“do”并按Enter键(仍处于插入模式),下一行会自动缩进.在给出快速回答之前,请阅读整篇文章. 两个问题: 为什么会发生这种情况? 我如何调试启动过程(读取?/ .vimrc和?/
我有一个令人困惑的Vim问题.如果我开始编辑一个新文件,比如使用
vim test.txt,我输入单词“do”并按Enter键(仍处于插入模式),下一行会自动缩进.在给出快速回答之前,请阅读整篇文章.
两个问题: >为什么会发生这种情况? 更多信息: >这是我的.vimrc:http://dotfiles.org/~meonkeys/.vimrc. 解决方法'smartindent' 'si' boolean (default off) local to buffer {not in Vi} {not available when compiled without the |+smartindent| feature} Do smart autoindenting when starting a new line. Works for C-like programs,but can also be used for other languages. 'cindent' does something like this,works better in most cases,but is more strict,see |C-indenting|. When 'cindent' is on,setting 'si' has no effect. 'indentexpr' is a more advanced alternative. Normally 'autoindent' should also be on when using 'smartindent'. An indent is automatically inserted: - After a line ending in '{'. - After a line starting with a keyword from 'cinwords'. - Before a line starting with '}' (only with the "O" command). cinwords默认为if,else,while,do,for,switch (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |