Opinion: Structural editing is superior to the Vim grammar
I liked the fast startup time and having the same keybindings to edit system config files but I am not impressed with VIM style text editing. First of all programmers don't really edit text, we edit code. VIM's grammar does not acknowledge this. It is centered around lines, words etc. Code is a tree. A grammar/keybinds designed around traversing, selecting and modifying this tree would be superior for editing code IMO.
Of course I can install tree-sitter and setup structual editing based bindings but am I really using VIM at this point? I don't think the VIM grammar is the future of code editing. I think it is a bit overrated. I think editor designers should work on developing a grammar/keybinds that center around structural/tree based editing. I have found that IDE's tend to acknowledge this tree based "reality" better than VIM.
I think this concept could even be applied to source control ie. git stores an tree-sitter like representation of code instead of text. Your text editor handles formatting.
8 comments
[ 1351 ms ] story [ 549 ms ] threadhttps://www.lunarvim.org/
If you have a selection eg. a node on this tree, expand selection would move up one level on this tree and select the higher node and everything underneath it.
You can play around with this concept here: https://tree-sitter.github.io/tree-sitter/playground. Click the blue elements in the tree section and see how it affects what is selected.
Now imagine a grammar/keymap which is optimized for traversing, selecting, mutating code at this level. I think this is the future, not the VIM grammar. Many IDE's already do this style of editing to an extent.
My hopes for NeoVIM were that they changed the concept in the sense to find a new grammar that is based on the AST (sentences could be statements, for example). Sadly NeoVIM kind of underdelivered, syntax highlighting and AST/linters were always completely broken for me when I tried them out.
No idea why, there might be still some issues from me there that were closed due to inactivity (as if time would fix bugs magically).
I kind of hope that the LSP revolution will lead to better IDE concepts that can bridge the gap between navigation and repetition efficiency and the code's AST insights.
> Of course I can install tree-sitter and setup structual editing based bindings but am I really using VIM at this point?
Why would this mean that you are not using Vim?
You are using Vim with a Vim extension that gives you better keybindings. That extension happens to pull in Tree-sitter, in the same way as Atom would. But your setup is faster and consumes much less memory.
Or to put it differently: Vim and Emacs both link to libpcre for regular expression parsing, but that doesn't mean that if you use regular expressions in Vim, you are using Emacs.