This is a fork of the Vim extension with the aim of being, in essence, a rudimentary proof of concept of how clangd might be leveraged to implement structured navigation and editing of C/C++ code. Please read this article for a more thorough explanation of the underlying ideas and motivation for this project as well as how the model it proposes differs from conventional editing.
Disclaimer: this is a project which aimed at nothing more than being a testbed for some notions about an alternative editing paradigm and is not meant to be a finished product or even one that will be actively developed. While enough was done to demonstrate the key ideas and hopefully inspire further discussion on the subject, do not expect something stable or particularly featureful.
Instead of navigating to the previous character, the h key now navigates to the previous sibling of the current AST node (wrapping around if one requests the previous sibling of the first child; note that internal
is #define
d as static
):
Likewise, the l key now navigates not to the next character, but to the following sibling of the current AST node (with the same wraparound behaviour):
j is repurposed and no longer goes to the character below, but to the first child of the current node. In the following example, we progressively narrow down our scope from the function to one of its innermost statements, changing siblings along the way as necessary:
k meanwhile no longer goes to the character above, but to the parent node. Here, we take the contrary journey, from the statement to the function:
e (for "extract") makes the current node an elder sibling of its parent:
s (for "substitute") replaces the parent node with the current node:
And x now deletes the current node: