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

why not support c? #35

Closed
kdurant opened this issue Jan 17, 2015 · 3 comments
Closed

why not support c? #35

kdurant opened this issue Jan 17, 2015 · 3 comments

Comments

@kdurant
Copy link

kdurant commented Jan 17, 2015

a lot of people use C

@benekastah
Copy link
Collaborator

I'm more than willing to support any language at all. The reason there is no support for c at this moment is that nobody who regularly uses it has added support for it yet. I will happily merge a pull request that adds c support. To do this, you will need to add a file at autoload/neomake/makers/c.vim. A good minimal example of what this file should look like can be found at autoload/neomake/makers/ruby.vim. It might look roughly like this:

" vim: ts=4 sw=4 et

function! neomake#makers#c#EnabledMakers()
    return ['gcc']
endfunction

function! neomake#makers#c#gcc()
    return {
        \ 'args': ['-Wall', '{OTHER_ARGS_HERE}'],
        \ 'errorformat': '{REASONABLE_ERROR_FORMAT_HERE}'
        \ }
endfunction

Then you just fill in the blanks.

@benekastah
Copy link
Collaborator

I should also mention that if you want to get up and running quickly for yourself, you have a couple of options apart from modifying the plugin source code.

  1. Set your makeprg and errorformat to whatever you use for c coding. If your makeprg can take a filename as an argument, then running :Neomake will just work. If it doesn't take an argument like that, you can run the command with no arguments in vim's current directory by running :Neomake! (note the exclamation point).
  2. Set up a linter like this:
let g:neomake_c_enabled_makers = ['gcc']
let g:neomake_c_gcc_maker = {
    \ 'exe': 'gcc',
    \ 'errorformat': '{WHATEVER_YOU_USE}',
    \ 'args': ['{WHATEVER_YOU_USE}']
    \ }

And run it on a c file using :Neomake!. As long as the executable takes a single file as input and your errorformat is accurate, it should just work.

@benekastah
Copy link
Collaborator

#36 and #37 add c++ and c support respectively with clang.

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