Readit News logoReadit News
xarcolade commented on Vim Macros for Beancount   tangled.sh/@adam.tngl.sh/... · Posted by u/xarcolade
aidenn0 · 6 months ago
Macroing Tip: whenever possible start a macro with a motion that will move the cursor to a known location. E.g. for line-oriented macros use "0" and for paragraph oriented macros use "}{". Then the macro will work regardless of where you put the cursor.
xarcolade · 6 months ago
Perfect! Great advice
xarcolade commented on Vim Macros for Beancount   tangled.sh/@adam.tngl.sh/... · Posted by u/xarcolade
xz18r · 6 months ago
Also check out beancount-mode for emacs: https://github.com/beancount/beancount-mode
xarcolade · 6 months ago
I've been struggling to on-ramp and sustain using Emacs for a while now. The paradigm shift from vim for me is frustratingly vast. I know I just need to give it the same patience I gave vim many years ago :)
xarcolade commented on Vim Macros for Beancount   tangled.sh/@adam.tngl.sh/... · Posted by u/xarcolade
vanous · 6 months ago
Very cool! A while ago i did something similar and tried to learn vim more in depth by creating some more complex macros - several of them, to convert some text snippets into markdown. Problem was, that several months later i could not exactly remember some details of these "reusable" macros - where exactly to place cursor when starting them, the order of execution and so on. Thankfully, vim has the amazing ability to run commands/script on text selection, so i rewrote my macros in a scripting language. It has several bonus points: i can store them in git and track changes, code can be self-documented via comments. My macros were not too complex, but still, using a proper scripting ended up being much better.
xarcolade · 6 months ago
Insightful! I have had the same issue with forgetting where exactly I need the cursor. I did not know you could run script/commands on text selection, I will definitely look into this. The extent of my vimscript journey so far is directly making system() calls to external scripts, and I've been using the ability to Ctrl-R while entering a :command to dump yanked text as a crutch. Your approach sounds much more sensible.
xarcolade commented on Vim Macros for Beancount   tangled.sh/@adam.tngl.sh/... · Posted by u/xarcolade
xarcolade · 6 months ago
Hello! Sharing on HN is a first for me. When I wrote this I thought I was producing something with a steady enough on-ramp that someone could follow along with a little bit of sustained curiosity. After sharing it with some friends I realise it might still be a steeper/poorly constructed ramp than I initially thought. Either way I'd love to hear from you if you found this interesting!

u/xarcolade

KarmaCake day29August 19, 2025View Original