Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insert_final_newline = unset doesn't obey existing setting #168

Open
jsit opened this issue May 4, 2021 · 2 comments
Open

insert_final_newline = unset doesn't obey existing setting #168

jsit opened this issue May 4, 2021 · 2 comments

Comments

@jsit
Copy link

jsit commented May 4, 2021

I have insert_final_newline = unset in my .editorconfig, and set nofixendofline in my .vimrc.

When editorconfig runs, it turns fixendofline/fixeol on again, because insert_final_newline isn't set to false:

    if s:IsRuleActive('insert_final_newline', a:config)
        if exists('+fixendofline')
            if a:config["insert_final_newline"] == "false"
                setl nofixendofline
            else
                setl fixendofline
            endif
        elseif  exists(':SetNoEOL') == 2
            if a:config["insert_final_newline"] == "false"
                silent! SetNoEOL    " Use the PreserveNoEOL plugin to accomplish it
            endif
        endif
    endif

It may make more sense if unset just used the existing (no)fixeol setting.

The reason I'm using unset at all is because I have true in my home folder's .editorconfig, but want to unset it for a project in a subdirectory.

@jsit
Copy link
Author

jsit commented May 4, 2021

Maybe:

if a:config["insert_final_newline"] == "false" || !&fixendofline
    setl nofixendofline

@cxw42
Copy link
Member

cxw42 commented Aug 14, 2021

Related to #136

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants