Vim and Haiku

Vim is my preferred text editor environment. I’d love to get autocomplete working in vim, either coc or ycm. Both have the requirement of a working py3 enabled vim. But I see that at least one Haiku user has overcome this hurdle. Getting either installed vim-natively currently fails.

I would use the ycm recipe in ports, but things have changed since that was written. What is the current way of getting completion working in vim for those setting up a new environment from scratch and not having an older environment that they have been using for several years? Should I be using x86 as opposed to x86_64?

Why not try to fix the recipes?

1 Like

I’d love to, but I’m in a bit above my head. Which is exactly the intent of my query. I’m not sure where to start. But I will will look further into it as I have time. And I’d also want to not duplicate work if someone is working on this.

Also, installing vim plugins is best done natively within vim. According to @PulkoMandy, this recipe (ycm) was a hack to simplify the use of this plug in in the short term. It was meant for this recipe to be deprecated once native installation was easily possible. Things have changed in the YouCompleteMe code that possibly make this possible since the recipe was created. So the recipe possibly is no longer relevant.

As far as getting the vim recipes working with python and python3, it seems some code wizardry that is above my level is needed. But I will keep plugging away at it as much as I can. I’d like to dissect what others apparently have working to build my experience to get the rest working. But I haven’t yet gotten working what others say they use. Which is why my question about should I revert back to x86_gcc2 or is there something I’m missing?

What? Why?

Why would you manage your vim plugins manually when we have a great package manager that can handle updates for you? Sounds like a very strange idea to me. Please keep the recipe (and update it if you can).

On x86_64, you shouldn’t have this much problems, YouCompleteMe can be set up normally, with a fully python3 environment.

The problem I had at the time, that made the recipe a bit complicated, is that vim for 32bit Haiku is built with gcc2, and there is no Python3 library for gcc2. So, vim itself runs with Python2 scripting, but YouCompleteMe server runs with Python3. I had to convince YouCompleteMe code that this is a valid setup, even if the YouCompleteMe developers wouldn’t expect it.

This is the “temporary hack” that I mentionned. The proper fix would be:

  • Make sure to compile vim with gcc11 and with python3 support, on all architectures
  • Simplify the YouCompleteMe recipe to be fully Python3 as inteded by YouCompleteMe developers

Then there should be no “clever” hacks anymore, the recipes will be a lot simpler and more maintainable.

4 Likes

This highlighted some shortcomings in what I was trying to do. I will give it another shot later.

While I love our excellent package manager, handling vim plugins natively in vim makes more sense to me. Especially from the standpoint of using several operating systems and portability of the vimrc. I may be missing something here as I’m still trying to get any solution to work.

That’s fine for simple plugins that are purely implemented in vim. But youcompleteme is not built like that. There is only a small part of it running inside vim, that starts a separate server written mostly in python and uses sockets to communicate with it. The server also uses libclang, so a part of it is written in C++. This is all compiled when you install or package the plugin. So you can’t carry that part from one machine to another, especially not accross different operating systems.

1 Like