Remix.run Logo
▲ precompute an hour ago

I wrote the following in response to a comment that was deleted before I could post my reply.

> Do you have any examples of these Emacs shortcuts that simplify your life?

> I tried using Emacs with Evil but I was just using it as a somewhat laggier Vim.

Learning how to use prefix arguments and writing interactive functions have been very useful. Whenever I want functionality that's just a little different than what Emacs provides, I can always write a function and bind it.

Emacs also comes with regional undo/redo and has great undo tree visualization plugins.

Another feature I've come to appreciate recently is the built-in per-frame and per-window tabs. I moved from using separate frames to using tabs. Tabs inside tabs lets you visit many files at once while keeping visual clutter to a minimum. (In Emacs parlance, a "frame" is the window your WM handles, and a "window" is a visible child of that frame)

Also, outline-minor-mode is really nice for annotating files with headings. You can define custom regexp and sidestep collaboration restrictions and quirky formatting.

The calc is super-useful.

file-local variables are useful. directory-local variables are incredible, they set up custom environments for all folders at the same level / below them. Imagine doing a (let) but over a directory structure.

Vim has default C-p completion. Emacs has hippy-expand, which IMO is better. Some glue around hippie-expand can also make it work with a drop-down completion interface like corfu.

Some examples:

In tab-bar-mode the tab nav functions don't wrap around. So I wrote a small wrapper around the tab nav functions. It's about 10 lines of elisp and handles forward, backward and tab creation. For neovim this would've been much more difficult. In emacs it involves basic functions: interactive, let and cond.

I have a small package that opens new scratch buffers and inherits the major-mode of the buffer it was invoked from. Very useful to write temporary code. One shortcut and it always works.

I have a function that opens all dired selected files in a new tab/frame. Great for organization. Basically you open dired, mark files and run the commands, and they're open in a new tab, and all marks are unmarked. So you can very quickly structure a project for work.

Another function that moves forward/backward to the next logical file. Saves me a trip to find-file / dired.

I have a monorepo that I code in and it has different folders for different languages / folders. Because it's a monorepo, file completion shows ALL files in the monorepo. And running a LSP server also starts at the monorepo root, which is not ideal. With directory-local variables, I can set a custom file (like .gitignore) to denote a repo root. So emacs (and LSP servers via Eglot) will consider the presence of that file the repo root and make it work like an independent repo. ((nil . ((project-vc-extra-root-markers . (".gitignore")))))

(I've been using Emacs longer than I used vim, so my experience is skewed. I also used it as a laggy vim (Doom Emacs) for the first few years, and then moved to a custom config, which helped me really understand what was happening under the hood)

Perhaps there is a vim plugin for each one of these; but I certainly wouldn't be able to do ALL of these by myself in vim! Also because many of these are built-in emacs functions, they're guaranteed to be supported for a very long time.