editorconfig / editorconfig-vim

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

Can't disable plugin #202

Open MeShootIn opened 1 year ago

MeShootIn commented 1 year ago

Problem

Command :EditorConfigDisable, which although not present in the documentation, and setting (manually via Vim Command mode and via ".vimrc") buffer variable (:let b:EditorConfig_disable = 1) don't disable plugin.

Steps to reproduce

  1. Open a test file containing only one string "test"
  2. Try to disable the plugin using a command or variable
  3. Enter Insert mode, add some extra spaces at the end of the line and return to Normal mode
  4. Save the file by typing :w

And after that all extra spaces from the end of the line are removed, which indicates that the plugin is still working. I even tried to run Vim (vim -u ./.minimal_vimrc ./test.txt) and Neovim (nvim -u ./.minimal_vimrc ./test.txt) with a minimum config (all files are below), but the plugin still wasn't disabled.

My configuration

Minimal config "./.minimal_vimrc"

call plug#begin('~/AppData/Local/nvim/plugged')
Plug 'editorconfig/editorconfig-vim'
call plug#end()

"./.editorconfig" file

root = true

[*]
trim_trailing_whitespace = true
cxw42 commented 1 year ago

Confirmed; thanks for reporting! :EditorConfigDisable does not clear the autocmds in all the groups, notably editorconfig_trim_trailing_whitespace.

:autocmd editorconfig_trim_trailing_whitespace
--- Autocommands ---
editorconfig_trim_trailing_whitespace  BufWrite
    <buffer=1>
              call s:TrimTrailingWhitespace()
kevin61416 commented 1 year ago

Hi All, any update on this issue?

cxw42 commented 1 year ago

Not from me --- sorry! PRs are always welcome, however :) .

xuhdev commented 1 year ago

Are you seeking to disable for only a selected buffer?

MeShootIn commented 1 year ago

@xuhdev yes.

k-takata commented 1 year ago

:help tabpagebuflist() shows how to get a list of all buffers in all tabs:

            let buflist = []
            for i in range(tabpagenr('$'))
               call extend(buflist, tabpagebuflist(i + 1))
            endfor

Maybe useful for disabling autocmd in all the buffer?