box.matto.nl
Enjoying Open Source Software

Editing with mg

Avid Vi(m) user

I have been using Vi and Vim for more than two decades, for most of the stuff I write.

Also for official office documents, like management memo's and management reports I use Vi or Vim as much as possible. I write these either in LaTeX or in Markdown. Markdown I convert with Pandoc to LaTeX.

After this, pdflatex creates a beautiful PDF from the LaTeX file.

I use Vim to write my email messages with Mutt, to write shell scripts, Perl scripts and so on.

During my workday I have a lot of meetings and for all those meetings I keep notes. For this I use Vimwiki.

All in all I guess that I spend at least six hours per day in Vi and in Vim.The Vi and Vim keys are engraved in my muscle memory, and I issue most edit commands automatically, without thinking about it.

Using ed

In 2018 I discovered ed and decided to invest time in it. So I looked up the most important commands and started using ed, learning on the go.

I realized that I could only really learn how to use ed by actually using it. To do this, I set ed as my editor in w3m and started using this for editing my personal wiki. Also I used ed to edit my dotfiles and other config files (like fstab, pf.conf and so on).

Today, I use ed almost daily for many small editing tasks. Also I use ed with heredocuments in scripts more and more.

Emacs

During these last two decades I have occasionally looked at Emacs. Org mode looks awesome and there are many things one can run inside Emacs. And every time I got scared by the keybindings.

I have tried Viper mode and I have tried Evil mode. Both seems promising at the first glance, but when I started doing real work, I discovered there are still some issues with these modes. Of course, many have been solved. But still, things like rec-mode (for recutils files) are not working fine with evil mode.

Also I discovered that some things are really much nicer in Emacs. Extensions like rec-mode and ledger-mode are much nicer than the Vim plugins for recutils and ledger-cli. And org mode really does has a lot more to offer than Vimwiki.

What I also like is that Emacs can be used as a REPL for Forth and for Lisp.

As I have come to see it, Vi and Vim are editors, while Emacs is more a platform to run many other things.

So, I decided to take the plunge and jumped straight into Emacs, without viper or evil mode.

Now, I am trying to learn using Emacs with the default keybindings. I have an old O'Reilly book "Learning GNU Emacs from 1996, and the chapter "Customizing Emacs" starts on page 299. The authors, Debra Cameron, Bill Rosenblau and Eric Raymond, clearly thought that one shouldn't start with customized settings, and who am I to disagree?

I really have to unlearn to use Esc so often, and things like "cw" during editing existing text, and so on.

mg

During an email conversation about all this, I was advised to have a look at mg. This is small Emacs like text editor using the Emacs key bindings.

I did some "research on the internet" (a.k.a. using Google to see what comes up), installed mg and started to play with it. With the install of mg comes a great man page, which describes all the default keybindings and the commands, so this is a nice way to learn a lot.

So, here I am, writing this text in mg :)

Small is beautiful

I like the elegance of a very small editor, and using the terminal, tmux and terminal applications.

It still feels very clumsy and awkward, but I suppose this was the same when I started to learn Vi in the nineties, and have become repressed memories. I do think modal editing is very efficient and nothing beats the dot command of vi (.).

My goal at the moment is not to replace using Vi, Vim, and ed, but to use Emacs next to these, mostly for those enhancements like org mode and all those useful modes like rec-mode and ledger-mode, and playing with Forth and Lisp.

I think that using mg is a nice way to getting used to the Emacs way of editing and the default Emacs key bindings.

Have fun!

Tags:

⇽ Convert Markdown-ish to PDF with Groff MOM Proud member of 10KB club ⇾