editorconfig / editorconfig-vim

EditorConfig plugin for Vim
http://editorconfig.org
Other
3.13k stars 137 forks source link

Add g:root_editorconfig_path variable #153

Closed RonanMacF closed 4 years ago

RonanMacF commented 4 years ago

I have my root editconfig file located in ~/.config/nvim/. Most of my work is performed in /src on different machines and I would rather not put custom configurations in these directories. Being able to set the path would enable editorconfig to easily find the file without me having to move/symlink it

xuhdev commented 4 years ago

Hi @RonanMacF ! If you have global settings, you can actually do them in your .vimrc file. .editorconfig is way less powerful, because its purpose is (excerpt from editorconfig.org):

EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs.

Does this make sense to you?

signal-intrusion commented 1 year ago

Hello. 👋

Actually no. That isn't helpful without an example. I've tried to add the following three options with no luck:

let g:EditorConfig_indent_style = 'space'
let g:indent_style = 'space'
let b:indent_style = 'space'

I've also searched all over stack overflow and github for any vimrc files with an examples. I've also read the help file many many times, but I don't see any example of this.

I can see it in the source code, but I don't know how to make it work: https://github.com/editorconfig/editorconfig-vim/blob/master/plugin/editorconfig.vim#L387-L393

It does work with a local .editorconfig file, but not every project at my job has one (or will allow me to add one) 🙄.

An example would be great. Thanks.

cxw42 commented 1 year ago

@signal-intrusion The part you linked is processing the rules; the setl commands are doing the work. set is the global equivalent of setl. So if you put set expandtab in your .vimrc, you will get space indents by default.

Filetype-specific globals can be done with ftplugins or autocommands. Examples: https://stackoverflow.com/a/159066