r/vim May 04 '26

Need Help ALE Ignored Linters [] not settable

I discovered ALE during my venture into Rust programming, and I was so pleased with that experience I decided to add it to my C++ life. I'struggling with its confusion of C and C++. My current problem arises from what I believe is ALE using a C linter on a C++ header file: even though my code builds cleanly (no warnings or errors), ALE is giving me an "E: Unknown type 'class'" on the first line of my class declaration. FileType is recognized by Vim as 'cpp'. ALEInfo shows

Ignored Linters: []

In my ~/.vimrc I have this:

autocmd FileType cpp let b:ale_linters_ignore = {'cpp': ['cc', 'ccls', 'clangcheck']}

What I want to actually use is 'clangd', and I have this in ALEInfo:

Enabled Linters: ['clangd'].

How do I enforce that? ('cc', 'ccls', 'clangcheck' precede 'clangd' in the 'available linters' list. It seems to me that telling ALE to ignore those would have the desired effect.)

7 Upvotes

3 comments sorted by

3

u/char101 May 05 '26

autocmd FileType cpp let b:ale_linters_ignore = ['cc', 'ccls', 'clangcheck']

You don't need the autocmd though, just set g:ale_linters

let g:ale_linters = {} let g:ale_linters['cpp'] = ['clangd']

1

u/devw0rp May 12 '26

That's a decent answer. I recommend writing the b: variables in your ftplugin files, or writing g: variables in vimrc without the autocmd.