I was happily using vim (neovim), then one day I discovered Lisp,
a week later I switched to Emacs
I had been using vim since 2017. At the first I had vscode as a backup for when I had to do some major code refactoring, but around mid 2020, I decided to go fully vim and never turned back, until one day…
A Vim Confession
Although I had been using vim to a religious level, I felt the need for something more rich from time to time. Following are some of the pain points I had with it.
No proper GUI
Now don't get me worng, I don't enjoy clicking around with the mouse all day, I want to keep using the keyboard as my primary input device, but we keyboard lovers mostly end up spending most of our time on the terminal emulators because there isn't much GUI software built with the keyboard in mind. I think that's where things have gone wrong, GUI doesn't mean we have to lose the convenience of doing things with the keyboard. I use a lot of terminal related utils, but I fancy a nice gui version of vim.
Viml and Lua
Yes vim and neovim has bindings for a lot of languages for plugin development, but to do basic config stuff you need to deal with either viml or lua. Yes, lua is simple, it's easier to understand and write, but I just don't enjoy lua much.
Vim Emulation on other editors
In the past I have tried a few other editors/IDE's with vim emulation, like vscode, webstorm, sublime. For the most part vim style editing works fine but as soon as I try to work with multiple files, I'll have to go back to using the mouse at some point, which I don't really enjoy while writing code.
The main reason for that is the fact that unlike vim none of those editors were built to operate with just a keyboard. But I always knew there was this other editor which was keyboard driven just like vim, more on that later.
So if other editors don't cut it, it must be emacs right, emacs was built with keyboard in mind, it came around the same time as vim. Also I have heard all the stories about people switching to Emacs because of how awesome org mode was or Magit (a popular git client implementation on Emacs), but I also none of that is going to made me use Emacs if it can't give me the same experience while writting code. So I thought I'd give it a try.
I have tried vanila Emacs and it's built-in tutorial before, but I never liked the default keybindings that came with it. I also didn't want to spend a lot of hours in Emacs to learn how to configure. I have heard of these prebuilt distributions of Emacs, I wanted to try one of those to see if Emacs can do what I want. If it works then I can learn how to config it later.
Two major such distributions I've heard of was Spacemacs and Doom. I didn't like the layer system in Spacemacs, so I decided to try Doom Emacs.
Immediately after trying it I had these issues:
Doom emacs was slow to me compared to vim.
I still need to configure stuff to get it to a usable state for my taste, Evil mode (vim emulation) was good but it wasn't perfect.
On vim I just use Netrw to go into nearby files, I used "-" to open it and use j, k, h, l to navigate through it (this is not the default behaviour, I had my vim configed that way). But I just didn't know who to make Dired (Emacs's defeault file browser) to do that.
After a few hours of trying doom Emacs I wasn't interested enough in going further with it, because I wasn't that impressed with performance or Elisp (the language used to configure emacs).
So I decided that Emacs isn't for me, part of me secretly still wanted to try Emacs still, but my weekend was over, I didn't want to spend any more time on it, then I turned back to neovim, vim is the best editor in the world.
As a programming language enthusiast, I spend a lot of time learning about different languages, maybe more time than I really should. So, I have come across lisp many times, but it was something I was never interested in, because I always thought it's just some set of languages only used in some abstract mathematical theory level.
My first encounter of lisp in action was watching vim conf 2019, I saw this language called fennel, a lisp which compiles to lua. It can be used to configure neovim, basically it can be used in any place where lua can be used. That was interesting but I didn't try it because it was lisp
Finally, trying out fennel
On a one fine Sunday evening, I just thought of finally checking out fennel, just because I was fed up with lua, and I wanted to give a refresh to my neovim config, I thought I'd try this fennel lisp thing to see how far it goes, (hint: lisp did came very far although fennel didn't ).
So I started to explore a little bit of fennel side by side with Lua. I started writing stuff in fennel and watching the Lua output on a second split of my editor. To this date I can't articulate the feeling I got as I was watching that process. I was amazed by how I was able to generate so much lua with very little fennel, and very little syntax. If you know lisp, you know there's not much syntax to it, it's just mostly all lists, but the output on the Lua side was ugly, no blame on the compiler, it's just what Lua is, it's not pretty in my eyes.
Exploring more about lisp
After being marveled by watching fennel, I wanted to find out more about this lisp thing, so I went on youtube and started watching a lot of videos on lisp. One of the talks I watched referred me to this other talk called Simple made easy by Rich Hitchkey the creator of Clojure programming language. I kind of bought into what he said in that video, "Simple constructs make it easy to build better solutions" (this maybe not what he exactly said, but something around that, at least that's how I understood it).
So with this new mind said when I look back at lisp, I felt it, I felt that since lisp is so simple, maybe it makes it for crafting better software. And then I also thought about these stories about how Emacs has better packages (the equivalent of plugins in vim world) compared to the similar counterparts in vim. And even there have been innovative things like org mode which only actually first came in the Emacs world. And then I saw some more non Emacs stuff that was built with lisp.
It was still that same Sunday I rediscovered fennel, and I couldn't sleep well that night , I had a lot of lisp dreams, I was going to try all these new lisp stuff next weekend. There was suddenly a lot I wanted to try and find out more about, things like more fennel, Clojure, Clojure script, Common Lisp, and a big endless list of stuff.
Trying Doom Emacs again
The next week I kept watching more youtube videos on lisp in the evenings, and because a lot of Lisp programmers use Emacs, I saw a lot of Emacs stuff too. By around Thursday I couldn't resist the urge to try Emacs again. And I tried it, this time though, I was fully armed to write some lisp, so I was able to configure Dired to work similar to how Netrw worked in my vim configuration.
;; binding for going up a directory with "h" in dired (map! :map dired-mode-map :n "h" #'dired-up-directory) (map! :map dired-mode-map :n "l" #'dired-find-file) (after! dired (map! :n "-" 'dired-jump)) ;; show simple list without the all the ls -al stuff (add-hook! dired-mode (dired-hide-details-mode))
That was it, that's all the elisp code I had to add to get Dired to behave the way I wanted to, this was pretty straight forward, I know I'm using the doom emacs macros, but it gets the job done. By this time I was pretty impressed by the fact that I was just able to configure emacs to be more like I needed it to be.
So I decided to spend that evening playing a bit more with Emacs and coding a bit more to see what's missing, after hours and about a few more lines of elisp, I had Doom emacs working, very similar to my tmux + vim setup.
But wasn't Doom emacs slow?
I actually didn't care anymore, I existed in this new lisp driven environment, I didn't want to lose it. Yes it took like a few more milliseconds to open a file sometimes, but not all the time, but with that and a few lines of configuration I was getting a lot more.
In the past I was running away from emacs because of lisp and also because I was so in love with vim. But lisp got to chase behind Emacs this time around. And now I'm also using all the other good stuff which came with Emacs. I'm using Magit for most of my git work. I'm becoming an org-mode junky . I'm tracking my time on it, taking my notes on it, and even writing this blog post on an org file. And also, I'm working on my own Emacs configuration on the side as I find time, so that I don't have to depend on Doom config.
Is Emacs the best text editor in the world now?
No!!, In my opinion, that place is still for vim, then why Emacs? because Emacs is overall a better software and an extendable interactive development environment, yes, by design it's made for extendibility. To be fair I'm still using vim key bindings for almost all the editing I do inside Emacs. I have even mapped Ctrl+u to do page up, but I think that's a big no no in Emacs world, because Ctrl+d has some special meaning on Emacs, I may or may not change that in future, but that's what I have for now.
So was Vim a mistake? would it have been better if I had started with Emacs itself?
I don't think so, as I said, figuring out how to get productive with Emacs was a bit hard at first. I don't think I'd have taken this big of a leap if I hadn't started with vim to begin with. So I'm glad I started there.
This is it!!
I can write this post forever and never publish it, so I'm going to end it here, I'll write more about this new experience in future.