editorconfig / editorconfig-vim

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

.editorconfig not being honored #204

Closed chris-fj closed 1 year ago

chris-fj commented 1 year ago

I get that you probably close issues like these thousands of times per day, but I don't know where else to ask for help. I have a .editorconfig file that looks like this

# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4

# Tab indentation (no size specified)
# overrides previous *
[Makefile]
indent_style = tab

[*.js]
indent_size = 2

Basically a copy/paste from the website with a personal touch just for testing. This file lies somewhere in a folder on my system and also there's a hardlink in ~. After creating the file, I did

mkdir -p ~/.vim/pack/editorconfig/start
git clone https://github.com/editorconfig/editorconfig-vim.git ~/.vim/pack/editorconfig/start

to unpack the plugin. I also added filetype plugin on to my ~/.vimrc and I was expecting that opening a .js file would indent with 2 spaces (when creating a function or an indented block) but that was not the case, since a hard tab was inserted instead.

vim --version says

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Dec 11 2022 13:50:40)
Included patches: 1-1046
Compiled by Arch Linux
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       +tcl/dyn
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
+balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
+browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     +perl/dyn          +title
+channel           +ipv6              +persistent_undo   +toolbar
+cindent           +job               +popupwin          +user_commands
+clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3/dyn       +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
+cscope            +localmap          +ruby/dyn          +wildignore
+cursorbind        +lua/dyn           +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con_gui    +mksession         +smartindent       +writebackup
+diff              +modify_fname      -sodium            +X11
+digraphs          +mouse             +sound             -xfontset
+dnd               +mouseshape        +spell             +xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        +mouse_gpm         +statusline        +xsmp_interact
+eval              -mouse_jsbterm     -sun_workshop      +xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary        
-farsi             -mouse_sysmouse    -tag_old_static    
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-4 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/lzo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cloudproviders -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -pthread -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/vim/src=/usr/src/debug/vim -flto=auto -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: gcc -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.36/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto -L/usr/local/lib -o vim -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lelf -lcanberra -lacl -lattr -lgpm -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.36/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto -fstack-protector-strong -L/usr/local/lib -L/usr/lib/perl5/5.36/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm 

this is on an Arch Linux box, but I also have a fedora one (with -python and +python3/dyn), another one is an openSUSE with +python/dyn and +python3/dyn, a Mac, a couple of Ubuntu servers, etc... My goal is to have a configuration file that "just works" across all of my systems without having to install/reinstall/compile vim ad hoc. The README.md file of this repo says:

No external editorconfig core library is required Previous versions of this plugin also required a Python "core". The core included the code to parse .editorconfig files. This plugin includes the core, so you don't need to download the core separately.

which "probably" means that I don't have to worry about my vim being compiled or not with +python, which is what I want. But also, the vim plugin page (linked on the README.md) says:

install details If your Vim is compiled with +python feature (this is usually true on most Linux distributions), the most simple way to install this plugin is to download the archive and extract it into your Vim runtime directory.

from which stems that +python is required to install by cloning the repo inside ~/.vim and contradicts what I (wanted to) understood from the README.md quote.

My goal is to have configuration file ready to be cloned/hardlinked and that the plugin is installed the minimal amount of steps (compiling or reinstalling vim would be then out of the question, since for some machines I don't even have admin rights and for the ones I do would create an heterogeneous installation process). Cloning the repo as I did above would be my ideal installation setup.

My questions are:

Thanks in advance

chris-fj commented 1 year ago

For anyone suffering as I was, the problem was that I cloned the repo directly on the root of start and it has to be on a folder inside start. This fixed my problem and it allows me to do what I asked