My Vim config to develop in C with GLib (can be useful to Vim users)

Hi,

See:

Of course there are alternatives to Vim to develop in C with GLib (Builder, Anjuta, VS Code, Emacs, etc).

It’s more for developers who have already learned Vim and would prefer to keep it. Especially newcomers who want to leverage what they already master instead of needing to learn new tools and new workflows.

BTW, it’s the kind of things that I’ve not seen a lot, GNOME developers sharing their Vim or Emacs config, or whatever else.

(Note, this might be silly if you know that I’ve contributed quite a bit to gedit, GtkSourceView etc, but traditionally I’ve always used Vim to develop in C, and used gedit for example for Vala for which there was a good plugin, gnome-latex for LaTeX, and now gedit for basically everything else than C).

(Note also, I’m aware that Builder has a Vim mode too, but I suppose that the Vim mode of Builder is not as powerful as Vim itself, and an IDE is not the taste of everybody).

That’s it,
feel free to copy some chunks, or even use a whole plugin or even copy most of my main vimrc.

And if you know other life-changing Vim plugins when developing in C with GLib, don’t hesitate to share :wink:

Cheers,
Sébastien

I forgot to say, ideally I would like to go the extra mile and publish the plugin(s) on:

https://www.vim.org/scripts/index.php

I will see.

This is very much true, especially in GTK 3 where Builder’s Vim implementation had to be implemented in (shock and horror) CSS.

GtkSourceView 5.x has a built-in Vim input method which you can use from GNOME Text Editor in GNOME 42 if you don’t need scripting (ie: vimrc) support. It’s much more complete than what we did in Builder and will be part of Builder in GNOME 43. You can toggle it on with:

gsettings set org.gnome.TextEditor keybindings vim

and change to default if it turns out you don’t like it.

Glad to see the huge progress, this must be a lot of work!

I also know that Vim has a GtkWidget implementation that is used in GVim. But it’s limited in what you can do with it, I think. I would love for example to have something like GtkSourceCompletion with Vim, or a GUI for showing “calltips” (just showing the prototype of a function when we ask for it and when the cursor is inside a function call).

Basically a GUI is of course much more flexible than a TUI (when Vim is run inside a terminal) and it allows neat features, as we all know :wink: But, yeah, as I said I’ve always used Vim for the C language, so habits die hard.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.