TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Opinion: Structural editing is superior to the Vim grammar

5 pointsby rishflabalmost 3 years ago
I tried switching from jetbrains to various modal editors (neovim, doom-emacs, kakoune, helix). The fast startup time and continuity when working in a terminal environment was very appealing, as was the promise of increased code editing effeciency.<p>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&#x27;t really edit text, we edit code. VIM&#x27;s grammar does not acknowledge this. It is centered around lines, words etc. Code is a tree. A grammar&#x2F;keybinds designed around traversing, selecting and modifying this tree would be superior for editing code IMO.<p>Of course I can install tree-sitter and setup structual editing based bindings but am I really using VIM at this point? I don&#x27;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&#x2F;keybinds that center around structural&#x2F;tree based editing. I have found that IDE&#x27;s tend to acknowledge this tree based &quot;reality&quot; better than VIM.<p>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.

6 comments

nequoalmost 3 years ago
I agree with this sentiment. Line editing is to ASTs as a 4-speed automatic transmission is to a CVT. It is limited only by historical baggage and the power of habit.<p>&gt; Of course I can install tree-sitter and setup structual editing based bindings but am I really using VIM at this point?<p>Why would this mean that you are not using Vim?<p>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.<p>Or to put it differently: Vim and Emacs both link to libpcre for regular expression parsing, but that doesn&#x27;t mean that if you use regular expressions in Vim, you are using Emacs.
cookiengineeralmost 3 years ago
As a long time VIM user, I tend to agree with you in your points. VIM and its concept was built at a time when text was green, and when you had maybe 30 lines of code in front of you.<p>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&#x2F;linters were always completely broken for me when I tried them out.<p>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).<p>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&#x27;s AST insights.
linsomniacalmost 3 years ago
LunarVim might get you closer, I haven&#x27;t explored any enhanced structural editing features with it, but it does have TreeSitter integrated and has a lot more IDE features integrated. The idea of structured editing seems interesting, but I&#x27;ve never really been able to wrap my mind around what that would realistically look like.<p><a href="https:&#x2F;&#x2F;www.lunarvim.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.lunarvim.org&#x2F;</a>
samwestdevalmost 3 years ago
What&#x27;s `Structural editing`?
评论 #31983869 未加载
gigatexalalmost 3 years ago
The point and power of vim or neovim and the others is plugins in my opinion. It can be customized to make you faster at what you do. I love my setup. It works great for me. I can’t use a full IDE, I’m broken in that way.
评论 #31983725 未加载
swahalmost 3 years ago
So you want the up and down arrows actions to move to the next statement instead of line?