editorconfig-vim icon indicating copy to clipboard operation
editorconfig-vim copied to clipboard

insert_final_newline = unset doesn't obey existing setting

Open jsit opened this issue 3 years ago • 2 comments

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 avatar May 04 '21 13:05 jsit

Maybe:

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

jsit avatar May 04 '21 14:05 jsit

Related to #136

cxw42 avatar Aug 14 '21 16:08 cxw42