[linux] Vim/NeoVim + chibios + YouCompleteMe + Ycm-Generator

This forum is about you. Feel free to discuss anything is related to embedded and electronics, your awesome projects, your ideas, your announcements, not necessarily related to ChibiOS but to embedded in general. This forum is NOT for support.
totalkrill
Posts: 12
Joined: Thu Jul 09, 2015 2:21 pm

[linux] Vim/NeoVim + chibios + YouCompleteMe + Ycm-Generator

Postby totalkrill » Wed Aug 17, 2016 10:39 am

Hello!

I guess this might actually be a kind of a niche topic :D but still. I just wanted to show people that are using vim as an editor while doing projects with ChibiOs (Like I am) that there is a way to get the supernice autocompletion in vim and the ChibiOs project, from what I have seen it also finds the correct files for even specific structures for specific processors.

So what I am using is NeoVim under manjaro linux, To complement me with some autocompletion and also some edit-time warnings and errors I am using the absolutely amazing project https://github.com/Valloric/YouCompleteMe. This project takes care of all the autocompletion. The problem is that this needs to know what compiler flags you are setting and such to be usable. To fix this I am using the https://github.com/rdnetto/YCM-Generator project, but a bit patched to actually read the output from stdout and parse those flags and generate the file that YouCompleteMe needs.

link to patched generator: https://github.com/TotalKrill/YCM-Generator/tree/stdout

Now with this I can use the following bash command, also i am doing verbose builds:

Code: Select all

~/.config/nvim/bundle/YCM-Generator/config_gen.py -s -B arm-none-eabi-gcc -f .

(This will make clean and then run make)

This then gives me autocompletion for internal ChibiOs stuff, a quick test in the testhal/STM32F37x/ADC/ folder looks like this:

2016-08-17-111759_844x244_scrot.png


I am using the following nvim setup if anyone is interested, there is also very basic installation tips there ( the correct version of the YCM-Generator has to be downloaded separatly for now, pull is request pending)

https://github.com/TotalKrill/.nvim

utzig
Posts: 359
Joined: Sat Jan 07, 2012 6:22 pm
Location: Brazil
Has thanked: 1 time
Been thanked: 20 times
Contact:

Re: [linux] Vim/NeoVim + chibios + YouCompleteMe + Ycm-Generator

Postby utzig » Wed Aug 17, 2016 1:34 pm

Hey,

Nice! I use Vim+YCM for programming Python and Rust. Might as well give this a try when I get some time to hack on ChibiOS again.

Cheers,
Fabio Utzig

User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Location: Luleå, Sweden
Has thanked: 5 times
Been thanked: 6 times
Contact:

Re: [linux] Vim/NeoVim + chibios + YouCompleteMe + Ycm-Generator

Postby Korken » Wed Aug 17, 2016 11:13 pm

This was a really good script!
Not my Nvim workflow is even better, it even gets the correct files in ChibiOS without any problem (including the ones added via defines).

totalkrill
Posts: 12
Joined: Thu Jul 09, 2015 2:21 pm

Re: [linux] Vim/NeoVim + chibios + YouCompleteMe + Ycm-Generator

Postby totalkrill » Tue Sep 27, 2016 11:03 am

Now the development branch contains support for the arm-none-eabi compiler. Making it easier and faster to use. :) very recommended :)


Return to “User Projects”

Who is online

Users browsing this forum: psyco and 35 guests