加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

展开标签到vim中的空格只在python文件?

发布时间:2020-12-15 09:13:29 所属栏目:安全 来源:网络整理
导读:当我编辑“* .py”文件而不是任何其他文件时,如何让Tab键插入4个空格? 根据Vim and PEP 8 — Style Guide for Python Code的建议,我安装了vim-flake8(和vim-pathogen)。当违反PEP8样式准则时,会发出警告。这是伟大的,但我希望标签在编辑python文件时自
当我编辑“* .py”文件而不是任何其他文件时,如何让Tab键插入4个空格?

根据Vim and PEP 8 — Style Guide for Python Code的建议,我安装了vim-flake8(和vim-pathogen)。当违反PEP8样式准则时,会发出警告。这是伟大的,但我希望标签在编辑python文件时自动扩展。我想有标签键实际插入标签时,编辑其他类型的文件。

换句话说,我想要以下应用,当我编辑python文件,只有python文件:

set expandtab       " tabs are converted to spaces
set tabstop=4       " numbers of spaces of tab character
set shiftwidth=4    " numbers of spaces to (auto)indent
autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4

甚至更短:

au Filetype python setl et ts=4 sw=4

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读