微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何让Vim尊重.editorconfig?

我用 Vundle来安装 editorconfig-vim插件.它正确加载并列在:scriptnames中.但是当我创建一个文件,比如x.js时,没有从〜/ .editorconfig文件中选择缩进设置(虽然CWD中没有.editorconfig),而且我有2空格缩进而不是4空格在我的〜/ .editorconfig中定义.

我做错了什么?我应该调用〜/ .vimrc中的某个命令来使EditorConfig配置工作吗?

我的〜/ .editorconfig

root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4

[{package.json,.travis.yml,Gruntfile.js,gulpfile.js,webpack.config.js}]
indent_style = space
indent_size = 2

我的〜/ .vimrc配置:

set nocompatible              " be iMproved,required
filetype off                  " required

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'tomasr/molokai'
Plugin 'moll/vim-node'
Plugin 'jelera/vim-javascript-Syntax'
Plugin 'pangloss/vim-javascript'
Plugin 'editorconfig/editorconfig-vim'

call vundle#end()            " required
filetype plugin indent on    " required

" set tw=80
" set wrap linebreak nolist

let g:jsx_ext_required = 0 " Allow JSX in normal JS files
let g:syntastic_javascript_checkers = ['eslint']
let g:EditorConfig_core_mode = 'external_command'

Syntax on
set number
set ruler
colorscheme molokai
您可能想要使用:verbose set tabstop?检查哪个插件为你设置.

如果它没有说来自…的最后一次设置,则它使用认选项.

然后,editorconfig没有相应的设置,您可能想要检查使用了哪个.editorconfig.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐