Użyłem Vundle do zainstalowania wtyczki editorconfig-vim. Ładuje się poprawnie i jest wymieniony w :scriptnames
. Ale kiedy tworzę nowy plik, powiedzmy, x.js
, ustawienia wcięć nie są wybierane z pliku ~/.editorconfig
(chociaż nie ma .editorconfig
w CWD), a ja mam wcięcie 2-spacji zamiast 4-spacji, jak zdefiniowałem w moim ~/.editorconfig
.Jak sprawić, by Vim szanował .editorconfig?
Co mam zrobić źle? Czy powinienem wywołać określone polecenie w ~/.vimrc
, aby konfiguracja EditorConfig działała?
My ~/.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
A moja ~/.vimrc
config:
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
Czy masz zainstalowany plik binarny editorconfig? ponieważ używasz external_command – xuhdev
Tak, 'editorconfig -v' echa" EditorConfig C Core Version 0.12.0 ". –
Czy możesz spróbować ': EditorConfigReload' i sprawdzić, czy to działa. Wypróbuj także istniejące pliki. – xuhdev