Coder Social home page Coder Social logo

Comments (10)

jackielii avatar jackielii commented on August 28, 2024 1

Found this undocumented option:

let g:sleuth_editorconfig_overrides = {
    \ expand('$HOMEBREW_PREFIX/.editorconfig'): '',
    \ }

from vim-sleuth.

andrewferrier avatar andrewferrier commented on August 28, 2024

I think there is a related challenge here with NeoVim. @tpope, I'm not sure if you consider NeoVim a supported user of this plugin (although I use and have been using it regularly together over the last few years). NeoVim has fairly recently merged built-in editorconfig support: neovim/neovim#21633. It would be really nice to be able to disable the editorconfig capabilities of vim-sleuth, whilst retaining its heuristics (which are super-useful in the 80% case where editorconfig is not yet used for a project).

from vim-sleuth.

tpope avatar tpope commented on August 28, 2024

Disabling EditorConfig in Sleuth would cause it to apply heuristics even when a relevant EditorConfig rule exists. Depending on autocommand order this could even cause Sleuth's heuristics to override Neovim's built-in EditorConfig support. Whereas now, the worst case scenario is settings get applied twice. Am I missing something?

from vim-sleuth.

gpanders avatar gpanders commented on August 28, 2024

@andrewferrier Alternatively, disable Neovim's builtin EditorConfig support in favor of vim-sleuth's (pending neovim/neovim#21649):

let g:editorconfig = v:false

from vim-sleuth.

andrewferrier avatar andrewferrier commented on August 28, 2024

@tpope it's a fair point, current worst case is actually better. Let's stick with what you have.

@gpanders thanks, wasn't aware of that PR.

from vim-sleuth.

wickles avatar wickles commented on August 28, 2024

Found this undocumented option:

let g:sleuth_editorconfig_overrides = {
    \ expand('$HOMEBREW_PREFIX/.editorconfig'): '',
    \ }

I don't think this option supports what I want to do. I want to override editorconfig but only in .git data directories, since I often edit .git/config directly which should always use tabs. Git data directories are not part of the repository so should never be influenced by editorconfig anyway.

from vim-sleuth.

tpope avatar tpope commented on August 28, 2024

I don't think this option supports what I want to do. I want to override editorconfig but only in .git data directories, since I often edit .git/config directly which should always use tabs.

It doesn't do what you want to do, but it solves the problem you're trying to solve. Namely the problem is using *:

[*]
indent_style = space

There's a difference between "this project uses spaces for indentation" and "every file in every subdirectory of this directory should use spaces instead of tabs". Personally, any time I see *, I want to throw the .editorconfig out and start over. Hence the design of the option.

For what you want to do, there's no built-in solution, but it should be straightforward to achieve by sticking a root = true EditorConfig in a Git init template.

Git data directories are not part of the repository so should never be influenced by editorconfig anyway.

Citation needed. I don't see anything in the EditorConfig spec about that. In fact, some usages of EditorConfig assume you do want it to influence .git.

from vim-sleuth.

wickles avatar wickles commented on August 28, 2024

You're right, and I agree about *. Like OP my problem is also related to nested repositories in homebrew. Maybe I will see if I can get this changed over there.

For what you want to do, there's no built-in solution, but it should be straightforward to achieve by sticking a root = true EditorConfig in a Git init template.

Interesting idea! I suppose I can add that to my existing clones as well. Thanks.

from vim-sleuth.

tpope avatar tpope commented on August 28, 2024

I suppose I can add that to my existing clones as well.

If you call git init in an existing repository, it will update the repository with files from the template.

from vim-sleuth.

tpope avatar tpope commented on August 28, 2024

You're right, and I agree about *. Like OP my problem is also related to nested repositories in homebrew. Maybe I will see if I can get this changed over there.

Oh please do. That will help a lot more than just Sleuth users. I think the ideal fix there would be to target not (just?) file extensions but the containing directories. The .gitignore opts in certain paths, and I think the .editorconfig should mirror that, though it doesn't need to be quite so granular.

from vim-sleuth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.